Feb 20, 2016, 4:51 PM
Hello Jeff!
About conditionally building the
About conditionally building the
@(Url.Action())
, this is replaced when the page is built and you can't just replace it in JavaScript. But you can set the whole result as a parameter to the JS method, from the button. E.g.:Html.X().Button().Text("Test View 1").ComponentCls("menu-button").CtCls("menu-button-small").Listeners(lst => { lst.Click.Handler = "loadTestView('TestGrid', '@(Url.Action("RenderPartialView"))')"; }),
Html.X().Button().Text("Test View 2").Listeners(lst => { lst.Click.Handler = "loadTestView('TestGrid2','Test')"; })
and then use your loadTestView()
simply as: var loadTestView = function (viewName, url) {
App.PnlCenter.clearContent();
Ext.net.DirectMethod.request({
url: url,
params: {
containerid: "PnlCenter",
viewName: viewName
},
})
};
As for the failing to reload. I couldn't reproduce here. I can click over and over and the content gets updated. Have you changed your partial view to contain just razor code as I am using here? As like just:@(Html.X().Label().Text("Testing").Width(200).Height(50)
And maybe a 'testing2' string on the other partial view so you can see content changing. No html tags, just the components on the partial view.