I have a textbox.In its onclick iam calling a jquery to call calendar.Texbox is readonly. Clicking on calendar is coming and value is showing in textbox. But clicking on submit button where I have written code to save, while iam saving the data
does't save read only text box value. What may be the reason for that? i want that text box is readonly. how can i reslove this ?
Is the textbox is server control. The textbox persists there value during postback. IF possible can you place the code here.
The other alternative to save the data is using hidden field. When the date is selected and placed it textbox and the hidden filed and when the data is save use this hidden field to retrive the date.
SudhaRubini
Member
391 Points
383 Posts
Read only value does't save
May 05, 2012 05:14 AM|LINK
Hi ,
I have a textbox.In its onclick iam calling a jquery to call calendar.Texbox is readonly. Clicking on calendar is coming and value is showing in textbox. But clicking on submit button where I have written code to save, while iam saving the data does't save read only text box value. What may be the reason for that? i want that text box is readonly. how can i reslove this ?
please help me
urenjoy
Star
12347 Points
1857 Posts
Re: Read only value does't save
May 05, 2012 05:17 AM|LINK
Try Request.Form to get value:
protected void btnSubmit_Click(object sender, EventArgs e) { string dt = Request.Form[txtDate.UniqueID]; }See following sample:
http://www.aspsnippets.com/Articles/Implement-jQuery-DatePicker-Plugin-with-ASPNet-TextBox-Control.aspx
karthicks
All-Star
31378 Points
5422 Posts
Re: Read only value does't save
May 05, 2012 05:20 AM|LINK
hi, you can read like below
string value = Request.Form[TextBox1.UniqueID];
or else you can set Readonly at run time like below
TextBox1.Attributes.Add("readonly", "readonly");
Refer : http://forums.asp.net/t/1485723.aspx/1?readonly+TextBox+value+not+able+to+retrieve+in+codebehine
http://forums.asp.net/t/1477749.aspx/1?textbox+problem
Karthick S
me_ritz
Star
9337 Points
1447 Posts
Re: Read only value does't save
May 05, 2012 05:22 AM|LINK
Remove Readonly from textbox attribute and add onfocus="blur();" to it....and you do not need to change any code.
Thanks
Deepak_Talel...
Member
458 Points
87 Posts
Re: Read only value does't save
May 05, 2012 05:24 AM|LINK
Is the textbox is server control. The textbox persists there value during postback. IF possible can you place the code here.
The other alternative to save the data is using hidden field. When the date is selected and placed it textbox and the hidden filed and when the data is save use this hidden field to retrive the date.
Let me know if this resolve your issue.
Ph: 91-9158413830
Email: deepak_talele@hotmail.com, deepak_talele@yahoo.com
Rohit Binjol...
Member
84 Points
32 Posts
Re: Read only value does't save
May 05, 2012 05:41 AM|LINK
hi may be yuo have used !IsPostBack OR !IsCallBack inside yopur code
and the value is lost between the postbacks of the page can you please show the code so that we can help better.......