I dynamically create gridview, and in this grid I have template field also
field.HeaderTemplate = New GridViewTemplate(ListItemType.Header, col.ColumnName)
field.ItemTemplate = New GridViewTemplate(ListItemType.Item, col.ColumnName)
grdEmpty.Columns.Add(bfield)
but when enter some value in text box in this template field i lose value on postb开发者_运维问答ack. And also on postback I lose all template field and i must re-create this grid.
My goal is: I have button and i want to add new row in this grid, but i want to have old value also.
I struggle with this all day, and any help is welcome.
Tnx,
Just recreate the grid during each postback. If you have viewstate enabled in the page and the gridview then the property will be restored.
See: here for more explanation
精彩评论