C# 在ASP.Net Gridview中将值从一个文本框传递到另一个文本框

C# 在ASP.Net Gridview中将值从一个文本框传递到另一个文本框,c#,C#,我在GridView中有两个字段 1.通知日期 2.生效日期 当用户在通知日期中输入/更改日期时,我希望在通知日期值中添加10个附加天,并在用户每次更改通知日期时自动填充生效日期。请告知: <asp:DetailsView ID="DetailsView1" runat="server" DataKeyNames="ID" DataSourceID="ObjectDataSource1" OnDataBound="DetailsView_OnDataBound"> <Fiel

我在GridView中有两个字段 1.通知日期 2.生效日期

当用户在通知日期中输入/更改日期时,我希望在通知日期值中添加10个附加天,并在用户每次更改通知日期时自动填充生效日期。请告知:

<asp:DetailsView ID="DetailsView1" runat="server" 
DataKeyNames="ID"
DataSourceID="ObjectDataSource1"
OnDataBound="DetailsView_OnDataBound">
<Fields>  

<asp:TemplateField HeaderText="Notification Date">
<HeaderTemplate><span style="color:Red;">*</span> Notification Date  </HeaderTemplate>
<InsertItemTemplate>
<asp:TextBox ID="txtNotificationDate" runat="server" Width="150" Text=""    />
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtNotificationDate" PopupPosition="Right"/>
</InsertItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtNotificationDate" runat="server" Width="150" Text='<%# Eval("NotificationDate", "{0:d}") %>' />
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtNotificationDate" PopupPosition="Right"/>
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Effective Date">       
<InsertItemTemplate>
<asp:TextBox ID="txtEffectiveDate" runat="server" Width="150" Text=""    />
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtEffectiveDate" PopupPosition="Right"/>
</InsertItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEffectiveDate" runat="server" Width="150" Text='<%# Eval("EffectiveDate", "{0:d}") %>' />
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtEffectiveDate" PopupPosition="Right"/>
</EditItemTemplate>
</asp:TemplateField>

</Fields>
</asp:DetailsView>

*通知日期

您是否与使用AjaxControlToolkit结婚了?你考虑过jqueryui吗?如果将字段设置为,则可以侦听第一个框的事件,并相应地更新第二个框

更新
CalendarExtender的工作方式可能与datepicker相同。如果您希望立即显示更新,则需要使用javascript。您仍然需要收听更改事件。

根据我上面发布的代码,我们是否有其他方法,否则我必须更改项目中的所有位置。请告知。我尝试使用CalendarExtender使用OnClient日期选择更改,但我不确定如何读取文本框值并更新第二个文本框。如果可以,请提供建议或示例。谢谢你有权访问jquery吗?