views:

207

answers:

4

I have 4 forms (almost similar with few diference) to take customer service requests. All those forms have similar validations. Now I am developing a website in asp.net 3.5 and I have very short time for delivering that. I want an approach whether to use Ajax tabcontrol with 4 tabs with 4 different usercontrols or single form and just give look and feel of tab.

A: 

I use a single form object with this and just give it a tabular look. Works great.

I have several recent websites that I have taken this approach to.

Finally I chose this approach.
Naga
A: 

If you use a single form, you're essentially tasking your server side with parsing and making sense of the data. you may run into all kinds of edge-cases where some fields on the real form will come from several "logical" forms, and not make sense.

My recommendation: if you have 4 separate logical functions, create 4 separate forms. They don't have to necessarily reside on 4 different pages - you just show the relevant one when the tab it corresponds to is pressed. That way, when you submit to the server-side, it already knows which form to expect, and won't be surprised by fields that shouldn't be there.

Traveling Tech Guy
A: 

It all depends on how complicated these forms are. Since they are all to do with customer service requests (do the same thing) one form might be appropriate since the logic and functionality is all the same. It's up to you where you want to draw the line though because you don't want to have huge case / if statements accounting for all sorts of cases if the code is complicated.

Also, keep in mind that if you put it all in one form, when you post back the data each time you could be posting back a lot of data from viewstate (assuming webforms) and posted data so it all comes down to how much each form does. This is where your experience comes in and you need to make a judgement call.

Keep in mind complexity, maintainability, amount of round trip data and functionality when making your decision. Try and keep forms as simple as possible.

As a side note, I did something similar recently using webforms and I did not go the AJAX toolkit route. I put 3 forms in divs and used JQuery to handle all the switching between forms. Each forms had no more than 3 controls and very similar so they were pretty basic and it made sense in this case.

Kelsey
A: 

If your 4 controls have so many things in common wouldn't worth the pain to have class for the common stuff and the 4 actual controls extend that class to implement their unique behaviour? So you would have one server control (to implement) and then 4 adjustments (in each user control class) to be what you need.

Andrei