The code you put in looks pretty good ...
Two step process: add a hidden field to markup
<asp:HiddenField ID="hdnId" runat="server" Value='<%# GetValue() %>'/>
Then create the specified method signature ...
protected string GetValue()
{
return "something";
}
Hope it helps ...
source
to share