Ask a Question related to ASP.NET Building Controls, Design and Development.
-
superman #1
Validator for server control inside user control
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
superman Guest
-
Adding validator to simple server control
I have some trivial server controls, derived from various WebControls (TextBox, DropDownList, etc). The server control wraps the web control and... -
Adding Validator Control at runtime in a Custom Control
Hi Wim, How do we link the TextBox to this validator control class in runtime ? Could you please tell. Thanks _ Muds. Wim Hollebrandse... -
Possible to create a composite control that has a child control that is a validator that validates the composite control itself?
I am attempting to create a composite control which has a label, followed by an optional error message, followed by two text boxes. I have... -
Custom Server Control works on page but not User Control...why?
I'm developing the DevEdit.NET server control (an online HTML editor - www.devedit.com) but there's an extremely bizarre bug. The control runs fine... -
viewstate of the user control inside datagrid...
Hi there! I have datagrid with template column and I am using the same user control for display (in ItemTemplate) and collect (in EditItemTemplate)... -
Brennan Stehling #2
Re: Validator for server control inside user control
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 :)
[url]http://brennan.offwhite.net/blog/[/url]
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,
> supermanBrennan Stehling Guest
-
superman #3
Re: Validator for server control inside user control
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 :)
> [url]http://brennan.offwhite.net/blog/[/url]
>
>
> 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
>superman Guest
-
Brennan Stehling #4
Re: Validator for server control inside user control
You are correct. It was added to ASP.NET 2.0.
[url]http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.basevalidator.validation group.aspx[/url]
You can still create a custom validator.
Brennan Stehling
[url]http://brennan.offwhite.net/blog/[/url]
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 :)
> > [url]http://brennan.offwhite.net/blog/[/url]
> >
> >
> > 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
> >Brennan Stehling Guest



Reply With Quote

