How can I maintain User Control Property State between WebGrid CallBacks?

7 replies. Last post: April 8, 2010 6:15 AM by Glenn Layaar
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

I have put ServerBinding WebGrid in a asp.net UserControl (.ascx).

The UserControl has properties that I normally maintain State with ViewState.

I also maintain State in an asp:TextBox.

I have found that between WebGrid CallBacks, such as an Add Row, if I make changes to the UserControl Properties, maintained by ViewState, the values do not stick.

I have tried the ControlState but it does not make a difference.

The only solution I have found is to maintain State in a Session Variable which I would prefer not to do since this would be the only Session Variable that I use in the application.

I found some articles that about "To work around this issue, I simply repeated the call to WebForm_InitCallback before starting the out-of-band call"

http://msdn.microsoft.com/en-us/magazine/cc163863.aspx

http://aspadvice.com/blogs/joteke/archive/2007/06/30/ViewState-_2600_-posting-with-callbacks.aspx

Is there something to configure for the WebGrid to make it maintain ViewState or do you have any other ideas as to how to maintain State in this situation?

Thanks,

Doug

All times are GMT -5. The time now is 3:25 AM.
Previous Next