Creating a validationsummary

C

Christer

Hi all!

I recently created a MessageBox webcontrol for asp.net. This can be
used as is, but I also want to take ude of it in other webcontrols.
Right now i creating a ValidationSummary control, that makes use of my
messagebox to show the summary of failing validators.

So far I've been successfull achieving this. However, the serverside
nature of the MessageBox currently forces all validators (and the
validationsummary) to have EnableClientScript=false. In short this
means that all validations are made on the server, which causes
postbacks.

The validationsummary webcontrol shipped with the .net framework makes
it possible to have the validationsummary displayed in a javascript
alert-messagebox. I want to recreate the same clientside display with
my own messagebox. In short, write the messagebox to the page in a
hidden state, and show it on demand.
However, the .net valisationsummary alert is created in the included
validation-javascript file (WebUIValidation.js) wich also contains all
the functions for clientside validation so, as I see it, it's quite
impossible to both have clientsidescript enabled on validationcontrols
and summary, and still create my own clientside daisplay of the
failing validator.

Does any of you out there been in similar situations? Any ideas how to
cut my cake? I'm determined to use the existing clientside
functionality with regards to validation, by I'd like to make my own
display function.

Kind regards
Christer
 
C

Chris Jackson

I have not undertaken this particular task, though I have called the
validation scripts by hand on several occasions. So, thinking about the
problem, there are a couple of different approaches that I can think of.

First, you could step through the client side validation scripts, and see
what methods are doing the tasks that you want. You can then build your own
script that calls into these scripts where you want to use their
functionality, but then handles the display when you want to have control.

Alternately, you know that there is an option to have these messages display
on the page instead of popping up a message box. You could use
Attributes.Add to attach an onchange event handler when the script updates
these controls, and then use the text in here to create your own popup
window.
 
P

Peter Blum

Having rewritten the entire validation framework, including
validationsummary and alert boxes, I have lots of experience here. I'd like
to know specifically what you were trying to do within the alert that
differs from Microsoft's controls? My product, "Professional Validation And
More" may help. (http://www.peterblum.com/vam/home.aspx) It provides the
ability to describe your alert box with rules to allow text before and
after, plus the format of the error messages can be in list or sentence
style. It has an extensive free Developer's Kit with the ability to extend
the client-side code for validators and validationsummary.

I suspect that to better understand what you are doing, I would have to
better understand what your MessageBox webcontrol does beyond writing the
javascript: window.alert('message');
and why you want to use it to deliver the contents of the ValidationSummary.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 
C

Christer

Peter Blum said:
I suspect that to better understand what you are doing, I would have to
better understand what your MessageBox webcontrol does beyond writing the
javascript: window.alert('message');
and why you want to use it to deliver the contents of the ValidationSummary.

Well, when making our web applications we are often challanged with
where to put general returnmessages and validation summaries on a
given page, because the page contents differ.
The messagebox webcontrol actually is a close remake of the windows
forms messagebox with regards to the server side code (and button and
icon enums). It's has possibility of displaying OK/Cancel/Yes/No
buttons with corresponding serverside events, therefore making it
usable as is and as included control in other webcontrols.

On the client side the messagebox not javascript-alert-based but dhtml
oriented (which of course has it's implications). However, as these
applications are meant for intranet use only, we have no big browser
worries. The messagebox has a more (positive) impact on the user with
corresponding icons than the (IMHO) limited javascript alert, and we
can even write our own caption of the messagebox (crazy feature, huh?!
:)

In short, we're trying to show all returnmessages ("Costumer
deleted"), errors ("Database gone missing") and validationsummaries
("fill in name...") in one standardized way across all our
applications (along with other standardizing initiatives).

So, this is my motivation for trying to recreate the visual part of
the original validationsummary. As stated by another poster I cold
write my own client side script to invoke the client side validators,
but because I feel like that would be like coding against functions
which should have been abstracted to me (IMHO), I'm not sure I'll go
that way... for now...

Best personal regards
Christer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top