GridView on the select of row
Posted
by user329419
on Stack Overflow
See other posts from Stack Overflow
or by user329419
Published on 2010-04-30T18:45:08Z
Indexed on
2010/04/30
18:47 UTC
Read the original article
Hit count: 304
I need to hide columns in GridView then access the values of these columns in GridViewSelectedIndex using vb.net When I set visible=false for Bound colums i cannot access the values
<asp:TemplateField Visible=False>
<ItemTemplate>
<asp:HiddenField ID=hdnSeqID Value='<%#Eval("Seq_ID") %>' runat=server/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FormCode" Visible=false>
<ItemTemplate>
<asp:HiddenField ID=hdnFormCode Value='<%#Eval("Form_Code") %>' runat=server/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged Dim Instance_ID As String Dim Seq_ID As String Dim Form_Code As String Dim PARMS As String Dim DestinationURL As String Dim DestinationParms As String
'fill text box's with values from selected row
' store values from selected row
'Dim instanceID As String = CType(GridView1.SelectedRow.FindControl("hdnInstanceID"), HiddenField).Value
Dim seqID As String = CType(GridView1.SelectedRow.FindControl("hdnSeqID"), HiddenField).Value
Dim formCode As String = CType(GridView1.SelectedRow.FindControl("hdnFormCode"), HiddenField).Value
© Stack Overflow or respective owner