aspdotnet-suresh offers C#articles and tutorials,csharp dot net,articles and tutorials, VB.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?That is why I recommended that you do this in your Page Pre Render event.
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'm not sure what you're stuck on so if you provide more information I can give you more help on the topic.
I've never actually used the Sql Data Source before. So, you need to populate the object that you are going to use as your data source at some point in your page life cycle.
I like to be in more control of my database connections. You could do this in your Page Load event if you want to.
Edit: if you do a Data Bind in the Page Load event every page request all of your data will be lost It's the most common problem that people have with Grid Views that I've noticed.
If you don't need to get data from the user, than yes you can do the Data Bind in the Page Load event.
Data Source property to the object you are using..call the Grid View.
Data Bind method to bind the Grid View to the data source.
But if you need to get data from the user for updating purposes then, no, you should do it in the Page Pre Render event instead.