开发者

Asp.net MVC 3 partial view postback

开发者 https://www.devze.com 2023-02-11 13:13 出处:网络
I am new to mvc and I have a question I have a page (asp.net Mvc 3) called profile which contains 3 partial view called (1) Address,Qualification,Experience开发者_开发知识库.

I am new to mvc and I have a question I have a page (asp.net Mvc 3) called profile which contains 3 partial view called (1) Address,Qualification,Experience开发者_开发知识库. Each of the partial view should allow you to add its details and save it details/contents without affecting the others. How can I attach an action to each partial view save button and postback the result without refreshing other partial view.

Can someone explain this to me with and without using jquery/ajax


without ajax or jquery you'd be stuck with doing something horrible like iFrames... Stick to jquery, it is the best and easiest way.

Actually, here is one way you might be able to do it.

Name the "Submit" buttons according to the method you want called. Then, have all of your 3 sets of data inputs within one <form></form> which posts to an intermediate Controller endpoint.

In the intermediate controller endpoint, determine which button was pressed, then pass the correct data to your normal control methods, and push all the other data back to the view. That way you can fill out all the inputs, click the appropriate submit button, then only the correct data gets used! Then all the other data gets pushed back to the view and the approprate input boxes get filled out.

0

精彩评论

暂无评论...
验证码 换一张
取 消