Javascript from an UserControl

Discussion in 'ASP .Net' started by Paperback Writer, Jun 17, 2005.

  1. Hi All,
    I need to validate fields from my user control in the onload...the problem
    is that my fields come with the name of the usercontrol followed by
    textfield's name, for example: UserControl1:TextName

    I need to validate for example:

    onload="MyFormatFunction(document.frm1.UserControl1:TextName.value)";

    That returns an error...How do i accomplish that ?

    --
    Please, check my theSpoke:
    http://www.thespoke.net/MyBlog/dgroh/MyBlog.aspx
     
    Paperback Writer, Jun 17, 2005
    #1
    1. Advertising

  2. Paperback Writer

    Karl Seguin Guest

    Unless you can use the asp.net validation control, it's certainly a little
    tricky and messy.

    I've always done it ala:

    document.frm1.<%=TextName.ClientId%>.value;

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is
    annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)
    "Paperback Writer" <> wrote in message
    news:...
    > Hi All,
    > I need to validate fields from my user control in the onload...the problem
    > is that my fields come with the name of the usercontrol followed by
    > textfield's name, for example: UserControl1:TextName
    >
    > I need to validate for example:
    >
    > onload="MyFormatFunction(document.frm1.UserControl1:TextName.value)";
    >
    > That returns an error...How do i accomplish that ?
    >
    > --
    > Please, check my theSpoke:
    > http://www.thespoke.net/MyBlog/dgroh/MyBlog.aspx
    >
     
    Karl Seguin, Jun 17, 2005
    #2
    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. huobazi
    Replies:
    1
    Views:
    711
    David Waz...
    Jul 3, 2003
  2. Rajesh Tiwari

    Can we use a usercontrol inside a usercontrol

    Rajesh Tiwari, Aug 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    431
    Rajesh Tiwari
    Aug 12, 2003
  3. nail
    Replies:
    0
    Views:
    1,558
  4. Phl
    Replies:
    2
    Views:
    541
    =?Utf-8?B?VGFtcGEgLk5FVCBLb2Rlcg==?=
    Nov 18, 2004
  5. Fabiano
    Replies:
    2
    Views:
    617
    =?Utf-8?B?c3Jpbmk=?=
    Jun 3, 2005
Loading...

Share This Page