Setting the HiddenField value for ASP.NET

I have googled this but cant figure out how to set the value of my hidden field. I have the following code:

<asp:HiddenField id="fileId" runat="server" value="<%# Response.Write(Request.QueryString["fileID"]) %>" />

      

I am just trying to make value = value fileID

in a query string.

Thank you for your help.

+3


source to share


1 answer


Try:

<asp:HiddenField id="fileId" runat="server" value='<%= Request.QueryString["fileID"] %>' />

      

Trust the "=" operator to mean Response.Write for you.



Just for the sake of completeness, you can install it in codeb too, for example

fileId.Value = Request.QueryString["fileID"]

      

+9


source







All Articles