Friday, September 7, 2018

ADD CALENDAR TO GRIDVIEW

.ASPX CODE 

<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 

 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();

    }

No comments:

Post a Comment

GRIDVIEW ON ROW DATA BOUND EVENT

 Database Create  Student : roll , name , city , cost  Fix 6 Value  in Database Record  ====================================================...