I am trying to pass a value through Eval in my GridView, but instead of passing the actual value, it passes the string '<%# Eval etc...This is my code, can anybody advise?
enter code here<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnUpload" OnClientClick="loadDialog('<%# Eval(PK_SpecialEvent).ToString() %>') " Text="Upload/Open Files" runat="server" />
</ItemTemplate>
</asp:TemplateField>
Try this:
OnClientClick='<%# Eval("PK_SpecialEvent", "loadDialog(\"{0}\");") %>'
Another, more readable, way is to do this in codebehind. A good place would be in GridView's RowDataBound Event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With