文本框通过js脚本获取时间,刷新页面之后文本框里的数据会出现丢失的现象,
解决办法是获取该控件的值,然后将值再赋给该控件。
前台: <td class="fieldNameTd" align="right" style="width: 120px; height: 15px;">
开工日期:
</td>
<td class="fieldValueTd">
<asp:TextBox ID="TextStartTime" runat="server" Style="width: 160px;" MaxLength="50"
οnclick="new Calendar().show(this);" ReadOnly="True"></asp:TextBox>
</td>
<td class="fieldNameTd" align="right">
竣工日期:
</td>
<td class="fieldValueTd">
<asp:TextBox ID="TextCompletedTime" runat="server" Style="width: 160px;" MaxLength="50"
οnclick="new Calendar().show(this);" ReadOnly="True"></asp:TextBox>
</td>
后台: string StartTime = this.Request.Form[this.TextStartTime.UniqueID].ToString().Trim();
string CompletedTime = this.Request.Form[this.TextCompletedTime.UniqueID].ToString().Trim();
this.TextStartTime.Text = StartTime;
this.TextCompletedTime.Text = CompletedTime;