usercontrol and clientside validation

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default usercontrol and clientside validation

    Hi there,
    I have a usercontrol and i have written sone clientside
    validation script associated along with it. Now when i
    register this usercontrol in the mainwebform, how can i
    access the clientside validation to validate the
    usercontrol?

    Thanks in advance

    -K
    Ken Guest

  2. Similar Questions and Discussions

    1. Event not firing in usercontrol inside usercontrol
      I'm stumped on this problem. I've created a user control that dynamically creates 5 linkbuttons in the CreateChildControls method. Each of these...
    2. Datagrid and clientside callback events
      Hi All, I've been looking at clientside callbacks as a way to update parts of a page without a postback. Is there a way of rebinding a...
    3. DatGrid TemplateColumn TextBox JavaScript ClientSide Validation?
      Hi, I am using 2 TemplateColumn TextBoxs in my Grid. On the Submit button click event I want to do the validation on the client side. In the...
    4. clientside events
      I want to validate client entries into textbox,checkbox controls etc. can u do this with asp. Like, is there onchange and onclick and so on for...
    5. Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack
      a uscontrol test.ascx have a dropdownlist web control the dropdownlist's AutoPostBack property is set "true" but when i use...
  3. #2

    Default Re: usercontrol and clientside validation

    Can you clarify what you mean by "validate the user control"? Are you
    creating a control subclassed from System.Web.UI.WebControls.BaseValidator?

    --- Peter Blum
    [url]www.PeterBlum.com[/url]
    Email: [email]PLBlum@PeterBlum.com[/email]
    "Ken" <anonymous@discussions.microsoft.com> wrote in message
    news:01c101c3d6de$8fe773e0$a301280a@phx.gbl...
    > Hi there,
    > I have a usercontrol and i have written sone clientside
    > validation script associated along with it. Now when i
    > register this usercontrol in the mainwebform, how can i
    > access the clientside validation to validate the
    > usercontrol?
    >
    > Thanks in advance
    >
    > -K

    Peter Blum Guest

  4. #3

    Default Re: usercontrol and clientside validation

    if i know I will never add any more controls to the page I will let the page
    render. then I will look at the source. your elements will have id's like
    "_ctl45_txbZipCode" or "_ctl45_txbName". I would then use these as the name
    to validate against...

    if (document.Form1['_ctl45_txbName'].value.length == 0) return false;

    **NOTE: if you add controls to the page the "ctl45" may change to "ctl46"
    and so on. so when updateing the page, make sure the javascript validation
    code works.

    whatever. sorry if this is not what you are talking about....

    -psb

    "Ken" <anonymous@discussions.microsoft.com> wrote in message
    news:01c101c3d6de$8fe773e0$a301280a@phx.gbl...
    > Hi there,
    > I have a usercontrol and i have written sone clientside
    > validation script associated along with it. Now when i
    > register this usercontrol in the mainwebform, how can i
    > access the clientside validation to validate the
    > usercontrol?
    >
    > Thanks in advance
    >
    > -K

    psb Guest

  5. #4

    Default Re: usercontrol and clientside validation

    What you can do is define the validator in the page outside the user control and set its property to validate the controls inside the user control: ControlToValidate=”UserControlID1$TextBox1″
    Refer to the blog:
    http://geekash.wordpress.com/2011/01/30/client-side-validation-of-a-control-defined-inside-a-web-user-control-in-asp-net/
    romash80 is offline Junior Member
    Join Date
    Feb 2011
    Posts
    3

  6. #5

    Default Re: usercontrol and clientside validation

    You can use the format ControlToValidate="UserControlID$ControlID". This works with ValidationGroup property as well.

    Refere to:

    http://ashgeek.blogspot.com/2011/01/client-side-validation-of-control.html
    romash80 is offline Junior Member
    Join Date
    Feb 2011
    Posts
    3

  7. #6

    Default Re: usercontrol and clientside validation

    You can use the format ControlToValidate="UserControlID$ControlID". This works with ValidationGroup property as well.

    Refere to:

    http://ashgeek.blogspot.com/2011/01/client-side-validation-of-control.html
    romash80 is offline Junior Member
    Join Date
    Feb 2011
    Posts
    3

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139