Rowcommand button in gridview doesn't fire,
the data in the gridview retrieved from TB_DOCUMENT, i intend to get the value of the first column (DOC_ID) and stored it to another table as new record (TB_DOC) can somebody help me with this? Thanks
Private Sub GridViewFile_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GridViewFile.RowCommand
Dim rowIndex As Integer = Convert.ToInt32(e.CommandArgument)
Dim id As Integer = Convert.ToInt32(GridViewFile.DataKeys(rowIndex).Values(0))
If e.CommandName = "select" Then
strSQL = "Insert into TB_Doc (NO,DOCID) value ('" & lblNoSUbReq.Text & "','" & id.ToString & "' )"
clsDB.QueryExecuteNonQuery(strSQL)
End If
End Sub
HTM Markup
<asp:GridView ID="GridViewFile" runat="server" AutoGenerateColumns="False"
DataKeyNames="DOC_ID" DataSourceID="SqlDataDocs" BackColor="White"
CellPadding="3" Width="100%" >
<Columns>
<asp:BoundField DataField="DOC_ID" HeaderText="DOC_ID"
ReadOnly="True" SortExpression="DOC_ID">
</asp:BoundField>
<asp:BoundField DataField="FILENAME" HeaderText="File Name" SortExpression="FILENAME" />
<asp:BoundField DataField="FILE_LOCATION" HeaderText="File Location"
SortExpression="FILE_LOCATION" HeaderStyle-CssClass="hiddencol"
ItemStyle-CssClass="hiddencol" >
<HeaderStyle CssClass="hiddencol"></HeaderStyle>
<ItemStyle CssClass="hiddencol"></ItemStyle>
</asp:BoundField>
<asp:ButtonField CommandName="Select" Text="Select" ButtonType="Button" />
</Columns>
</asp:GridView>