C# 将int值指定给隐藏字段
我需要给隐藏的文件赋值,但失败了 这是我的密码 ASP.NETC# 将int值指定给隐藏字段,c#,asp.net,C#,Asp.net,我需要给隐藏的文件赋值,但失败了 这是我的密码 ASP.NET <asp:HiddenField ID="hdnCId" runat="server" /> 隐藏字段只接受字符串 if (Request.QueryString["Id"] != "" && Request.QueryString["Id"] != null) { hdnCId.Value = Request.QueryString["Id"].ToString
<asp:HiddenField ID="hdnCId" runat="server" />
隐藏字段只接受字符串
if (Request.QueryString["Id"] != "" && Request.QueryString["Id"] != null)
{
hdnCId.Value = Request.QueryString["Id"].ToString();
}
这就行了
使用时将值转换为int
//when there is some value in it
Int32 Id = Convert.ToInt32(hdnCId.Value);
隐藏字段只接受字符串
if (Request.QueryString["Id"] != "" && Request.QueryString["Id"] != null)
{
hdnCId.Value = Request.QueryString["Id"].ToString();
}
这就行了
使用时将值转换为int
//when there is some value in it
Int32 Id = Convert.ToInt32(hdnCId.Value);
隐藏字段将值存储为字符串。 将代码更改为
hdnCId.Value =Id.ToString();
隐藏字段将值存储为字符串。 将代码更改为
hdnCId.Value =Id.ToString();