Client script access to server side controls

Discussion in 'ASP .Net' started by Don Parker, Jan 3, 2005.

  1. Don Parker

    Don Parker Guest

    Does the use of server side controls eg <asp:textbox> preclude the
    access to that control by client script? If not, how do you reference
    those elements?



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Don Parker, Jan 3, 2005
    #1
    1. Advertising

  2. In normal way, by id.

    Eliyahu

    "Don Parker" <> wrote in message
    news:...
    >
    >
    > Does the use of server side controls eg <asp:textbox> preclude the
    > access to that control by client script? If not, how do you reference
    > those elements?
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Eliyahu Goldin, Jan 3, 2005
    #2
    1. Advertising

  3. Don Parker

    Jason Guest

    Don,
    You can access serverside controls via client script using the usual
    methods, in most cases. For example, if your server side control name
    is "txtProductName", then you can access the control in Javascript
    using document.getElementById("txtProductName"). When using the
    SmartNavigation feature, certain types of client script may not work
    properly.
    Jason
     
    Jason, Jan 3, 2005
    #3
  4. Don Parker

    Saravana Guest

    If you place your textbox control inside any databound control like
    repeater, datalist or datagrid. Then name and id of the textbox control will
    be changed with respect to container element. Hence to access the textbox
    control in client side, you need to use its clientid property(serverside
    property) to get the id of the control to access it in client side.

    --
    -Saravana
    http://dotnetjunkies.com/WebLog/saravana/
    www.ExtremeExperts.com



    "Don Parker" <> wrote in message
    news:...
    >
    >
    > Does the use of server side controls eg <asp:textbox> preclude the
    > access to that control by client script? If not, how do you reference
    > those elements?
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Saravana, Jan 3, 2005
    #4
  5. Don Parker

    Don Parker Guest

    Ah hah. I was trying to set the text property of the control. Since
    that would not work and you guys are all telling me I should be able to
    access this object - I tried using the normal value property that you
    would use with ah HTML control and that works! Thanks!


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Don Parker, Jan 3, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    14
    Views:
    4,108
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  2. Magnus Blomberg
    Replies:
    3
    Views:
    720
    Magnus Blomberg
    Apr 14, 2005
  3. Boss302
    Replies:
    0
    Views:
    1,055
    Boss302
    Nov 21, 2006
  4. Zoe Hart
    Replies:
    1
    Views:
    373
    Scott Wisniewski
    Jan 8, 2004
  5. Cathryn Lindner

    client side script with server side controls

    Cathryn Lindner, Oct 24, 2003, in forum: Javascript
    Replies:
    1
    Views:
    139
    Thomas 'PointedEars' Lahn
    Nov 23, 2003
Loading...

Share This Page