tags:

views:

434

answers:

2

I have 2 radio button with values New & Existing. If user chooses New, then I show a textbox on the form and if Existing a dropdown and textbox is hidden. The question is , does the hide/show of the textbox/dropdownlist have to be written in the View or the Controller class? Also when I choose the selection my whole form is posting back and hence all validation error msgs are being shown which should not be shown nless the save button is clicked, how do I a partial postback without full form submission? Any code snippets or urls would be benificial in this respect.

+2  A: 

The question is , does the hide/show of the textbox/dropdownlist have to be written in the View or the Controller class?

Just show/hide with jQuery that.

Also when I choose the selection my whole form is posting back and hence all validation error msgs are being shown which should not be shown nless the save button is clicked, how do I a partial postback without full form submission? Any code snippets or urls would be benificial in this respect.

Perform 'partial postbacks' through javascript.
Post form to save action only once when it's ready (when Save button is clicked).

Some resources:
jQuery tutorial
jQuery AJAX
About form AJAX`ifying

Arnis L.
Any example code would be greatly appreciated as I have no knowledge of jQuery.Comes for ASP.NET environment
chugh97
Btw, you can do the same with any framework or in raw javascript too. It's just easier with one. And i prefer jQuery.
Arnis L.
+1  A: 

If I understand you correctly, the answer is the hiding and showing of controls should be done on the view as it's display specific.

If you use javascript to show and hide the controls then because it's on the client side you would not have to postback the form, and could do server side validation when the save button is clicked.

jQuery is very good: Jquery Website

Hope that helps?

dnoxs