tags:

views:

418

answers:

2

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" />");
A: 

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).

shahkalpesh
+1  A: 

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 ...

WestDiscGolf