本文介绍了CalendarExtender的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经将TextBox与ajax calendarextender一起使用了.
我有一个保存按钮,其行为是submit.
当我单击它时,数据将保存到数据库中.
但是,日期存储为Null,每当我单击按钮日期"时,就会消失,并且
当我插入数据库时为null或长度为零.
有人可以帮忙吗?我想我需要更改CalendarExtender的行为.
我是Asp.net的新手,请帮忙.
在此先感谢
Hi,
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 Asp.net Please Help.
Thanks in Advance
推荐答案
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 = "";
TextBox1.Focus();
}
<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);
这篇关于CalendarExtender的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!