json - Kendo UI Grid - ClientTemplate calling MVC Url.Action calls (incorrectly) two different actions -


  1. i have data loads kendo grid via ajax binding.
  2. within 1 of columns there's clienttemplate calls javascript method (showall).
  3. this method call action , details of data, putting json response, , open jquery-ui dialog show details.
  4. when user clicks on link in grid httpget triggered getdetails action but, problem is, triggered entire page's action (index).

the question, guess, causing index action triggered? because, dialog show, detailed data populate, once close dialog filter textboxes reset , grid reload , data within it.

shouldn't action called getdetails?

any hints appreciated!

code:

@(html.kendo().grid<logviewmodel>()     .name("loggrid")     .columns(column =>     {         column.bound(x => x.stuffcount).title("stuff").width(70)             .clienttemplate("<a onclick=\"showall('" + "#= id #')\"" + " href=''>#= stuffcount #</a>");     })     .datasource(databinding => databinding                 .ajax()                 .pagesize(50)                 .read(read => read.action("getdata", "summary")                     .data("getsearchfilters"))                 .model(model => model.id(o => o.id)))             .events(e => e                 .databound("ongriditemsdatabound"))             .pageable(paging => paging.refresh(true)) )}  <div id="dialog-message" title="" style="display: none">     <p id="msg"></p>     </div>   <script type="text/javascript">     var showall= function (id) {         var url = '@url.action("getdetails", "summary")' + "/" + id;         var stitle = 'title text';         $.getjson(url, null,              function (data) {                 $("#dialog-message").dialog({ title: stitle });                 $("#msg").text(data.details);                 showmessage();                     });     };      var showmessage = function () {         $("#dialog-message").dialog({             modal: true,             draggable: false,             resizable: false,             buttons: {                 ok: function() {                     $(this).dialog("close");                 }             }         });     }; </script> 

the controller methods (content removed brevity

public actionresult index(...) {     ... }  public actionresult getdetails(guid id) {     ... (get data repository)      return json(data, jsonrequestbehavior.allowget); } 

i posted same question on telerik forum. admin pointed me in right direction:

turns out had add void href call javascript , stay on page. href="javascript:void(0)"


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -