Javascript with Webcontrols

Discussion in 'ASP .Net' started by Peter Afonin, Apr 21, 2006.

  1. Peter Afonin

    Peter Afonin Guest

    Hello,

    I'd used before methods like RegisterStartupScript with ASP.NET, but this
    problem I was unable to solve yet using this method.

    I have a web form with a few web controls - textbox, dropdown lists,
    calendar control. If the textbox has a value- I need to disable all other
    controls when it looses focus (onblur event), if it's empty - enable them.
    The texbox I can replace with a HTML control instead of web control, but the
    other controls I cannot.

    Is it possible to do this?

    I would appreciate your help on this.

    Thank you,

    --
    Peter Afonin
    Peter Afonin, Apr 21, 2006
    #1
    1. Advertising

  2. Peter Afonin

    Darrin Guest

    I assume when you say web controls, you are talking about the ASP.NET
    server controls instead of plain html controls. You should be able to
    do the same actions on a server control on the client as you would with
    an html control alone. The key (for me at least when I first messed
    with it) is to use the ClientID property of the control server side to
    get what the control id will be when accessing it from javascript on
    the client. I would then send my script the way you had mentioned.

    -Darrin
    Darrin, Apr 21, 2006
    #2
    1. Advertising

  3. Peter Afonin

    Guest

    Did you tried specifying ID and runat attributes to respected HTML tags
    and access them by thier ID names from the webform?

    Aru

    Peter Afonin wrote:
    > Hello,
    >
    > I'd used before methods like RegisterStartupScript with ASP.NET, but this
    > problem I was unable to solve yet using this method.
    >
    > I have a web form with a few web controls - textbox, dropdown lists,
    > calendar control. If the textbox has a value- I need to disable all other
    > controls when it looses focus (onblur event), if it's empty - enable them.
    > The texbox I can replace with a HTML control instead of web control, but the
    > other controls I cannot.
    >
    > Is it possible to do this?
    >
    > I would appreciate your help on this.
    >
    > Thank you,
    >
    > --
    > Peter Afonin
    , Apr 21, 2006
    #3
  4. Peter Afonin

    Peter Afonin Guest

    Hello,

    Thank you for all your suggestions.

    Yes, all my web controls have IDs. But the problem is that Javascript
    doesn't "see" server controls! Maybe I'm doing something wrong, but I could
    never make it work. Every time I was using Javascript with the web forms I
    had to either use HTML controls with runat="server" tag or to register a
    Javascript with RegisterStartupScript method.

    Thank you,

    Peter

    <> wrote in message
    news:...
    > Did you tried specifying ID and runat attributes to respected HTML tags
    > and access them by thier ID names from the webform?
    >
    > Aru
    >
    > Peter Afonin wrote:
    > > Hello,
    > >
    > > I'd used before methods like RegisterStartupScript with ASP.NET, but

    this
    > > problem I was unable to solve yet using this method.
    > >
    > > I have a web form with a few web controls - textbox, dropdown lists,
    > > calendar control. If the textbox has a value- I need to disable all

    other
    > > controls when it looses focus (onblur event), if it's empty - enable

    them.
    > > The texbox I can replace with a HTML control instead of web control, but

    the
    > > other controls I cannot.
    > >
    > > Is it possible to do this?
    > >
    > > I would appreciate your help on this.
    > >
    > > Thank you,
    > >
    > > --
    > > Peter Afonin

    >
    Peter Afonin, Apr 21, 2006
    #4
    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. Leif

    WebControls Button

    Leif, Jun 25, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    828
  2. Harry

    Javascript Disabling WebControls

    Harry, Aug 6, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    625
    John Saunders
    Aug 6, 2003
  3. Kylin

    the webcontrols with javascript .

    Kylin, Apr 25, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    109
    Kylin
    Apr 25, 2005
  4. Bear Lin

    have javascript utitlity to get whole webcontrols

    Bear Lin, May 24, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    96
    Bear Lin
    May 24, 2005
  5. Peter Afonin

    Javascript with Webcontrols

    Peter Afonin, Apr 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    112
    Peter Afonin
    Apr 21, 2006
Loading...

Share This Page