Aspxgridview rowupdating findcontrol

The reason to use a custom button is to provide the Java Script confirmation box to the user when he clicks Delete.

aspxgridview rowupdating findcontrol-53

online dating in ontario - Aspxgridview rowupdating findcontrol

" End If End Sub Protected Sub grid View_Row Data Bound(By Val sender As Object, By Val e As Grid View Row Event Args) If e.

Data Item, "stor_id")) Dim lnkbtnresult As Button = Direct Cast(e. Find Control("Button Delete"), Button) If lnkbtnresult Is Not Nothing Then lnkbtnresult.

Approach 2 We have a minor change the in Template Field of the Gridview we write in So, we have remove the hidden field we have added in the last approacha and simply add the command argument to the link button, now to catch the command argument and send it to edit form write the following code on Row Command Event Approach 3: Ok, for this you need to add Data Key Names Property to main Grid View Markup.

In other word, it is an attribute of grid view which can accept multiple values using “,” but in our case we are using one.

Edit Index = -1 load Stores() End Sub Protected Sub grid View_Row Canceling Edit(By Val sender As Object, By Val e As Grid View Cancel Edit Event Args) grid View.

Open() Dim cmd As New Sql Command("delete from stores where stor_id=" stor_id, con) Dim result As Integer = cmd.

Notice that, we have taken a hidden field just in the same column we have the link button and have it default value of out primary key field.

Now on Row Command Event of the grid view write the following code I guess code does not need any explanation, so let’s move on to the next approach.

Find Control("txtcity"), Text Box) Dim state As Text Box = Direct Cast(grid View.

Find Control("txtstate"), Text Box) Dim zip As Text Box = Direct Cast(grid View.

So the task is to get the primary key of the row on which the link button is pressed.

Tags: , ,