I have an MVC 4 application that has one home look. I have three link buttons and you want to dynamically load three different forms based on the click of a button. I am using partial mvc views. So, if I press button-1, it should load partialView-1, and also send value-1 from the corresponding text field to partialView-1.
I am looking for a built-in mvc approach, not working with heavy javascript.
You can do it like this .
A. Have different methods inside your controller that returnPartialViewResult
PartialViewResult
[HttpGet] public PartialViewResult GetPartialView1(int value) { return PartialView("_PartialView1"); //This view should exist in appropriate views folder. }
B. @Ajax.ActionLink
@Ajax.ActionLink
@Ajax.ActionLink( "Button1", "GetPartialView1", new { value1 = 1}, new AjaxOptions { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId = "righthandsidebox" } )
C. UpdateTargetId = "righthandsidebox", div . righthandsidebox PartialView
UpdateTargetId = "righthandsidebox"
righthandsidebox
PartialView
MVC , , , , . , javascript.
javascript, . , , , . , .
, "", javscript? jQuery, , .
( javascript). , display:none, javascript , . , .
display:none
"ajax-" , .
, ... , javascript.
Source: https://habr.com/ru/post/1543759/More articles:Unable to set UIButton buttonType in initializer in Swift - swiftwhy fscanf () never returns EOF? - c ++Callback function from C to Swift - cВ чем преимущество использования фонового изображения в div вместо классического для создания изображения со ссылкой? - htmlDeclaring and initializing static objects in a class - swiftHow to define observable loops - reactive-programmingEnviron ("USERNAME") in VBA returns "User" after updating Windows 8 - vbaWhat is the expected result of subscribing to a range? - swifthow to solve spring no bean named 'dataSource' defined? - springImport sqlite3.h into Swift project through Obj-C bridge header not working - sqliteAll Articles