Dynamically adding DataGrid rows
Got a problem I can't seam to figure out.
I have a form that contains 2 textboxes and 2 datagrids.
The textboxes hold a date that can be selected by clicking a button. the button opens a popup date selector that populates the forms date box.
The datgrids also have a button attached to them that brings up a popup where the user can select a value that is then dynamically inserted into the datagrid.
The insertions are working as expected. I click the button, the popup comes up, I set the values, click ok in the popup, the data is added as a new row in the datagrid. The unwanted behaviour is this. If I add my row to the datagrid through the popup, then select any of the buttons the form does a postback and my datagrid reverts to it's viewstate thereby erasing the row I just dynamically entered.
Is there a work around to this? For instance, is there a way to dynamically add the row to the datagrids viewstate. What can I do to ensure that the rows I dynamically add to the datagrids remain after a postback of the page?
Any help is appreciated.