Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand"
  2. DataSourceID="SqlDataSource1">
  3. <Columns>
  4. <asp:ButtonField CommandName="insertNew"
  5. Text="Button" />
  6. <asp:TemplateField>
  7. <ItemTemplate>
  8. <asp:Button ID="btnAdd" runat="server" CommandName="insertNew"
  9. CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
  10. Text="Add" />
  11. </ItemTemplate>
  12. </asp:TemplateField>
  13. <asp:TemplateField></asp:TemplateField>
  14. </Columns>
  15. </asp:GridView>
  16.  
  17. Protected Sub GridView1_RowCommand(ByVal sender As Object, _
  18. ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs)
  19. If (e.CommandName = "insertNew") Then
  20.  
  21. Dim index As Integer = Convert.ToInt32(e.CommandArgument)
  22. MsgBox(index)
  23. End If
  24. End Sub
  25.  
  26. <httpRuntime maxRequestLength="32768" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement