MVC2 Views 传值到Controller问题

专爆菜鸟 2013-04-19 04:03:53
先上代码
<%@ 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的属性字段
...全文
244 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
残月照我心 2013-04-23
  • 打赏
  • 举报
回复
http://blog.csdn.net/kufeiyun/article/details/7707860
专爆菜鸟 2013-04-22
  • 打赏
  • 举报
回复
求解决方法呀
专爆菜鸟 2013-04-22
  • 打赏
  • 举报
回复
其实我的意思是在一个VIEW中需要写多个方法,应该怎么做。
专爆菜鸟 2013-04-19
  • 打赏
  • 举报
回复
顶顶别掉下去了

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧