.ASPX CODE
<asp:TemplateField HeaderText="Years">
protected void Cal1_SelectionChanged(object sender, EventArgs e)
{
Calendar cal = (Calendar)sender;
TextBox text1 = (TextBox)((GridViewRow)cal.Parent.Parent).FindControl("text1");
text1.Text = cal.SelectedDate.ToShortDateString();
}
<asp:TemplateField HeaderText="Years">
<ItemTemplate>
<asp:TextBox ID="text1" runat="server"></asp:TextBox>
<asp:Calendar ID="Cal1" runat="Server" OnSelectionChanged="Cal1_SelectionChanged">
</asp:Calendar>
</ItemTemplate>
</asp:TemplateField>
.CS CODE
{
Calendar cal = (Calendar)sender;
TextBox text1 = (TextBox)((GridViewRow)cal.Parent.Parent).FindControl("text1");
text1.Text = cal.SelectedDate.ToShortDateString();
}
No comments:
Post a Comment