Click here to Skip to main content
15,609,235 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<asp:TemplateField HeaderText="Gender">
                                                                 <asp:Label ID="lblGender" runat="server" Text='<%# Eval("Gender") %>'></asp:Label>
                                                                 <asp:HiddenField ID="lblGenderid" runat="server" Value='<%# Eval("Gender_Id") %>' />

.ChildGender = CType(Me.grdchild.Rows(intCount).FindControl("lblGenderid"), HiddenField).Value
While accessing the value i am getting error as Input string was not in a correct format.

1 solution

Is this rowdatabound event?

I normally use a label and set it visible to false.
<asp:label id="lblGenderid" runat="server" Text'=<%# Eval("Gender_Id") %>'  visible="false" />


Dim lbl as Label = TryCast(e.row.FindControl("lblGenderid"), label)
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900