输入字符串格式不正确
protected void Button1_Click(object sender, EventArgs e)
{
Components.Model.P_Price price = new Components.Model.P_Price();
int ss = Convert.ToInt32(hf.Value);//错误:输入字符串格式不正确
price.Tid = 36;
price.Price = int.Parse(TextBox1.Text.Trim());
price.UpTime = DateTime.Now;
price.Tids = ss;
BLL.P_Price bll = new BLL.P_Price();
bll.Add(price);
}
hf.value是<asp:HiddenField ID="hf" runat="server" />控件接收的js文件里函数的返回值
当没有price.Price = int.Parse(TextBox1.Text.Trim());提示int ss = Convert.ToInt32(hf.Value);//错误:输入字符串格式不正确
但是去掉TextBox控件,price.Price等于一个数字时是不报错的。