I have a gridview with databound fields with a checkbox for each row. Only the check box is not bound to any field in the database. I have a button outside of the gridview. By clicking the button, I am trying to get the values of the partyID fields for all the rows that have the check box checked.
Upon clicking the button, nothing gets displayed but no error either.
Any help will be appreciated.
Thanks.
Here is my code so far:
aspx code:
<asp:GridView ID="gvFindDupe" runat="server" BackColor="White" BorderColor="#3366CC"
BorderStyle="Solid" BorderWidth="1px" CellPadding="4" AutoGenerateColumns="False" AllowSorting="True">
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chk_orderID" runat="server" AutoPostBack="false" Checked="false"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="partyID" HeaderText="partyID" SortExpression="partyID" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
----This is the .vb code
Protected Sub btnPartiesMerge_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPartiesMerge.Click
Dim str As StringBuilder = New StringBuilder()
Dim i As Integer
For i = 0 To gvFindDupe.Rows.Count - 1
Dim gvRow As GridViewRow = gvFindDupe.Rows(i)
If CType(gvRow.FindControl("chk_orderID"), CheckBox).Checked Then
str.Append(gvRow.FindControl("partyID"))
End If
Next
Response.Write(str.ToString())