I have the following grid veiw. InstanceId is a primarykey in my DB. I am also doing asp:BoundField on this file but visibility is false. When a user checks the checkbox of the gridview I want to capture all the rest of the data columbs to be inserted into another talbe.
My question is how do I get the values of the selecte rows?
The latest thing I have been using is DataKeyNames.
Any help would be great. Thanks.
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" EmptyDataText="No customers found." DataKeyNames="InstanceId">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="InstanceId" HeaderText="InstanceId" SortExpression="InstanceId"
Visible="False" />
<asp:BoundField DataField="CustomerName" HeaderText="Customer Name" SortExpression="CustomerName" />
<asp:BoundField DataField="InvoiceNumber" HeaderText="Invoice Number" SortExpression="InvoiceNumber" />
<asp:BoundField DataField="OutstandingAmount" HeaderText="Outstanding Amount" SortExpression="OutstandingAmount" HtmlEncode="false" DataFormatString="{0:c}" />
<asp:BoundField DataField="OriginalAmount" HeaderText="Orig Amount" SortExpression="OriginalAmount" HtmlEncode="false" DataFormatString="{0:c}" />
<asp:BoundField DataField="AmountPaid" HeaderText="Amount Paid" SortExpression="AmountPaid" HtmlEncode="false" DataFormatString="{0:c}" />
</Columns>
</asp:GridView>
Ordinary Programmer
My question is how do I get the values of the selecte rows?
The latest thing I have been using is DataKeyNames.
Any help would be great. Thanks.
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" EmptyDataText="No customers found." DataKeyNames="InstanceId">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="InstanceId" HeaderText="InstanceId" SortExpression="InstanceId"
Visible="False" />
<asp:BoundField DataField="CustomerName" HeaderText="Customer Name" SortExpression="CustomerName" />
<asp:BoundField DataField="InvoiceNumber" HeaderText="Invoice Number" SortExpression="InvoiceNumber" />
<asp:BoundField DataField="OutstandingAmount" HeaderText="Outstanding Amount" SortExpression="OutstandingAmount" HtmlEncode="false" DataFormatString="{0:c}" />
<asp:BoundField DataField="OriginalAmount" HeaderText="Orig Amount" SortExpression="OriginalAmount" HtmlEncode="false" DataFormatString="{0:c}" />
<asp:BoundField DataField="AmountPaid" HeaderText="Amount Paid" SortExpression="AmountPaid" HtmlEncode="false" DataFormatString="{0:c}" />
</Columns>
</asp:GridView>
Ordinary Programmer