[英]ASP.NET HiddenField Value Setting
I have googled this, but can't figure out how to set the value of my hidden field. 我用Google搜索了这个,但无法弄清楚如何设置隐藏字段的值。 I have the following code:
我有以下代码:
<asp:HiddenField id="fileId" runat="server" value="<%# Response.Write(Request.QueryString["fileID"]) %>" />
I am just trying to make the value = the value of fileID
in the query string. 我只是想在查询字符串
fileID
value = fileID
的值。
Thanks for your help. 谢谢你的帮助。
Try: 尝试:
<asp:HiddenField id="fileId" runat="server" value='<%= Request.QueryString["fileID"] %>' />
Believe the "=" operator implies the Response.Write for you. 相信“=”运算符意味着您的Response.Write。
Just for the sake of completeness, you could set it in the codebehind as well, eg 只是为了完整性,你也可以在代码隐藏中设置它,例如
fileId.Value = Request.QueryString["fileID"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.