如何在MVC中将值从kendo网格传递到kendo窗口 [英] How to pass value from kendo grid to kendo window in MVC
问题描述
如何将所选行的PreEmploymentId从网格传递到网格的按钮点击事件窗口。
脚本 -
< script>
$([data-button-type ='auction'])
.click(function(e){
myWindow.data(kendoWindow)。open();
myWindow.data(kendoWindow)。center();
myWindow.data(kendoWindow)。top();
});
< / script>
剑道格栅 -
@ {
Html.Kendo()。Grid(Model.LstPreEmploymentWorkflowModellist)
.Name( < span class =code-string> MyGrid)
.Columns(col = >
{
// 在edir按钮上单击操作名称PreEmploymentWorkflow控制器中调用的Main和PreEmploymentId已通过
col.Template(@< text>
@ Html.ActionLink( 编辑, Main, PreEmploymentWorkflow, new {Id = item.PreEmploymentId}, new {@class = classname})< / text > )。宽度( 30 跨度>);
col.Bound(o = > o.PreEmploymentId).Visible( false )。可分组( false );
col.Bound(o = > o.FirstName).Width( 30 )。可分组( false );
col.Template(@< text>
@ Html.ActionLink( OpenFile, Openfile, PreEmploymentWorkflow, new {Id = item.PreEmploymentId,uploadfilename = EEOC跟踪表单}, new {@class = classname3})< / text > )。标题( EEOC)。宽度( 30 );
col.Template(@< text> @(Html.Kendo()。Button()
.Name( open + @ item.PreEmploymentId)
.ImageUrl(Url.Content( / images / auction_16.gif))。HtmlAttributes( new {type = 提交,data_button_type = auction})
)
< / text > )。宽度( 40 )。标题( 状态);
col.Template(@< text>
@ Html.ActionLink( 删除, 删除, PreEmploymentWorkflow, new {Id = item.PreEmploymentId}, new {@class = classname2})< / text > )。宽度( 30 跨度>);
})
// 。HtmlAttributes(new {style =width:1100px})
.Sortable()
.Render();
}
剑道窗口 -
@ {Html.Kendo()。Window()
.Name(window)
.Width(500)
.Height(315 )
。动画(true)
.Draggable()
.Visible(false)
.Modal(true)
。标题(就业状态)
.Actions(actions => actions.Close())
.Content(@< text>
@using(Html.BeginForm(CreateStatus,PreEmploymentWorkflow,FormMethod.Post, new {enctype =multipart / form-data}))
{
< table>
< tr>
< td>
@(Html .Kendo()。TextBoxFor(m => m.LstPreEmploymentWorkflowModel.PreEmploymentId))
< / td>
< td>
@(Html.Kendo()。Radi oButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(1).Label(Approved))
< / td>
< td>
@(Html.Kendo()。RadioButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(9).Label(Reject))
< / td>
< / tr>
< tr>
< td>
< label class =Boldfor =statusattachment>状态附件:< / label>
< / td>
< td>< input type =filename =uploadfilestatus/>< / td>
< / tr>
< tr>
< td>
< input id =Button1type =submitvalue =Submit/>
< / td>
< / tr>
< / table>
}
< / text>)
.Render();
}
我的尝试:
由于我是MVC的新手,我不知道该怎么做,或者即使可以将值从网格传递到窗口。谢谢。
([data-button-type ='auction'])
.click(function(e){
myWindow.data(kendoWindow)。open();
myWindow.data(kendoWindow)。center();
myWindow.data(kendoWindow)。top();
});
< / script>
剑道格栅 -
@ {
Html.Kendo()。Grid(Model.LstPreEmploymentWorkflowModellist)
.Name( < span class =code-string> MyGrid)
.Columns(col = >
{
// 在edir按钮上单击操作名称PreEmploymentWorkflow控制器中调用的Main和PreEmploymentId已通过
col.Template(@< text>
@ Html.ActionLink( 编辑, Main, PreEmploymentWorkflow, new {Id = item.PreEmploymentId}, new {@class = classname})< / text > )。宽度( 30 跨度>);
col.Bound(o = > o.PreEmploymentId).Visible( false )。可分组( false );
col.Bound(o = > o.FirstName).Width( 30 )。可分组( false );
col.Template(@< text>
@ Html.ActionLink( OpenFile, Openfile, PreEmploymentWorkflow, new {Id = item.PreEmploymentId,uploadfilename = EEOC跟踪表单}, new {@class = classname3})< / text > )。标题( EEOC)。宽度( 30 );
col.Template(@< text> @(Html.Kendo()。Button()
.Name( open + @ item.PreEmploymentId)
.ImageUrl(Url.Content( / images / auction_16.gif))。HtmlAttributes( new {type = 提交,data_button_type = auction})
)
< / text > )。宽度( 40 )。标题( 状态);
col.Template(@< text>
@ Html.ActionLink( 删除, 删除, PreEmploymentWorkflow, new {Id = item.PreEmploymentId}, new {@class = classname2})< / text > )。宽度( 30 跨度>);
})
// 。HtmlAttributes(new {style =width:1100px})
.Sortable()
.Render();
}
剑道窗口 -
@ {Html.Kendo()。Window()
.Name(window)
.Width(500)
.Height(315 )
。动画(true)
.Draggable()
.Visible(false)
.Modal(true)
。标题(就业状态)
.Actions(actions => actions.Close())
.Content(@< text>
@using(Html.BeginForm(CreateStatus,PreEmploymentWorkflow,FormMethod.Post, new {enctype =multipart / form-data}))
{
< table>
< tr>
< td>
@(Html .Kendo()。TextBoxFor(m => m.LstPreEmploymentWorkflowModel.PreEmploymentId))
< / td>
< td>
@(Html.Kendo()。Radi oButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(1).Label(Approved))
< / td>
< td>
@(Html.Kendo()。RadioButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(9).Label(Reject))
< / td>
< / tr>
< tr>
< td>
< label class =Boldfor =statusattachment>状态附件:< / label>
< / td>
< td>< input type =filename =uploadfilestatus/>< / td>
< / tr>
< tr>
< td>
< input id =Button1type =submitvalue =Submit/>
< / td>
< / tr>
< / table>
}
< / text>)
.Render();
}
我的尝试:
由于我是MVC的新手,我不知道该怎么做,或者即使可以将值从网格传递到窗口。感谢。
How can I pass the PreEmploymentId of the selected row from the grid to window on button click event of the grid.
Script-
<script> $("[data-button-type='auction']") .click(function(e) { myWindow.data("kendoWindow").open(); myWindow.data("kendoWindow").center(); myWindow.data("kendoWindow").top(); }); </script>
Kendo grid-
@{
Html.Kendo().Grid(Model.LstPreEmploymentWorkflowModellist)
.Name("MyGrid")
.Columns(col =>
{
//on edir button click action name Main in invoked in PreEmploymentWorkflow controller and PreEmploymentId is passed
col.Template(@<text>
@Html.ActionLink("Edit", "Main", "PreEmploymentWorkflow", new {Id = item.PreEmploymentId}, new {@class = "classname"})</text>).Width(30);
col.Bound(o => o.PreEmploymentId).Visible(false).Groupable(false);
col.Bound(o => o.FirstName).Width(30).Groupable(false);
col.Template(@<text>
@Html.ActionLink("OpenFile", "Openfile", "PreEmploymentWorkflow", new {Id = item.PreEmploymentId, uploadfilename = "EEOC Tracking Form"}, new {@class = "classname3"})</text>).Title("EEOC").Width(30);
col.Template(@<text>@(Html.Kendo().Button()
.Name("open" + @item.PreEmploymentId)
.ImageUrl(Url.Content("/images/auction_16.gif")).HtmlAttributes(new {type = "submit", data_button_type = "auction" })
)
</text>).Width(40).Title("Status");
col.Template(@<text>
@Html.ActionLink("Delete", "Delete", "PreEmploymentWorkflow", new {Id = item.PreEmploymentId}, new {@class = "classname2"})</text>).Width(30);
})
//.HtmlAttributes(new { style = "width: 1100px" })
.Sortable()
.Render();
}
kendo window-
@{Html.Kendo().Window() .Name("window") .Width(500) .Height(315) .Animation(true) .Draggable() .Visible(false) .Modal(true) .Title("Employment Status") .Actions(actions => actions.Close()) .Content(@<text> @using (Html.BeginForm("CreateStatus", "PreEmploymentWorkflow", FormMethod.Post, new { enctype = "multipart/form-data" })) { <table> <tr> <td> @(Html.Kendo().TextBoxFor(m => m.LstPreEmploymentWorkflowModel.PreEmploymentId)) </td> <td> @(Html.Kendo().RadioButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(1).Label("Approved")) </td> <td> @(Html.Kendo().RadioButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(9).Label("Reject")) </td> </tr> <tr> <td> <label class="Bold" for="statusattachment">Status Attachment:</label> </td> <td><input type="file" name="uploadfilestatus"/></td> </tr> <tr> <td> <input id="Button1" type="submit" value="Submit"/> </td> </tr> </table> } </text>) .Render(); }
What I have tried:
As I am new to MVC, I dont know how to do that,or even if it is possible to pass values from grid to window. Thanks.
("[data-button-type='auction']") .click(function(e) { myWindow.data("kendoWindow").open(); myWindow.data("kendoWindow").center(); myWindow.data("kendoWindow").top(); }); </script>
Kendo grid-
@{ Html.Kendo().Grid(Model.LstPreEmploymentWorkflowModellist) .Name("MyGrid") .Columns(col => { //on edir button click action name Main in invoked in PreEmploymentWorkflow controller and PreEmploymentId is passed col.Template(@<text> @Html.ActionLink("Edit", "Main", "PreEmploymentWorkflow", new {Id = item.PreEmploymentId}, new {@class = "classname"})</text>).Width(30); col.Bound(o => o.PreEmploymentId).Visible(false).Groupable(false); col.Bound(o => o.FirstName).Width(30).Groupable(false); col.Template(@<text> @Html.ActionLink("OpenFile", "Openfile", "PreEmploymentWorkflow", new {Id = item.PreEmploymentId, uploadfilename = "EEOC Tracking Form"}, new {@class = "classname3"})</text>).Title("EEOC").Width(30); col.Template(@<text>@(Html.Kendo().Button() .Name("open" + @item.PreEmploymentId) .ImageUrl(Url.Content("/images/auction_16.gif")).HtmlAttributes(new {type = "submit", data_button_type = "auction" }) ) </text>).Width(40).Title("Status"); col.Template(@<text> @Html.ActionLink("Delete", "Delete", "PreEmploymentWorkflow", new {Id = item.PreEmploymentId}, new {@class = "classname2"})</text>).Width(30); }) //.HtmlAttributes(new { style = "width: 1100px" }) .Sortable() .Render(); }
kendo window-
@{Html.Kendo().Window() .Name("window") .Width(500) .Height(315) .Animation(true) .Draggable() .Visible(false) .Modal(true) .Title("Employment Status") .Actions(actions => actions.Close()) .Content(@<text> @using (Html.BeginForm("CreateStatus", "PreEmploymentWorkflow", FormMethod.Post, new { enctype = "multipart/form-data" })) { <table> <tr> <td> @(Html.Kendo().TextBoxFor(m => m.LstPreEmploymentWorkflowModel.PreEmploymentId)) </td> <td> @(Html.Kendo().RadioButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(1).Label("Approved")) </td> <td> @(Html.Kendo().RadioButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(9).Label("Reject")) </td> </tr> <tr> <td> <label class="Bold" for="statusattachment">Status Attachment:</label> </td> <td><input type="file" name="uploadfilestatus"/></td> </tr> <tr> <td> <input id="Button1" type="submit" value="Submit"/> </td> </tr> </table> } </text>) .Render(); }
What I have tried:
As I am new to MVC, I dont know how to do that,or even if it is possible to pass values from grid to window. Thanks.
这篇关于如何在MVC中将值从kendo网格传递到kendo窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!