CalendarExtender [英] CalendarExtender

查看:104
本文介绍了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

推荐答案

好吧,因为注释不起作用...


您需要向我们提供您用来保存它的代码.

我的猜测是,您正在尝试将字符串转换为SQL Date类型,但不包括#.如果数据库中的列类型是日期类型,则需要用#括住日期值,例如#1-2-2010#",否则SQL将无法正确读取它.

但是同样,没有代码,我只是在猜测.
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.


当我单击保存按钮时,值从日历扩展的文本框中消失.

因此,当执行达到CommandStatement时,我发现"值在文本框中不存在.
我只有几行代码.

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 = "";
                TextBox1.Focus();                
            }


尝试一下可能会对您有所帮助..
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);


这篇关于CalendarExtender的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆