i want to send date from my web page in dd/mm/yyyy format for that i write this:
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
TextBox2.Text = Calendar1.SelectedDate.ToString("dd/MM/yyyy");
}
My question is When i select a date as 23/1/1984 from my asp.net calendar control(don't want to use ajax control) and in my BL(business logic) i create a property as
public DateTime DOB
{
get { return _DOB; }
set { _DOB = value; }
}
i created a method Insert() and write:
parameters[1] = new SqlParameter("@DOB", SqlDbType.DateTime) { Value = DOB };
in code behind file i make a object of BL as (
BL obj = new BL();
)
i on button click assign value to DOB as that i hv enterd in textbox as
Quote:
obj.DOB = DateTime.Parse(TextBox2.Text);
but on execution when say i enter 23/12/1988 and click submit button following error appears ::
Quote:
String was not recognized as a valid DateTime.
What is wrong in this why it is occuring?