How to load dynamically user control/ partial view dynamically in asp.net mvc -
i new in mvc...now learning long time attach asp.net web form technology. many way can load user control in webform.
1) suppose when user click button postback occur , server side method call. server side method can instantiate user control or load user control , add page code behind.
2) way can load user control dynamically jquery. can call server side function jquery. , function can load user control , user control html , send html of usercontrol jquery function return result.
so believe same thing can done in mvc too. discuss possible way load partial view dynamically @ client side action method , jquery.
how html of partial view here action method ? please discuss point wise , sample code.....because want learn tricks.
depending on requirements there few scenarios available you:
1) utilize combination of javascript , jquery ajax call, json result, , reneder control call partial method , $("#element").html({jsondata}).
2) utilize ajaxform object present form replaced on submission desired user control (called partial).
3) pre-render partial have hidden , on successful submission display hidden control, or update , show depending on needs.
Comments
Post a Comment