|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Gridview deleteI 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 you can set the DataKeyNames property of the Grid to ConsultantID, and get
the value with the DataKeys property of the grid -- Show quoteHide quoteSaludos 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... > 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 >
What is syntax for Eval(User.IsInRole) to return True/False To Vis
How to change the font style and size on the entire Aspx page programatically Typing Markup Tags Ending in /> how to use Click event with programmatically defined button? Ajax Triggers for DropDownList don't fire Newbie Question: How Does One Access an Individual Field in a Record? Create image web control adapter Embeding html controls in Server Control Generating the *.aspx.designer.vb Files Regular Expression Validator question |
|||||||||||||||||||||||