@Frinavale Now I get the answer your mean is that when we bind the data at page load event.the view state is already loaded with previous value & that value again saved in a view state so the same data is displayed again & again whether you edit the data in a grid view or not. other thing i want to know what about the load postback event that is also fire between pageprerender & page load .I like to be in more control of my database connections. You could do this in your Page Load event if you want to.You could cache the object that you are going to use as a data source too.If I want to access the method in which we define update query, how can I access that method on aspx page & update the data in a grid view without direct use of an query on aspx page under sql data source?What you would have to do is implement a method that handles the Grid View. In this method you will have to retrieve the data from the row that is updating and use this data to update your database.i want to say one more thing i call the display method at the end of every event which i handled ....
Data Source property to the object you are using..call the Grid View.
In your Grid Views On Row Updating event you will call your data access layer's methods to do the updating.... -Frinny @Frinavale You said that we have to bind object with grid view at page.prerender . What happens is that the View State for the Grid View is loaded just before the Page Load event.
I think if we do the same thing on page load event it work because value is set when row updating event is fired. This means that all of the data that the user provided for the row that they are updating is loaded into the ASP.
-Frinny @Frinavale The event is fired between load view state & save view state when the event is fired it set the values in textbox or whatever server control we used. Then there is no matter of data loss if you load the page again but I have to bind data in a grid view through view state on page load no chance of data loss. NET Page Life Cycle for a more detailed explination. Data Bind in the Page Load event (without checking if it's postback) then you will not be able to retrieve user input in the Grid View. -Frinny The View State is stored some time in between the Page Pre Render event and the Save State Complete event (heading towards the Render stage).
All of this is covered in the article I sent you a link to :) I'm not sure what you mean by: @Frinavale Now i implemented the editing in gridview i handle events & after that i call display method in which i bind the grid view on page load event its work correctly.......
I want to use this method so I can do an update in grid view directly. Grid Views can bind to Data Tables, Data Views, Arrays of Objects ..more.