Здравствуйте, RushDevion, Вы писали:
RD>Речь об MVC я так понимаю?
RD>Неплохо было бы, конечно, на код View взглянуть для ясности.
RD>Ну скорей всего дело в том, что MVC понятия не имет, как заполнять твой список Model из данных реквеста.
RD>Нужно написать свой ModelBinder.
RD>Пример тут
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<russian_promo.Models.MainModel>" %>
<%@ Import Namespace="russian_promo.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Sape
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% using (Html.BeginForm())
{ %>
<h2>Sape-задачи</h2>
<!--Таб меню-->
<table>
<tr>
<td> <%: Html.ActionLink("Добавить задачу", "SapeAdd", "Sape")%></td>
<td> <%: Html.ActionLink("Сохранить изменения", "SapeChangesSave", new { model=(MainModel)ViewData.Model })%></td>
<td> <%: Html.ActionLink("Оценка качества", "SapeManagerMurks", "Sape")%></td>
</tr>
</table>
<!--Таб меню-->
<br />
<input id="Submit1" type="submit" value="Сохранить" />
<br />
<%:Html.TextBoxFor(model=>model.str) %>
<%:Html.HiddenFor(model=>model.ListProject) %>
<table class="myTable">
<%for (int i = 0; i < ViewData.Model.ListProject.Count; i++)
{%>
<%Guid projectId = ViewData.Model.ListProject.ElementAt(i).ProjectId; %>
<%:Html.HiddenFor(model=>model.ListProject.ElementAt(i).ProjectId) %>
<tr>
<td >
<%:Html.DisplayTextFor(model => model.ListProject.ElementAt(i).ProjectName)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ProjectName)%>
</td>
<td >
<%:Html.ActionLink(ViewData.Model.ListProject.ElementAt(i).SAPEManager, "SapeManager", new { projectId = ViewData.Model.ListProject.ElementAt(i).ProjectId })%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).SAPEManager)%>
</td>
<td >
<%=Html.Encode(ViewData.Model.ListProject.ElementAt(i).SEO)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).SEO)%>
</td>
<td class="MyTablePadding">
<table class="myTable1">
<%List<SapeTasks> SapeTaskForProject = (List<SapeTasks>)ViewData.Model.ListProject.ElementAt(i).ListProjectSape; %>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape)%>
<%for (int j = 0; j < SapeTaskForProject.Count; j++)
{%>
<tr>
<td>
<%=Html.Encode(SapeTaskForProject.ElementAt(j).DateFirstDay)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).DateFirstDay)%>
</td>
<td>
<%:Html.ActionLink(SapeTaskForProject.ElementAt(j).TaskFile.ToString(), "SapeTask", new { SAPEtaskId = SapeTaskForProject.ElementAt(i).Id })%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).TaskFile)%>
</td>
<td>
<%=Html.Encode(SapeTaskForProject.ElementAt(j).CountLinks)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).CountLinks)%>
</td>
<td>
всего
</td>
<td>
<%:Html.TextBoxFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).LinkAddToday)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).LinkAddToday)%>
</td>
<td>
<%:Html.TextBoxFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).LinkDeleteToday)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).LinkDeleteToday)%>
</td>
<td>
<%string Dateflag = SapeTaskForProject.ElementAt(j).DateStartBay.ToString();
string Datestatus = "";
switch (Dateflag)
{
case "01.01.0001 0:00:00":
Datestatus = "//-----//";
break;
default:
Datestatus = SapeTaskForProject.ElementAt(j).DateStartBay.ToString();
break;
}
%>
<%=Html.Encode(Datestatus)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).DateStartBay)%>
</td>
<td>
<%string Dateflag1 = SapeTaskForProject.ElementAt(j).DateEndBay.ToString();
string Datestatus1 = "";
switch (Dateflag1)
{
case "01.01.0001 0:00:00":
Datestatus1 = "//-----//";
break;
default:
Datestatus1 = SapeTaskForProject.ElementAt(j).DateEndBay.ToString();
break;
}
%>
<%=Html.Encode(Datestatus1)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).DateEndBay)%>
</td>
<td>
<%string Dateflag2 = SapeTaskForProject.ElementAt(j).DateLastDay.ToString();
string Datestatus2 = "";
switch (Dateflag2)
{
case "01.01.0001 0:00:00":
Datestatus2 = "//-----//";
break;
default:
Datestatus2 = SapeTaskForProject.ElementAt(j).DateLastDay.ToString();
break;
}
%>
<%=Html.Encode(Datestatus2)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).DateLastDay)%>
</td>
<td>
<%int flag = SapeTaskForProject.ElementAt(j).status;
string status = "";
switch (flag)
{
case 0:
status = "Новая";
break;
case 1:
status = "В работе";
break;
case 2:
status = "На проверке";
break;
case 3:
status = "Завершено";
break;
}
%>
<%=Html.Encode(status)%>
<%:Html.HiddenFor(model => model.ListProject.ElementAt(i).ListProjectSape.ElementAt(j).status)%>
</td>
</tr>
<% } %>
</table>
</td>
</tr>
<% } %>
</table>
<%} %>
</asp:Content>