我是动态的基础上产生向下选择的放置形式。 该表单包含字段(十进制值+少量文本字段的数据输入)的。要在末尾添加所有的十进制值,并更新总文本框与价值。总文本框被禁用。
I am dynamically generating the form based on the drop down selected. The form consists of fields (data entry for decimal values + few text fields). Have to add all the decimal values at the end and update the Total TextBox with that value. Total Textbox is disabled.
当我点击窗体上的保存按钮后,用户输入他们的价值观,整个形式坚持在ViewState中除了禁用文本框。当启用文本框,一切工作正常。你要知道,我是动态生成的形式和使用JavaScript来计算(将所有十进制字段)更新总文本框的值。
When I click Save button on the form after the user have entered their values, whole form is persisted in viewstate except the disabled textbox. When I enable the textbox, everything works fine. Mind you, I am dynamically generating the form and updating the value of the total textbox using javascript to calculate (adding all decimal fields).
P.S。我做的一切权利为持续的视图状态。
P.S. I am doing everything right for persisting the viewstate.
那么是什么使能/禁止得到了轴承的视图状态
So what has the enabled/disabled got bearing on the viewstate
基本上,我添加了两个语句来得到它的工作。
Basically, I added two statements to get it working.
txtBox.Attributes.Add("readonly", "readonly");
txtBox.Style.Add("color","gray");
当我用txtBox.Enabled =假的,它没有坚持视图状态但没有它交替使用上述在我的code-隐藏页面的两个语句
When I used txtBox.Enabled = false, it didn't persist viewstate but did it alternatively using above two statements in my code-behind page