I have following code in gridview:
<% If Eval("LabelType").ToString() = "Singleline" Then%> <asp:TextBox ID="txtSingleLine" runat="server" ></asp:TextBox> <% End If%>
<% If Eval("LabelType").ToString() = "Multiline" Then%> <asp:TextBox ID="txtMultiline" runat="server" TextMode="MultiLine" ></asp:TextBox> <% End If%>
<% If Eval("LabelType").ToString() = "Image" Then%> <asp:FileUpload ID="FileUpload1" runat="server" /> <% End If%>
I am getting following error:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control
From this question i came to know that # should be added, but when i added as:
It was not accepting this (showing blue line below whole statement).
Please tell me where i am making mistake.
Please help me.
I am using vb.net but answer in c# is also helpful.