By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,793 Members | 1,257 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,793 IT Pros & Developers. It's quick & easy.

Creating a validationsummary

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Christer" <wi******@hotmail.com> wrote in message
news:7b**************************@posting.google.c om...
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

Nov 18 '05 #2

P: n/a
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: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Christer" <wi******@hotmail.com> wrote in message
news:7b**************************@posting.google.c om...
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

Nov 18 '05 #3

P: n/a
"Peter Blum" <PL****@Blum.info> wrote in message news:<eo**************@TK2MSFTNGP10.phx.gbl>...
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

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.