Gridview updating event in asp net

Posted by / 25-Jun-2016 06:20

In this article, I am going to explain how to manipulate data using Grid View control.

In practical scenario you should use your existing architecture to populate and update the data.

Till now our Grid View is ready to be populated, now let’s write a method to populate the Grid View. protected void Update Record(object sender, Grid View Update Event Args e) { Grid View Row row = (Grid View Row)Grid View1.

In this article, I am going to take a simple database table that has following fields: Auto ID - Int, Auto Increment, Primary Key Page Name - Varchar(50) Page Description - Varchar(500) Active - Bit(1) In this article, I am not going to explain the workings of Sql objects but focusing on the events and methods of the Grid View that will help us in updating and deleting the records.

Now let’s start with putting the Grid View on page. In the above code, I have kept Auto Generate Columns as false so that Grid View will not render all the fields of the data source automatically. Dispose(); } } To populate the Grid View, I am calling Bind Data() method from Page_Load event after checking Is Post Back property of the page, so the Grid View will only be populated when there is no postback on the page (when the page loads for the first time).

So I have to specify how I want them to appear in the normal view and edit view. When Edit link of the Grid View will be clicked then On Row Editing event will fire that will call Edit Record method.

gridview updating event in asp net-31gridview updating event in asp net-59gridview updating event in asp net-49

That’s why I have placed different templates like Item Template (for normal view) and Edit Item Template (for edit view). In this method, I am specifying the Edit Index property of the Grid View to the New Edit Index of the Grid View and then calling Bind Data() method again to bind the data. To String()); Text Box t Page Name = (Text Box)row.

One thought on “gridview updating event in asp net”

  1. But in order to get to the breakthrough full of all the yummy lessons this relationship served up, you have to get through the yucky part of the initial separation.