|
My answer to your question is: YES!
One of the advantages is the state management (see ViewState). Another one is the possibility to associate the controls with validators. I understood that you prefer to write your validation code, but I'm curios how much code you have to write for that and if you have it already how much can you reuse, every time you need a validation? Please play a litle bit with RegularExpressionValidator, and you will see how powerful and universal is this validator, and how easy is to use it. And there are also other advantages too ... . Thanks.
|
|
|
|
|
I don't use ViewState as I just don't write pages that would ever take advantage of it, but with regards to the validations...
I have two scripts, one client-side DOM-compliant Javascript and one server-side C#, both of which handle the validation of any and all items on any given form. It is wrapped up in a simple control that I can just add to the page and then handle the OnError event from both the client or server end of the page execution if I want Javascript prompting, or to print it to a placeholder. All it takes is a drag-and-drop, a quick call to the generic _on_form_submit(this) Javascript function from each form I want validated on the client side, and a call to the server side version from my Load...IsPostBack code, and all is set up - no matter how many times I edit the form. No more matching up validators with web controls, no more copy/paste control nightmares, no more friggin' property editing -- just stick in all the input, textarea and select fields I want, add a few custom attributes like required, pattern, min/maxLength, range, etc and hey presto - no brainer form validation.
David Wulff
"Without hopes and dreams we're directionless" - Anna
|
|
|
|
|
You ever made a custom/user/server control and stopped it outputting that damned automatic SPAN element?
David Wulff wrote:
Is there a real advantage to using a TextBox over an input type="text"?
Viewstate is nice when you need it (most forms work better with it IMO.)
Paul Watson Bluegrass Cape Town, South Africa
brianwelsch wrote:
I find my day goes by more smoothly if I never question other peoples fantasies. My own disturb me enough.
|
|
|
|
|
Paul Watson wrote:
You ever made a custom/user/server control and stopped it outputting that damned automatic SPAN element?
I've never noticed it doing that - I'd have thought I'd have noticed if it had been adding extra code, because I have been through every damned line the thing outputs with a toothcomb over the past weeks trying to figure out that my problem was ac tually a bug with ASP.NET! (I posted about it in the ASP.NET forums if anyone is interested in waht it was). Tomorrow at work I'll have a look and see.
Paul Watson wrote:
most forms work better with it IMO
My head is still stuck in the past, I do my "own" ViewState becayuse I like to double check all the data first.
David Wulff
"Without hopes and dreams we're directionless" - Anna
|
|
|
|
|
Paul Watson wrote:
You ever made a custom/user/server control and stopped it outputting that damned automatic SPAN element?
Okay I've just checked and can't see SPANs being generated anywhere...
David Wulff
"Without hopes and dreams we're directionless" - Anna
|
|
|
|
|
What did I mean?
I mean like some validator controls which have client side scripting don't support Netscape at all.
And some properties of the server controls like Width or Height also have such problem, ex: you set Width=100% --> you get nothing in Netscape. And if you use style="width:100%" the VS.NET will autoinsainly change that to Width="100%", and that drived me crazy.
<font color="green">
<font color="blue">foreach</font> (System.Hours hour <font color="blue">in</font> EveryDay.Hours)
{
WorkingWithMyComputer();
}
|
|
|
|
|
Because for Netscape the validators are executed on the server side and not on the client side, doesn't mean that they are not doing their job! More than that, you can specify EnableClientScript="false" and then also for IE the validation will run on the server.
Nobody force you to write ASP.NET code using VS.NET, use your favorite IDE (or Notepad) and you will be happy then.
|
|
|
|
|
Yes! For Netscape the validators are executed on the server side and so are they for the IE. And I wasn't saying that they're not doing their jobs, it's just a pity that they don't validate on the client side for Netscape.
I'm glad that nobody forced me to to use any IDE, using others missing alot of features that VS.NET provides , no thing is perfect anyway.
<font color="green">
<font color="blue">foreach</font> (System.Hours hour <font color="blue">in</font> EveryDay.Hours)
{
WorkingWithMyComputer();
}
|
|
|
|
|
So ... that means there is place for improvements . Write your own validators, that support client-side validation also for Netscape and share them with us on codeproject.com. It will be a benefit for all of us. Thanks.
|
|
|
|