Results 1 to 4 of 4

Thread: How to call Readonly textbox in Javascript Function

  1. #1
    Join Date
    Dec 2008
    Posts
    112

    How to call Readonly textbox in Javascript Function

    How to call Readonly textbox in Javascript Function, I have a handful of textboxes that the user fills out, and other textboxes in between them have values automatically calculated. I am also trying to figure out how to write a call for javascript function for this specific problem, or is there any other way to check the read-only attribute of a text box ??

  2. #2
    Join Date
    Oct 2008
    Posts
    117

    Re: How to call Readonly textbox in Javascript Function

    If you know, before sending the response to the client, that you're going to set the readonly attribute then you can do this with server side code. you can call the javascript within the page_prerender()...... event of your Masterpage. I had overcome with the same problem adding the Calendar to a content page.
    If it needs to change according to the user's input, without sending another post to the server, then this will need to be done on the client.

  3. #3
    Join Date
    Oct 2008
    Posts
    89

    Re: How to call Readonly textbox in Javascript Function

    This is by design. As an ASP.NET security feature, setting it to readonly on the server will keep it readonly regardless of what happens on the client.In order to add/set attributes to elements(like onClick), I was putting them in the Page_Load event. If you want them to be able override it and actually submit a value then it's not really readonly on the server, only conditionally on the client.

  4. #4
    Join Date
    Feb 2006
    Posts
    98

    Re: How to call Readonly textbox in Javascript Function

    When you set a field to be ReadOnly on the codebehind, the ASP:TextBox seems to become immutable even by JS. you can call the script on the href click

    Code:
    <a href = '#' onclick='Date_Diff()'>Calender Click</a>
    href already has onclick event to popup the calender in the code behind of the Usercontrol. But there is also a provision to call the function at the runtime of this href. I made a change and the change was reflected in JS and in the form, but the TextBox retained its original text value

Similar Threads

  1. Replies: 2
    Last Post: 20-08-2010, 01:23 AM
  2. using href vs. onclick to call javascript function
    By Kalyug in forum Software Development
    Replies: 6
    Last Post: 12-05-2010, 10:09 AM
  3. c# function equivalent to gettime function in javascript
    By Omaar in forum Software Development
    Replies: 4
    Last Post: 10-03-2010, 10:44 PM
  4. JavaScript function help
    By suseman in forum Software Development
    Replies: 3
    Last Post: 26-05-2009, 05:11 AM
  5. Call Javascript function in VB.Net code
    By kaartik in forum Software Development
    Replies: 4
    Last Post: 22-01-2009, 06:14 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,977,606.86134 seconds with 17 queries