I have a hidden field that i want to bind to either a function on the page's code behind. I don't quite recall the exact syntax and i can't find the answer via Google. Is the code below correct? Thank.
print("<asp:HiddenField ID="dummy" Value='<%#Getdummy() %>' runat="server" />");
From stackoverflow
-
If you have the hidden field with runat=server, you could write code to assign value in the code behind (rather than in the markup).
-
The code you've put looks pretty good ...
The two step process is ... add the hidden field to the markup
<asp:HiddenField ID="hdnId" runat="server" Value='<%# GetValue() %>'/>
Then create the specified method signature ...
protected string GetValue() { return "something"; }
Hope this helps ...
0 comments:
Post a Comment