Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have used TextBox with ajax calendarextender.
I have One Save Button whose behaviour is submit.
when I click on it, Data is Saved into DB.
But Date is stored as Null, Whenever I click on Button Date Disappears, and
is null or length is zero when I insert into DB.

Can anyone help? I think I need to Change Behaviour for CalendarExtender something something.

I am new to Please Help.

Thanks in Advance
Updated 27-May-10 13:16pm

well, since comments aren't working...

you need to give us the code you're using to save it.

My guess is that you're trying to convert a string to a SQL Date type and not including the #. If the column type in the database is a Date type, you need to surround your date value with # like "#1-2-2010#" or SQL won't read it correctly.

But again, without the code, I'm just guessing.
Share this answer
When i click on save Button, Value Disappears from textbox which is calendarextended.

So when execution Reaches CommandStatement, I Find value is Not Present in Textbox..

I Have Only fewLines of Code.

if (db.Insert("insert into JOBCARD values(0,'"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox3.Text+"',"+Session["UserID"].ToString()+",(select firmid from FIRM_MASTER where NAME='"+DropDownList4.SelectedItem+"'),'--','false','--',0,0,(select srno from db_users where username='"+DropDownList1.SelectedItem+"'),(select srno from db_users where username='"+DropDownList2.SelectedItem+"'),(select srno from PURPOSE_MASTER where certpurpose='"+DropDownList5.SelectedItem+"'),(select id from CATEGORYMASTER where CATEGORYNAME='"+DropDownList3.SelectedItem+"'),'"+TextBox9.Text+"')"))
                Label10.Visible = false;
                db.filldatasource("SELECT jobid,jobno,jobtitle,jobdate FROM JOBCARD where iscomplete='false'", ref gridview1);
                TextBox1.Text = "";
                TextBox2.Text = "";
                TextBox3.Text = "";
                TextBox9.Text = "";
Share this answer
William Winner 27-May-10 16:46pm    
You do realize that by marking the answer as solved, most people won't even look at it, right?

So, something is obviously going on before it gets there. Go through and debug it from the first line in your button click. Something in your code is resetting the textbox. But again, without that code, we can't help you.
YATINSUKALE 2-Jul-12 2:41am    
i want to store calender extender value in sql then how can this i do
try this it may help you..
<asp:TextBox ID ="txtdateofbirth" runat ="server" ></asp:TextBox>
   <asp:CalendarExtender ID ="dateofbirthextender" runat ="server" TargetControlID ="txtdateofbirth" PopupPosition ="Right" ></asp:CalendarExtender>

In code behind just add:
DateTime d = DateTime.Parse(txtdateofbirth.Text);
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900