请帮助MVC3获取此类型的输出 [英] Please help in MVC3 to get this type output

查看:59
本文介绍了请帮助MVC3获取此类型的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其实我是MVC的新手



i想要一个表格让我们说插入城市和同一页面将有网格显示所有城市



如何显示我处理



i卡在同一页面我怎样才能实现网格IEnumerable

哪个会在同一页面上删除选择活动



可以任何人帮助





Actually i am new in MVC

i want one form let say will insert City and same page will have grid will show all City

so how show i processed

i stuck in same page how can i implement grid IEnumerable
which will have delete select activity on same page

can any one help


@model JustDial.Models.tblCityMaster

<table class="MainTable">
        <tr>
        
            <td>@using (Html.BeginForm("Index", "City", FormMethod.Post))
                {
                <table class="Mytable">
                    <tr>
                        <td colspan="2">
                            @Html.LabelFor(model => model.City_Name)
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div class="editor-field">
                                @Html.EditorFor(model => model.City_Name)
                                @Html.ValidationMessageFor(model => model.City_Name)
                            </div>
                        </td>
                    </tr>
                    <tr>
                    <td>
                       <input type="submit" class="ButtonBlue" value="Create" />
                    </td>
                    <td>
                    
                    </td>
                    </tr>
                </table>
                }
            </td>
        </tr>
    </table>










public class CityController : Controller
   {
       JustDialEntities db = new Models.JustDialEntities();
       //
       // GET: /City/

       public ActionResult Index()
       {
           return View(db.tblCityMasters);
       }
       [HttpPost]
       public ActionResult Index(tblCityMaster objCity)
       {
           if (ModelState.IsValid)
           {
               db.tblCityMasters.AddObject(objCity);
               db.SaveChanges();

           }

           return View();
       }

   }

推荐答案

您可以使用Ajax.BeginForm进行添加/编辑/删除使用不同的actionMethods和部分页面应用程序的网格部分视图
You can use Ajax.BeginForm for Add/Edit/Delete with different actionMethods and Partial View for Grid for one page application


这篇关于请帮助MVC3获取此类型的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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