如何在没有提交表格的情况下将Webgrid绑定到下拉列表中的选定索引在Mvc 4中。 [英] How Do I Bind Webgrid On Selectedindex Of Dropdown Without Submit Form In Mvc 4.

查看:48
本文介绍了如何在没有提交表格的情况下将Webgrid绑定到下拉列表中的选定索引在Mvc 4中。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下拉代码

Dropdown code

@Html.DropDownListFor(model => model.Cbranch_courseCode, ViewData["ddlCourse"] as List<SelectListItem>, "--Select Course Group--", new { @class = "form-control",required = "required" })





Webgrid



Webgrid

@{
                   var grid = new WebGrid(Model.listCbranchmasters, canPage: true, rowsPerPage: 5, selectionFieldName: "selectedRow", ajaxUpdateContainerId: "gridContent");
                   grid.Pager(WebGridPagerModes.NextPrevious);}
                               <div  id="gridContent">
                                       @grid.GetHtml(tableStyle: "webGrid",
                                        headerStyle: "header",
                                        alternatingRowStyle: "alt",
                                       selectedRowStyle: "select",
                                       columns: grid.Columns(
                                       grid.Column("Cbranch_code", "ID"),
                                       //grid.Column("Bank Name",format: (item) => item.GetSelectLink(item.Bbranch_eName)),
                                       grid.Column("Course_GroupName_E", "Course Group Name",style: "description"),
                                       grid.Column("Cbranch_eName", "Course Branch Name(English) "),
                                       grid.Column("Cbranch_hName", "Course Branch Name(Hindi)"),
                                       grid.Column("Cbranch_length_in_year", "Course Duaration"),
                                       grid.Column("Cbranch_Type", "Course Type"),
                                       grid.Column("Edit",format: @<text><a href="/Admin/CourseBranchMaster?itemId=@item.Cbranch_code"><img src="~/Content/Image/Text-Edit.png" /></a></text>)
                                 ))

推荐答案

是的。这就是为什么说你去jquery库中可用的ajax post方法。试着看看这些

http://stackoverflow.com/questions/ 12421922 / jquery-ajax-and-mvc4 [ ^ ]

使用Jquery ajax在asp.net MVC中进行GET,POST,PUT,DELETE [ ^ ]



希望它有所帮助。
Yes. That's why saying you to go for ajax post method available in jquery library. Try and have look on these
http://stackoverflow.com/questions/12421922/jquery-ajax-and-mvc4[^]
Do GET, POST, PUT, DELETE in asp.net MVC with Jquery ajax[^]

Hope it helps.


这篇关于如何在没有提交表格的情况下将Webgrid绑定到下拉列表中的选定索引在Mvc 4中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆