Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Validator for server control inside user control

Reply
Thread Tools

Validator for server control inside user control

 
 
superman
Guest
Posts: n/a
 
      09-05-2006
Hello,

I am facing a strange situation and have already spent a lot of time on
this. I have a user control 'U' that consists of a server/composite control
'C'. C consists of a textbox 'T' and a datepicker 'D' and implements
INamingContainer. The user-selected date from D appears in T. The
validationproperty of C is set to the 'Text' property of T. 'U' also consists
of a RequiredFieldValidator 'R' that validates C (i.e. The text property of
T).

When I use 'U' in an .aspx page, the id of the rendered textbox becomes U:C.
However, the validator R's ControlToValidate property is set to U_C. Thus,
the validation never fires since it is referencing to UniqueID instead of the
ClientID of C.

What am I missing? Any help is appreciated.

Thanks,
superman

 
Reply With Quote
 
 
 
 
Brennan Stehling
Guest
Posts: n/a
 
      09-07-2006
I would first check the ValidationGroup on every control involved.
Then run through this with the debugger. What you may have to do is
use a custom validator which manually checks the value in question.

Brennan Stehling
Microsoft Notepad MVP
http://brennan.offwhite.net/blog/


superman wrote:
> Hello,
>
> I am facing a strange situation and have already spent a lot of time on
> this. I have a user control 'U' that consists of a server/composite control
> 'C'. C consists of a textbox 'T' and a datepicker 'D' and implements
> INamingContainer. The user-selected date from D appears in T. The
> validationproperty of C is set to the 'Text' property of T. 'U' also consists
> of a RequiredFieldValidator 'R' that validates C (i.e. The text property of
> T).
>
> When I use 'U' in an .aspx page, the id of the rendered textbox becomes U:C.
> However, the validator R's ControlToValidate property is set to U_C. Thus,
> the validation never fires since it is referencing to UniqueID instead of the
> ClientID of C.
>
> What am I missing? Any help is appreciated.
>
> Thanks,
> superman


 
Reply With Quote
 
 
 
 
superman
Guest
Posts: n/a
 
      09-07-2006
Brennan,

I forgot to mention that I am working with .NET framework v1.1 and not 2.0.
I don't see any validation group property.

"Brennan Stehling" wrote:

> I would first check the ValidationGroup on every control involved.
> Then run through this with the debugger. What you may have to do is
> use a custom validator which manually checks the value in question.
>
> Brennan Stehling
> Microsoft Notepad MVP
> http://brennan.offwhite.net/blog/
>
>
> superman wrote:
> > Hello,
> >
> > I am facing a strange situation and have already spent a lot of time on
> > this. I have a user control 'U' that consists of a server/composite control
> > 'C'. C consists of a textbox 'T' and a datepicker 'D' and implements
> > INamingContainer. The user-selected date from D appears in T. The
> > validationproperty of C is set to the 'Text' property of T. 'U' also consists
> > of a RequiredFieldValidator 'R' that validates C (i.e. The text property of
> > T).
> >
> > When I use 'U' in an .aspx page, the id of the rendered textbox becomes U:C.
> > However, the validator R's ControlToValidate property is set to U_C. Thus,
> > the validation never fires since it is referencing to UniqueID instead of the
> > ClientID of C.
> >
> > What am I missing? Any help is appreciated.
> >
> > Thanks,
> > superman

>
>

 
Reply With Quote
 
Brennan Stehling
Guest
Posts: n/a
 
      09-07-2006
You are correct. It was added to ASP.NET 2.0.

http://msdn2.microsoft.com/en-us/lib...tiongroup.aspx

You can still create a custom validator.

Brennan Stehling
http://brennan.offwhite.net/blog/

superman wrote:
> Brennan,
>
> I forgot to mention that I am working with .NET framework v1.1 and not 2.0.
> I don't see any validation group property.
>
> "Brennan Stehling" wrote:
>
> > I would first check the ValidationGroup on every control involved.
> > Then run through this with the debugger. What you may have to do is
> > use a custom validator which manually checks the value in question.
> >
> > Brennan Stehling
> > Microsoft Notepad MVP
> > http://brennan.offwhite.net/blog/
> >
> >
> > superman wrote:
> > > Hello,
> > >
> > > I am facing a strange situation and have already spent a lot of time on
> > > this. I have a user control 'U' that consists of a server/composite control
> > > 'C'. C consists of a textbox 'T' and a datepicker 'D' and implements
> > > INamingContainer. The user-selected date from D appears in T. The
> > > validationproperty of C is set to the 'Text' property of T. 'U' also consists
> > > of a RequiredFieldValidator 'R' that validates C (i.e. The text property of
> > > T).
> > >
> > > When I use 'U' in an .aspx page, the id of the rendered textbox becomes U:C.
> > > However, the validator R's ControlToValidate property is set to U_C. Thus,
> > > the validation never fires since it is referencing to UniqueID instead of the
> > > ClientID of C.
> > >
> > > What am I missing? Any help is appreciated.
> > >
> > > Thanks,
> > > superman

> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing USER CONTROL which is inside Masterpagethrough Another USER Control inside normal page. Kiran More ASP .Net Web Controls 2 11-14-2006 12:58 PM
Validator for server control inside user control superman ASP .Net Web Controls 0 09-05-2006 02:45 AM
Validator for server control inside a user control. =?Utf-8?B?c3VwZXJtYW4=?= ASP .Net 0 09-04-2006 09:03 PM
Custom User Control is not rendered inside another user control in a server table. Leeor Chernov ASP .Net 2 10-16-2005 08:35 AM
Event not firing for user control inside user control vatech1993 ASP .Net 4 12-11-2004 02:51 PM



Advertisments