开发者

Values getting lost from asp.net controls

I know the title may be funny for you but I am actually facing it. My page has a checkbox and textbox. I have a flash control (not developed by and so I don't have it's code) a开发者_C百科nd a button inside that control. When the button is clicked inside flash control it causes redirection(or may be postback) to the same page but the values typed the user in textbox and checkbox are no longer available. They are lost! How can I handle this stuff? I am pulling my hair apart. I don't even the source code of that control. Is there any easy way I can preserver the state of the controls?

Thanks in advance :)


If the flash component is causing a redirect to the same page, you would certainly lose any values in your asp controls. I don't think there's any way around that.

To check if it's a redirect or postback, set a breakpoint inside the Page_Load method of your page. Click the button on the flash control and check the Page.IsPostback value.

If it's false, and you can't change the code of the flash component, I don't see any simple way to solve the problem.

You could create a page method or service method that is called whenever the value of the textbox or checkbox changes, send them back using ajax, and store them in the session. Then they would be there when the user clicks the button on the flassh component. This is kind of a hack but it would work.


It's probably not doing a postback. It's probably just redirecting back to itself, which is why the data is disappearing. That's a tough one to solve if you don't have access to the flash component source.


If it was a postback I would expect it to keep the values in ViewState. What is the flash doing ? Perhaps check if any Values are being passed in POST ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜