从webgrid MVC4获取文本框中的值以获取复选框选定的列

时间:2014-12-08 07:11:07

标签: c# jquery asp.net-mvc-4 webgrid

我在partialView中有一个带复选框和TextBox控件的webgrid

@model List<Models.Services.Info.ServiceListDetails>

<div class="grid_content">
                    @grid.GetHtml(
                                 tableStyle: "table", //"gridTable",
                                 headerStyle: "gridHead",       
                        //tableStyle: "table",
                        //headerStyle: "thead",             
                        footerStyle:"gridFooter",
                        rowStyle:"gridRow",                 
                        alternatingRowStyle: "gridAltRow",
                        columns :   grid.Columns(grid.Column(format: @<text> <input type="checkbox" value="@item.Id" name="ids" id="assignChkBx" /> </text>, header: "{checkall}"),
                                    grid.Column("ServiceName",header:"Services", style: "col2"),
                                    grid.Column("ServicelistUnit",header:"Unit",style: "col2"),                    
                                    grid.Column("Quantity",format: (item) => @Html.TextBox("ServicelistQuatity",@item.ServicelistQuatity as object)),
                                    grid.Column("Remarks", format: (item) => @Html.TextBox("ServicelistRemarks", @item.ServicelistRemarks as object))
                            )    
                        )

我需要点击预览按钮

,将输入的值输入到所选列的文本框中

模型

 public class ServiceListDetails
{
    private long mId = 0;
    private long mUserXId = 0;
    private long mSessionXId = 0;
    private string mServicelistQuatity = "";
    private string mServicelistRemarks = "";
    private string mRequestId = "";
    private int mOption = 0;
    private string mServicelistUnit = "";
    private string mServicename = "";

    public long Id
    {
        get { return mId; }
        set { mId = value; }
    }

    public long UserXId
    {
        get { return mUserXId; }
        set { mUserXId = value; }
    }

    public long SessionXId
    {
        get { return mSessionXId; }
        set { mSessionXId = value; }
    }

    public string RequestId
    {
        get { return mRequestId; }
        set { mRequestId = value; }
    }

   public string ServicelistQuatity
    {
        get { return mServicelistQuatity; }
        set { mServicelistQuatity = value; }
    }

    public string ServiceName
    {
        get { return mServicename; }
        set { mServicename = value; }
    }

    public string ServicelistRemarks
    {
        get { return mServicelistRemarks; }
        set { mServicelistRemarks = value; }
    }

    public string ServicelistUnit
    {
        get { return mServicelistUnit; }
        set { mServicelistUnit = value; }
    }

}

控制器

   public ActionResult PreviewSerReqs(FormCollection form)
   {
      return View();
   }

我实际上是MVC新手。如何在单击“预览”按钮时从文本框中捕获数据。 请任何帮助真的很感激。

感谢名单

0 个答案:

没有答案