Hello,
I have a gridview that is filled with a datasource & template fields dynamically.
( that has to be done because i ask the user for a datasource)
anyway, i started out creating a static but empty grid. and added the template controls and datasource & activated grid.DataBind() in the page_load event.
that gave me all the info when the page loaded on screen.
now i have an edit and update buttons on each row and pressing the edit button starts the page cycle and recreated the grid including databind and then goes on to the grid_onedit event.
here i changed the grids editindex, and here i also save the grid row to session so i would have to old_row saved.
when the page loads i change some data and press the update button.
as it should, page_load starts and the grid is created and grid.DataBind() is activated and now the the grid_onupdate starts and i update the datasource and then do another grid.DataBind() (i do this so that changes are done to the grid)
well, it seems alright but it's not.
i don't like to do 2 databind events on the grid each postback and moreover, i dont think the way to save the old_row data should be via the session.
i'm sure microsoft or someone thought of a better idea.
the problem is that if i remove the first DataBind the old_row data is still not created when the onedit event is started and i have no data to take.
and worse still is that the update event isn't firing when i do this becuase the row that i pressed the update button have not been created yet.
so, i am asking some one who is expirienced with asp.net and dynamic gridview. what's the way to go here?
when is the appropriate event to do databind and how do i get the old and new record in the update event as i should.
thanks,
koren.