views:

184

answers:

2

I have a custom gridview on rowdatabound i am adding new gridviewrows . but on postback the data in newly added row is not persists. Please help me to maintain the state of grid on postback as well...Actually i m showing group header rows and footer rows and showing some calculated values in group footer row...but on post back the values of new group rows is not persists but the grid row is ther without values.

A: 

See following: http://geekswithblogs.net/dotNETvinz/archive/2009/08/09/adding-dynamic-rows-in-asp.net-gridview-control-with-textboxes-and.aspx

Brij
Sorry Please see thishttp://www.aspsnippets.com/post/2009/06/10/Adding-Dynamic-Rows-in-ASPNet-GridView-Control-with-TextBoxes.aspx
Brij
@brij: you can edit your answer.
RageZ
A: 

You're adding the rows dynamically so you have to populate the grid every time the page is posted back, not just if(!this.IsPostBack).

If you're not persisting to a db every post-back and generating the grid looping through some result-set coming from your db - you might have to store info about the temporary rows in ViewState. People will be able to help on this if you expand your question.

If you're populating dynamically and the data is coming straight from some db (or even State) every post-back you might wanna disable the grid viewstate (as in that case you're sending back and forth useless stuff).

JohnIdol