为什么它不重视textarea的价值???? [英] why its not taking value of textarea ????

查看:81
本文介绍了为什么它不重视textarea的价值????的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi

我只是插入值...代码正在运行,直到结束...没有任何错误...我已经检查了不同的地方.只是它失败了,当我从"req"中的textarea中获取价值时...并且它也没有插入db中.表名是"RequestPay"....

hi

i m just inserting values...code is running without any error till end ...i have checked at different points. just its fail when i take value from textarea in ''req''.....and its not inserting in db as well. Table name is "RequestPay"....

ProjContext objCont = new ProjContext();
int item1 = int.Parse(dd_LeavDayFrom.SelectedItem.Value);
int item2 = int.Parse(dd_LeavMonthFrom.SelectedItem.Value);
int item3 = int.Parse(dd_LeavYearFrom.SelectedItem.Value);

int item4 = int.Parse(dd_Leav_dayTo.SelectedItem.Value);
int item5 = int.Parse(dd_Leav_MonTo.SelectedItem.Value);
int item6 = int.Parse(dd_Leav_YearTo.SelectedItem.Value);

DateTime dt = new DateTime(item3, item2, item1);
DateTime dt1 = new DateTime(item6, item5, item4);

RequestLeave req = new RequestLeave();
req.UName = txt_LeavEmpName.Text;
req.DateFrom = dt;
req.DateTo = dt1;
req.ReqReason = TextArea1.Text;

objCont.RequestLeaves.InsertOnSubmit(req);
objCont.SubmitChanges();
lbl_LeavSnt.Visible = true;



请任何人都可以帮助......:((:(::confused :: confused:

[edit]"[code]"转换为代码块,取消选择"ignore HTML ..."选项-OriginalGriff [/edit]



please anybody could help.... :(( :( :confused::confused:

[edit]"[code]" converted to code block, "ignore HTML..." option deselected - OriginalGriff[/edit]

推荐答案

您是否正在填充表单不用在里面做:

Are you populating the form without doing it inside:

if (!IsPostBack)
{
   // Populate forms fields.
}



如果没有上述构造(在表单的OnLoad事件中或填充表单的任何地方),则在单击按钮并回发以收集表单字段值时,将获得文本框的默认状态;大概在那个时候是空的.

只是一个猜测.



Without the above construct (in the OnLoad event of the form or wherever it is you populate the form from) you will get the default state of the textbox when you click the button and postback to collect the form field values; presumably it is empty at that point.

Just a guess.


您的建议是什么???

em在按钮单击事件下工作...在这里我应该写
what you suggest???

em working under button click event ...here should i write
if(!IsPostBack)
{
}




你建议吗?




is it you suggest??


这篇关于为什么它不重视textarea的价值????的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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