I am using VB
User can select the date by the following code. and date is display in textbox.
<asp:TextBox ID="dateTB" runat="server" />
<asp:ImageButton ID="ib" ImageUrl="/calendar.png" ImageAlign="Bottom" runat="server" />
<asp:CalendarExtender ID="Cal1" PopupButtonID="ib" runat="server" TargetControlID="dateTB" Format="MM/dd/yyyy">
</asp:CalendarExtender>
after that I am storeing that data in SQL Server database.
Problem: when user doesn't enter a date than SQL Server is storing 1/1/1900 as defualt.
What can I do so if user leaves a empty date field than SQL Server doesn't store 1/1/1900?
What I have try: what if I check to see is dateTB is empty. if its empty than do something and than insert in database.
If (String.IsNullOrEmpty(dateTB.Text)) Then
' do something with dateTB??
End If
Insert dateTB in database