【发布时间】:2015-06-09 18:46:03
【问题描述】:
我正在使用 ASP.net 并使用 Javascript 设置文本框的值。当我去保存页面的内容时,我无法获取文本框的值,它只是返回为空。
我尝试使用 value、innertext 和 innerhtml 设置值,但无法从其中任何一个中获取值。 使用JS设置:
document.getElementById('<%= txtNettWeight.ClientID %>').innerText = NettWeight;
保存时:
if (!string.IsNullOrEmpty(txtNettWeight.Text))
{ sqlComm.Parameters.AddWithValue("@NetWeight", Convert.ToDecimal(txtNettWeight.Text));
}
【问题讨论】:
-
TextBox 使用的标记是什么?
标签: javascript c# asp.net dom code-behind