all groups > asp.net webcontrols > december 2006 >
You're in the

asp.net webcontrols

group:

Gridview delete


Re: Gridview delete Marcos Mellibovsky
12/30/2006 9:44:34 PM
asp.net webcontrols:
you can set the DataKeyNames property of the Grid to ConsultantID, and get
the value with the DataKeys property of the grid


--
Saludos
Marcos Mellibovsky
MCT MCTS MCSD.NET MCDBA MCSE...
Cordoba Argentina

"L-E Eriksson" <L-E@nospam.com> escribió en el mensaje
news:uKFmWpGLHHA.2456@TK2MSFTNGP06.phx.gbl...
[quoted text, click to view]

Gridview delete L-E Eriksson
12/31/2006 12:28:18 AM
Hello!

I have a simple gridview. I am using stored procedures and a my own Data
Access Layer. Now I want to delete a row.

Gridview code:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns=false
AllowPaging="true" PageSize="5" DataKeyNames="KonsultID">
<Columns>
<asp:CommandField ButtonType="Button" ShowDeleteButton="true" />
<asp:BoundField DataField="ConsultantID" Visible="false" />
<!--PrimaryKey-->
<asp:BoundField DataField="FirstName"/>
<asp:BoundField DataField="LastName"/>
<asp:TemplateField><ItemTemplate>
</Columns>
</asp:GridView>

and then I have the code behind:
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles
GridView1.RowDeleting
Dim iVal As Integer = e.RowIndex
'Code missing here!
End Sub

'Now I know which row was clicked, but how do I get the value of the
ConsultantID?


Regards

Clarkie

AddThis Social Bookmark Button