0
Answer

Ajax Calendar Extension

Ravi Pandit

Ravi Pandit

7y
252
1
I want to store the date into database but it is taking only the default date 01-Jan-1900. Please tell me how i can save the selected date into database and reflect it in the gridview
 
 My Code is:
Design:
<tr>
<td>
<label>Date Of Birth</label>
</td>
<td>
<asp:TextBox ID="txtDateForm" runat="server" Placeholder="dd-MMM-yyyy"></asp:TextBox>
<asp:ImageButton ID="popdate" ImageUrl="~/calender.jpg" runat="server" Height="16px" Width="17px" />
<asp:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="popdate" TargetControlID="txtDateForm" Format="dd-MMM-yyyy"></asp:CalendarExtender>
</td>
</tr>
 
Aspx.cs
 
if (!string.IsNullOrEmpty(txtDateForm.Text.Trim()))
{
date = DateTime.Parse(txtDateForm.Text.Trim());
}
cmd.Parameters.AddWithValue("@RegDate", date);