c# - Opening multiple windows with Kendo menu -


i have kendo menu , i'd each menu open new window. how can achieve that?

this current code in _layout:

<div class="k-rtl"> @(html.kendo().menu()     .name("menu")     .items(items =>     {         items.add().text("menu 1").items(child =>         {             child.add().text("1").linkhtmlattributes(new { onclick = "menu('1');" });             child.add().text("2");         });     }) ) </div> <script> function menu(text) {     var window = $("#win1").data("kendowindow");     switch (text) {         case "1":             window.refresh({ url: "@url.action("index", "1")" }).title("1");             break;         case "2":             window.refresh({ url: "@url.action("index", "2")" }).title("2");             break;     }     window.open(); } </script> 

and create default window in index:

@(html.kendo().window()     .name("win1")     .title("default")     .loadcontentfrom("index", "default")     .draggable()     .resizable()     .actions(actions => actions.close().minimize().refresh())     .position(p => p.top(100)) ) 

i have 2 problems code:

  1. i want have multiple windows.
  2. window's refresh button loads old content previous page.

to have multiple windows create partial view inject html code (@html.partial("mygenericwindow")), ensuring you're generating new window id (name) each time.

like this:

@{     var windowid = guid.newguid().tostring(); }  @(html.kendo().window()     .name(windowid )     .draggable()     .resizable()     .actions(actions => actions.close().minimize().refresh())     .position(p => p.top(100)) ) 

to fix refresh issue try this:

function menu(text) {     var window = $("#@windowid").data("kendowindow");     window.title(text);     window.refresh({         url: '@url.action("index")',         data: { myparam: text }     });      window.bind("refresh", function () {         window.center();         window.open();     }); } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -