How to get textbox value when textbox properties is readonly or enabled false

Hi ,

I have one problem, If u have idea please solve  it

To dispaly canlendercontrol iam using ajax canlender control, after selecting dateof birth into textbox

In textbox keeping textbox properites as readonly or enabled equal false,  getting that textbox value into lable,





5/14/2008 6:58:23 AM 9760 articles. 0 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 38

Just get the Textbox.Text value?

Don't forget to click "Mark as Answer" on the post that helped you.
5/14/2008 7:43:30 AM
If I understand you correctly, you have a textbox that is disabled/readonly. You use some code to change the value in the textbox, and you want that value to be returned to your code-behind.

As far as I remember, ignores changes to a disabled controls. This is a good thing - prevents people from hacking. The way to get around this is to put a hidden field on your page, and update that value along with the textbox. Then, in your code-behind, you can retrive the value from the hidden field.

Here is a page describing the hidden field - All you need to do it put a runat="server" attribute onto it and you should be able to access this from the code-behind.
Intelligence is a burden.
Jagdip Singh Ajimal
Manchester (and yes, I am a Manchester United fan)
5/14/2008 7:44:05 AM

I found this problem a short time ago.

In PageLoad or PageInit add to yourcode this: MyTextBox.Attributes.Add("readonly", "readonly");

It's a work around that add manualy "readonly" HTML keyword to the result tag, without any modify to the " part" of the object.

Wamba {WamBlog}
Dont forget to click "Mark as Answer" on the post that helped you.
This credits the member,earns you a point & marks your thread as Resolved.
5/14/2008 7:44:24 AM

To set focus and select text of a you have to use the following:

ScriptManager.RegisterStartupScript(this, this.GetType(), "selectAndFocus", "$get('" + myTextBox.ClientID + "').focus();$get('" + myTextBox.ClientID + "').select();", true);

Chetan Sarode
Software Engineer,
Approva Systems Pvt Ltd,
Pune, India.
5/15/2008 3:14:41 AM

Similar Artilces:

Get values set by javascript to .net enabled textbox
I have a bit of javasript that writes a value to a text box.  The text box is read only. Textbox code:<input type="text" id="txtColor1" runat="server" readonly="readonly" size="6" /> Snippet from javascript functioncolorBox = document.getElementById('<%= txtColor1.ClientID %>');colorBox.value = colorCode;  Code behind:string color1 = txtColor1.Value Whenever I attempt to get the value out of the text box after it has been changed by the javascript, it always reverts back to the old data and not the new. Anyo...

Textbox value returns Empty if Enabled=False or Readonly=True
Hi All, I have Gridview for adding,Editing the Values and then isert into DB. I have Textbox and link in a row, when you click on Link it pops up a new window where you will select value and that value sends back to Textbox which can not editable but if I specify Readonly or Enable property to Textbox , it does not return value.... I dont want user to type anything in textbox than populate selected value..... Any help??? Thanks.Regards,MS Developer Couple of suggestions: 1. Use a Label instead of textbox. Or 2. Where you're setting the value of the textbox, remove the readonl...

Not able to get textbox value from aspx to aspx.cs file if ReadOnly="True" for a textbox
Hi, I got a problem in .Net 3.5. Lets see my requirement... a) I have a web page with two text boxes with an image beside the first text box. When I click on the image some opertation will happen in Javascript and a popup with calender should appear and I can select a date from that. After that I will get the selected date to my aspx file with document.getElementID().value. And I will keep it into a string and then I will add 3 more days to it and will print that value in another textbox. b) When a value is selected or changed in the first textbox then TextChang...

How to get the data in textbox when it's property is enable=false at runtime
Hi,I m doing project in  ASP.NET 2005 using  SQL  SERVER 2005 as the database. And using SQL DATASOURCE CONTROL to get the data from sql.I want to get data of dynamic control textbox at lost focus event which is enabled=false. But, I dont know the procedure to get data at lost focus event and enables property=false. how can I get it? Please answer me as early as possible.....Thanking you in advanceprotected void cmdsubmit_Click(object sender, EventArgs e)&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string str;&nbsp;&nbsp...

Why the value of textbox get preserved after post back even if viewstate property is false?
Hi All,         I have simple aspx page  whch contains one textbox and one button.Enable viewstate property of textbox is false .Both textbox and buttons are server controls.When I view the page in browser and add some string in textbox and after clicking on button it get post back and text box shows me a same value even if enable view state property of that text box is false. What is the reason behind it?  Idealy it should not preserve the value as enable view state is false.SuyogI am just using my free time,but if it helps you ...

Getting the textbox value after postback in runtime created textbox
Getting the textbox value after postback in runtime created textbox I have created around 30 controls in a control array like txtremarks1,txtremarks2,txtremarks3.....txtremarks30. in runtime. When i am posting the server back.I want to get the values but i dont know how to do. Can anybody please help me in this Note:I know how to use request.form("") but i dont want to use it.I also have some labels.I want to get the text in label. Thanks for the help in advance i need it in urgggentVishal Murthy In order to get value of dynamically created controls you must re...

Get value of ajax generated textbox
Hi! I have a problem with ASP.NET AJAX... I have an updatepanel that contains a place holder. The place holder should contains multiple address emails textbox. When the page load for the first time, it shows one textbox and a button to add more textbox. I would like to use ajax to don't have to reload the page every time... So in the button event, I create a new textbox and add it to the place holder. I have two problems... First, why do I have to recreate every time all textbox that has been created before? For exemple, if I have two textbox in the screen and I click to add one mo...

problem with get value from textbox after get it value in load page
hi every one  i have problem with my web site when i get textbox value in load page   and Changed textbox the page do not take last value .   it take value in load page   this is code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)   TextBox1.Text = "aa" End SubProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox(TextBox1.Text) End Sub   when i press button message write "aa" while i changed the textbox   please if enyone knowen help me &nbs...

enable readonly True/false for textbox
I have a gridview which displays many records and when a record is selected a formview is displayed below the grid.  Initially no formview is displayed.  I would like for a textbox to be either readonly true when the user is in the role of "Managers" .  The default for the textbox is readonly = true.  The texbox is in a usercontrol. On which event for the userform do I put code which changes the textbox readonly to False?  The code I am using is: If (Roles.IsUserInRole("Manager")) Then Dim txbgenComment As TextBox = CType(FormView1.FindControl("genCommentTextB...

getting the value of a postback for a readonly textbox
hi guys, i have a textbox, i set as readonly or disabled. But when i do a postback, i cant seem to read the value of the textbox, either when disabled or postback is used. I tried adding this  TextBox_Groups.Enabled = true;        TextBox_Groups.ReadOnly = false; but it still doesnt work, pls help Ehi  The ReadOnly or the disabled TextBox will ingore the Newly submitted value , However , you can get the new value like this :TextBox1.Text=Request.Form(TextBox1.UniqueId)Read my blog post for more information. Regards,Anas Ghanem.Note:Please ...

when i mark textbox as visible false,then comparevalidator doesnot get that textbox to compare
i have two textbox, in one textbox user will enter the date.i want to compare that date with otherdate, means when userenter the date, it should greater then my other textbox's date. now in other(second) textbox i given value from codebehind C#. now when i mark this textbox as visible true, it compares fine. but when i mark textbox as visible false. compare validator doesn't compare the value. how can i get the perfect output. plz help me.VISHAL PAREKH  When you mark the textbox as visible false the textbox is  not rendered. INstead of marking is visible false use st...

How to get the Value from the Textbox ?Textbox is created by using add control function.
  Dim textWG As New HtmlInputText textWG.text="Wage Rate" textWG.ID = "txtWG" me.control.add(textWG) i write this code at form load.moreover this form have one save button to save the value from the "txtWG" to database this textbox will be appear when form finish load.but after click save button the value cant be save into database. tat textbox become empty when user click the save button. how can i get the value from that textbox ? Please advice me.Thank you You are using a HTML control and by default, HTML controls dont have a mechanism to pres...

allow scrolling on a .net textbox where enabled=False
I need to modify a .net textbox to allow it to be scrollable.1 <div style="overflow: auto; width: 100px;"> 2 <asp:TextBox ID="txtTestParent" runat="server" Width="100px" Height="30px" Enabled="False"> 3 </asp:TextBox> 4 </div> but the problem that i have is because the textbox is enabled i cannot scroll and see the text thats to the right .I cannot change the screensize, textbox size and I must keep the control so its enabl...

how to get access of textbox inside ajax enabled method
hi friends, I need to get access of a server control inside an ajax enabled method but m getting object reference not set to an instance of an object errorfor e.g wht i need to do is,[Ajax.AjaxMethod()]public void  function1(){textbox1 .text = "set some text inside ajax";} but on textbox1 line i get error of object reference . any alternative to do this ?Thanks in advance,Max I have tried and feel it is very good to do web application development.I download the latest and write some code to test it.It woks well.The following is my code.using ...

Web resources about - How to get textbox value when textbox properties is readonly or enabled false -

General Growth Properties - Wikipedia, the free encyclopedia
Chicago , Illinois , U.S. General Growth Properties, Inc. is an American real estate investment trust , headquartered at 110 North Wacker Drive ...

RentalRoost Brings Facebook Into Process Of Matching Up Home Seekers, Available Properties
... places to live , as RentalRoost , a San Francisco Bay-area-based website that incorporates Facebook data into its rankings of available properties, ...

Extended Profile Properties - Facebook-Entwickler
These Permissions cannot be revoked in the Login Dialog during the login flow, meaning they are non-optional for Users when logging into your ...

PortPerry Properties (@brian14mckinlay) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Hawaii Real Estate Properties for iPad on the App Store on iTunes
Get Hawaii Real Estate Properties for iPad on the App Store. See screenshots and ratings, and read customer reviews.

Qld climate change pilot study shows 4400 properties could flood in Townsville
The Queensland Government is silently preparing Queensland for an 80cm sea rise, which would impact tens of thousands of homes by the end of ...

Smart Buys: Sydney properties for less than $1 million
Domain's choice of smart Sydney properties this week.

Australian Federal Police raid properties in new CFMEU-linked investigation
Federal Police have raided properties as part of an investigation into a CFMEU organiser suspected by authorities of being bribed.

Sydney gateway: Rail line to be moved, properties affected under plan to link WestConnex to airport
A key rail line linking Sydney's west with Port Botany will need to be shifted under tentative plans to build separate motorways to Sydney Airport. ...

Queensland storms: Roofs ripped off houses in Warwick, 19,000 properties left without power
... roofs in Warwick, as wild storms move across south-east Queensland. More than a dozen homes have lost their roofs and close to 19,000 properties ...

Resources last updated: 1/2/2016 2:22:44 PM