c# - Passing action and controller values from view to another partialview -


i have multiple index views different grid in each of these views, of them uses same popup control. dont want make partial view foreach index view have. put popup partial view in shared folder.

but have html.beginform('action','controller') in popup partialview, , these values different in each grid. how can pass these view of grid partial view of popup?

the grid view:

  //code resumed   @html.devexpress().gridview(   settings =>   {     settings.name = "testmastergrid";     settings.column.add("id");     settings.column.add("name");     settings.column.add("email");      //command column wich calls popup control   } 

the popup partialview:

//code resumed using (html.beginform("actionineedtogetfromthegridview", "controllerineedtogetfromthegridview", formmethod.post))         {             html.devexpress().textbox(                 textboxsettings =>                 {                     textboxsettings.name = "reason";                     textboxsettings.controlstyle.cssclass = "editor";                 })             .render();              html.devexpress().label(                 labelsettings =>                 {                     labelsettings.name = "sh";                     labelsettings.controlstyle.cssclass = "label";                 }).render();             html.devexpress().button(                 buttonsettings =>                 {                     buttonsettings.name = "btnupdate";                     buttonsettings.controlstyle.cssclass = "button";                     buttonsettings.width = 80;                     buttonsettings.text = "ok";                     buttonsettings.usesubmitbehavior = true;                 }             )             .render(); 

thanks!

pass action , controller names action returns partialviewresult. then, pass names partial's model , use them in beginform statement:

html.beginform(model.action, model.controller, formmethod.post) 

edit:

i'm not familiar devexpress, found callbackroutevalues member in settings. i'll use example:

settings.callbackroutevalues = new { controller = "controllername", action = "getpartialview", desiredaction = "desiredaction", desiredcontroller = "desiredcontroller" } 

in controller, you'd have action , controller parameters:

public partialviewresult getparialview(string desiredaction, string desiredcontroller) {     var viewmodel = new partialviewmodel { action = desiredaction, controller = desiredcontroller);     return partialview("name", viewmodel); } 

i typed out code hand, it's full of errors. gets idea across, though.

quick edit: changed parameter names make little clearer.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -