简体   繁体   中英

Pass an argument to a controller on button click event

I added a button to my view as below. After I click that button a popup window opens.

I want to pass an argument to my controller at the button click event.

<div style="float: right;">
  <a id="btn-language-content" class="k-button custombtn lightblue k-grid-add btn-info" href="">
    <span class='metiralclass material-icons md-18 md-dark'>add_circle</span>
    <span class='buttontext'> @Resource.btnAdd</span>
  </a>
</div>

My button click event is:

$('body').on('click', '#btn-language-content', function () {
  var addWin = $("#winLanguageContent").data("kendoWindow");
  addWin.open();
  addWin.center();       
  addWin.refresh({
    url: '@Url.Action("_LanguageEditor", "HelpSystem", new { area = "HelpSystem" 
  })',
});

要将数据以这种方式传递给javascript,您需要向按钮添加HTML数据属性,如下所示:

<a id="btn-language-content" class="k-button custombtn lightblue k-grid-add btn-info" href="" data-kendo-window="value"></a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM