Home All Groups Group Topic Archive Search About

How can validator code get the FormView data object

Author
21 Jan 2007 8:55 PM
David Thielen
Hi;

We have a FormView tied to an ObjectDataSource. How can our C# code for a
CustomValidator get the data object of the data in all the fields?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

Author
22 Jan 2007 7:03 AM
Steven Cheng[MSFT]
Hello Dave,

As for your  custom validator , would you provide some detailed info on its
code logic? For example, what target controls will it validate and what's
the data required for its validation. Generally, a validator control will
be assoicated with another single control for validation. And for FormView
or other template databound control, if you want to valiate any sub
controls in the control template, you should put the validators in the
certain template.

Please feel free to let me know if there is anything I missed here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
Author
22 Jan 2007 3:21 PM
David Thielen
It validates all the controls. This is how we are working around the problem
of each validator taking up space with their hidden text - instead we have a
single custom validator that checks everything.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




Show quoteHide quote
"Steven Cheng[MSFT]" wrote:

> Hello Dave,
>
> As for your  custom validator , would you provide some detailed info on its
> code logic? For example, what target controls will it validate and what's
> the data required for its validation. Generally, a validator control will
> be assoicated with another single control for validation. And for FormView
> or other template databound control, if you want to valiate any sub
> controls in the control template, you should put the validators in the
> certain template.
>
> Please feel free to let me know if there is anything I missed here.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>

>
> ==================================================
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
>

>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
>
> ==================================================
>

>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
Author
23 Jan 2007 6:31 AM
Steven Cheng[MSFT]
Thanks for the reply Dave,

Thus, you may need to manually use script to explore the client-side script
of the FormView control. You may first locate the super element of FormView
through clientID and then locate its child elements. For such scenario,
you'd better first review the generated client-side html of the formview
and then determine how to author the script to explore the client-side
element hierarchy.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
Author
23 Jan 2007 5:43 PM
David Thielen
Hi;

What is the recomended way to handle validation.

If I put a validator on each control (2 validators in some cases) when they
do not show their hidden text makes the form look weird because of the
spacing they cause.

If I use a single CustomValidator then I have to go query each control for
it's value which is a pain.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




Show quoteHide quote
"Steven Cheng[MSFT]" wrote:

> Thanks for the reply Dave,
>
> Thus, you may need to manually use script to explore the client-side script
> of the FormView control. You may first locate the super element of FormView
> through clientID and then locate its child elements. For such scenario,
> you'd better first review the generated client-side html of the formview
> and then determine how to author the script to explore the client-side
> element hierarchy.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead

>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
Author
25 Jan 2007 10:18 AM
Walter Wang [MSFT]
Hi Dave,

In my opinion, using separate validators is better. The validator is
inheriting from Label, which uses html element SPAN. Would you please tell
me more about the page layout, such as why the hidden SPAN will cause
layout problem.

Regards,
Walter Wang (waw***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Author
25 Jan 2007 5:03 PM
David Thielen
I am guessing it is how IE displays it but we have cases like:

<TextBox> <RequiredFieldValidator> <RegularExpressionValidator> and what
happens is if the textbox has data but it does not match the regexpr, then
after the text box there is a long space (the hidden error message for
RequiredFieldValidator and then the rrror message for
RegularExpressionValidator - and that looks very very wrong.

Also, if neither message is displayed, the spacing still occurs which pushes
the position of subsequent controls down.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




Show quoteHide quote
"Walter Wang [MSFT]" wrote:

> Hi Dave,
>
> In my opinion, using separate validators is better. The validator is
> inheriting from Label, which uses html element SPAN. Would you please tell
> me more about the page layout, such as why the hidden SPAN will cause
> layout problem.
>
> Regards,
> Walter Wang (waw***@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
Author
26 Jan 2007 8:00 AM
Walter Wang [MSFT]
Hi Dave,

Validators have a property called Display which could control the generated
SPAN's style. I believe setting to Dynamic or None should work for your
purpose:

#ASP.NET Resources - Validation Easter Egg
http://www.aspnetresources.com/blog/validation_easter_egg.aspx

Let me know the result.

Regards,
Walter Wang (waw***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.