首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

MVC2 Views 传值到Controller有关问题

2013-04-24 
MVC2 Views 传值到Controller问题先上代码%@ Page Title LanguageC# MasterPageFile~/Views/Shar

MVC2 Views 传值到Controller问题
先上代码
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcSMC.Models.PageData<MvcSMC.Models.Account>>" %>
第二段代码
 <div class="div_search">    
    <% using (Html.BeginForm()) { %>
   <table border="0" cellpadding="0" cellspacing="1">
                        <tr>
                            <td class="align_right">客户姓名:</td>
                            <td class="align_left search_filed">
                                <%: Html.TextBoxFor(m => m.PageIndex)%> <%--//MODEL传值应该是ACCOUNT表的--%>                            </td>
                            <td class="align_right">客户账号:</td>
                            <td class="align_left search_filed">
                                <%: Html.TextBoxFor(m => m.Count)%>                            </td>
                            <td class="align_center">
                                <input id="Button1" type="button" value="查询" />
                            </td>
                        </tr>
                    </table>
    <% } %>
    </div>

第三段代码
<% foreach (var item in Model.GetDate) { %>
    
        <tr>
            
            <td class="list_content_td">
                <%: item.AccountId %>


            </td>
            <td class="list_content_td">
                <%: item.AccountName %>
            </td>
            <td class="list_content_td">
                <%: String.Format("{0:g}", item.AddTime) %>
            </td>
            <td class="list_content_td">
                <%: item.EmailAddress %>
            </td>
            <td class="list_content_td">
                <%: item.AccountNum %>
            </td>
            <td class="list_content_td">
                <%: Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) %> |
                <%: Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ })%> |
                <%: Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })%>
            </td>
        </tr>
    
    <% } %>


请注意下蓝色字,红色获取的是PageDate的属性字段,需要传递的是Accpount的属性字段 MVC C# Views
[解决办法]
http://blog.csdn.net/kufeiyun/article/details/7707860

热点排行