asp .net MVC 2.0 xval Validation element - asp.net-mvc-2

I got one problem with showing error message to element.
Is there any option to turn on messages on place where is Html.ValidationMessageFor(model => model.ConfirmPassword). Becsoue for me it isn’t show up. I would like to have summary and near field information too not only red border. Any one know how to do it?
using (Ajax.BeginForm("CreateValidForm", "Test", new AjaxOptions { HttpMethod = "Post" })) {%> <div id="validationSummary1">
<%= Html.ValidationSummary(true)%> </div> <fieldset>
<legend>Fields</legend>
<div class="editor-label">
<%= Html.LabelFor(model => model.Name)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.Name)%>
<%= Html.ValidationMessageFor(model => model.Name)%>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.Email)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.Email)%>
<%= Html.ValidationMessageFor(model => model.Email)%>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.Password)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.Password)%>
<%= Html.ValidationMessageFor(model => model.Password)%>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.ConfirmPassword)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.ConfirmPassword)%>
<%= Html.ValidationMessageFor(model => model.ConfirmPassword)%>
</div>
<p>
<input type="submit" value="Create" />
</p> </fieldset> <% } %> <%= Html.ClientSideValidation<ValidModel>()
.UseValidationSummary("validationSummary1", "Please fix the following problems:") %>
Here is link for sample project http://www.sendspace.com/file/m9gl54 .

Related

Ruby on Rails. How to combine a search form with bootstrap style?

How to combine this search form
<%= form_tag index_path, :method => 'get' do %>
<%= text_field_tag :search, params[:search]%>
<%= submit_tag "search", :title => nil %>
<% end %>
with this bootstrap style
<div class="row">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">search</button>
</span>
</div>
</div>
You can add any class you like to any Rails form tag. You just need to be careful that your method call matches one of the valid call signatures for the tag helper. For instance, the API for the form tag is documented here.
Here is my take on combining the above. This may need some tuning:
<div class="row">
<%= form_tag index_path, :method => 'get', class: 'input-group' do %>
<%= text_field_tag :search, params[:search], class: 'form-control', placeholder: 'Search for...' %>
<span class="input-group-btn">
<%= submit_tag "search", class: "btn btn-default" %>
</span>
<% end %>
</div>

MVC2 Entity Framework - Update Model

First of all, am I the only developer on the planet that is attempting to use MVC with VB? I have searched tons of forums and read many posts and everyone that asks a question gives an example in C#. Anyway, now that I've got that out of the way, I've got a simple database table (User) with some columns (UserId, Username, FirstName, LastName). I am using the entity framework and on my edit view, I'm changing a value (Username) and clicking Save. In my Edit http post, I tell it to return to the Index and the value was not saved. Although, in my constructor for the http post, I return the object and it shows the new value...but that value doesn't make it to the db...any help?
My Controller:
Function Edit(ByVal ID As Guid) As ActionResult
'get the user
Dim usr = (From u In db.Users
Where u.UserId = ID
Select u).Single
Return View(usr)
End Function
<HttpPost()> _
Function Edit(ByVal ID As Guid, ByVal usrInfo As User, ByVal formValues As FormCollection) As ActionResult
' Dim usr As User = db.Users.Single(Function(u) u.UserId = ID)
If ModelState.IsValid Then
TryUpdateModel(usrInfo, "User")
Return RedirectToAction("Index")
Else
Return View(usrInfo)
End If
End Function
My view:
<h2>Edit</h2>
<%-- The following line works around an ASP.NET compiler warning --%>
<%: ""%>
<% Using Html.BeginForm() %>
<%: Html.ValidationSummary(True) %>
<fieldset>
<legend>Fields</legend>
<div class="editor-label">
<%: Html.LabelFor(Function(model) model.UserId) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(Function(model) model.UserId) %>
<%: Html.ValidationMessageFor(Function(model) model.UserId) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(Function(model) model.Username) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(Function(model) model.Username) %>
<%: Html.ValidationMessageFor(Function(model) model.Username) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(Function(model) model.FirstName) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(Function(model) model.FirstName) %>
<%: Html.ValidationMessageFor(Function(model) model.FirstName) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(Function(model) model.LastName) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(Function(model) model.LastName) %>
<%: Html.ValidationMessageFor(Function(model) model.LastName) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(Function(model) model.CreatedDate) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(Function(model) model.CreatedDate, String.Format("{0:g}", Model.CreatedDate)) %>
<%: Html.ValidationMessageFor(Function(model) model.CreatedDate) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(Function(model) model.CreatedBy) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(Function(model) model.CreatedBy) %>
<%: Html.ValidationMessageFor(Function(model) model.CreatedBy) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(Function(model) model.LastLogin) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(Function(model) model.LastLogin, String.Format("{0:g}", Model.LastLogin)) %>
<%: Html.ValidationMessageFor(Function(model) model.LastLogin) %>
</div>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
<% End Using %>
<div>
<%: Html.ActionLink("Back to List", "Index") %>
</div>
Ok, so, aparently I AM the only VB developer using MVC. Anyway, I found the answer. It was in one of the beginner tutorials for MVC on the ASP.Net Site (Found Here). The answer was to change my Edit function (HttpPost) so that it utilizes the formvalues that were posted:
<HttpPost()> _
Function Edit(ByVal id As Guid, ByVal collection As FormCollection) As ActionResult
Dim rest = (From r In db.Restaurants
Where r.RestaurantId = id
Select r).Single()
Try
TryUpdateModel(rest, collection.ToValueProvider())
db.SaveChanges()
Return RedirectToAction("Index")
Catch
Return View(rest)
End Try
End Function

ASP.NET MVC 2 compile error with partial views

Yet another compile error for me:
Error 1 'Model' conflicts with the declaration 'System.Web.Mvc.ViewUserControl.Model' c:\Users\Kevin\Documents\Visual Studio 2010\Projects\HandiGamer\HandiGamer\Views\Shared\EditorTemplates\AdminGameReviewViewModel.ascx 10 51 HandiGamer.WebUI
I'm trying to use a partial view to handle both Create and Edit functionality. So, my Create view is:
<%# Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<HandiGamer.WebUI.ViewModels.AdminGameReviewViewModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Create New Review
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Create New Review</h2>
<% using (Html.BeginForm()) {%>
<%: Html.ValidationSummary(true) %>
<fieldset>
<legend>Create New Review</legend>
<%: Html.EditorForModel() %>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
<% } %>
<div>
<%: Html.ActionLink("Back to Menu", "Index") %>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="CSSandJavaScript" runat="server">
</asp:Content>
And the partial view is:
<%# Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<HandiGamer.WebUI.ViewModels.AdminGameReviewViewModel>" %>
<p>
<%: Html.Label("Game Title") %>
<%: Html.TextBoxFor(Model => Model.GameData.GameTitle) %>
<%: Html.ValidationMessageFor(Model => Model.GameData.GameTitle) %>
</p>
<p>
<%: Html.LabelFor(Model => Model.GameData.Genre) %>
<%: Html.DropDownList("Genre", new SelectList(Model.AllGenres, "GenreID", "Name", Model.GameData.GenreID)) %>
</p>
<p>
<%: Html.Label("Platforms") %><br />
<% for (int i = 0; i < Model.AllPlatforms.Count(); ++i) { %>
<%: Model.AllPlatforms[i].Platform.Name %> <%: Html.CheckBoxFor(plat => plat.AllPlatforms[i].IsSelected)%><br />
<% } %>
</p>
<p>
<%: Html.Label("Review Title") %>
<%: Html.TextBoxFor(model => model.GameData.Content.Title) %>
</p>
<p>
<%: Html.Label("Review") %>
<%: Html.TextAreaFor(model => model.GameData.Content.Text) %>
</p>
<p>
<%: Html.Label("Review Score") %>
<%: Html.DropDownList("Score", new SelectList(new int[] {1, 2, 3, 4, 5}, "ReviewScore")) %>
</p>
<p>
<%: Html.LabelFor(model => model.GameData.Pros) %><br />
<%: Html.TextBox("Pros[]") %><br />
<%: Html.TextBox("Pros[]") %><br />
<%: Html.TextBox("Pros[]") %><br />
<%: Html.TextBox("Pros[]") %><br />
<%: Html.TextBox("Pros[]") %>
</p>
The line in question is the one that attempts to create the first DropDownList, specifically when I write Model.AllGeneres. That invocation of Model is what's throwing the error. It's confusing since none of the other attempts to access Model trigger an error.
The first few html helpers in your partial are using the capital 'Model' instead of lowercase 'model' for the lambda parameter. You have
<%: Html.TextBoxFor(Model => Model.GameData.GameTitle) %>
But it should be
<%: Html.TextBoxFor(model => model.GameData.GameTitle) %>

Define EditorTemplate for child collection in viewmodel

I've got a model which contains a List of QuestionEditModel for which I want to use an EditorFor.
Normally, I would just call EditorFor on the collection and MVC will do the rest. However, I need the individual QuestionEditModel to use different EditorTemplates depending on the value of a field within the object.
I would've thought that the method for doing this would be something like
<%: Html.EditorFor(model=>model.Questions), [fieldname from individual question] %>
but I cannot figure out how to tell it to look at the Question which is currently selected and use the EntryType field from the question to determine which EditorTemplate to use.
So I tried this
<% foreach (Reviewer.Models.QuestionEditModel qem in Model.Questions)
{
Html.EditorFor(q=>qem, qem.EntryType, null);
} %>
but this doesn't render anything on to the page. The odd thing is that if I set a breakpoint and run over the code, this does call the correct EditorTemplate, the correct model data is passed in and there are no exceptions, but it just doesn't render anything.
Is there some additional work I need to do in this scenario to get the rendered EditorTemplate back in to my page?
EDIT:
Full code of the Edit View.
<% using (Html.BeginForm()) {%>
<%: Html.ValidationSummary(true) %>
<%: Html.HiddenFor(model=>model.AcadPeriod) %>
<%: Html.HiddenFor(model=>model.ReviewID) %>
<%: Html.HiddenFor(model=>model.ReviewName) %>
<%: Html.HiddenFor(model=>model.CategoryID) %>
<%: Html.HiddenFor(model=>model.CategoryName) %>
<%-- Categories not getting returned in model for some reason. Use EditorFor or DisplayFor instead of loop? --%>
<%: Html.HiddenFor(model=>model.Categories) %>
<%: Html.HiddenFor(model=>model.ClassificationID) %>
<%: Html.HiddenFor(model=>model.ClassificationName) %>
<div style="width:100%">
<div style="float:left">
<ul style="list-style-type:none">
<% for (int i = 0; i < Model.Categories.Count(); i++)
{ %>
<li style="background-color:Gray; border: 1px solid black; padding: 3px 3px 3px 3px; margin-bottom: 2px">
<%: Html.ActionLink(Model.Categories[i].name, "Edit", new { AcadPeriod = Model.AcadPeriod, ClassificationID=Model.ClassificationID, ReviewID=Model.ReviewID, CategoryID=Model.Categories[i].category_id })%>
</li>
<% }%>
</ul>
</div>
</div>
<% foreach (Reviewer.Models.QuestionEditModel qem in Model.Questions) { %>
<%: Html.EditorFor(q=>qem, qem.EntryType,null); %>
<% } %>
<p>
<input type="submit" value="Save" />
</p>
<% } %>
EDIT 2:
Complete View, Controller, and Template code as requested.
<%# Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Reviewer.Models.ReviewEditModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Edit
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h1><%: Model.AcadPeriod %> > <%: Model.ClassificationName %> > <%: Model.ReviewName %></h1>
<% using (Html.BeginForm()) {%>
<%: Html.ValidationSummary(true) %>
<%: Html.HiddenFor(model=>model.AcadPeriod) %>
<%: Html.HiddenFor(model=>model.ReviewID) %>
<%: Html.HiddenFor(model=>model.ReviewName) %>
<%: Html.HiddenFor(model=>model.CategoryID) %>
<%: Html.HiddenFor(model=>model.CategoryName) %>
<%-- Categories not getting returned in model for some reason. Use EditorFor or DisplayFor instead of loop? --%>
<%: Html.HiddenFor(model=>model.Categories) %>
<%: Html.HiddenFor(model=>model.Questions) %>
<%: Html.HiddenFor(model=>model.ClassificationID) %>
<%: Html.HiddenFor(model=>model.ClassificationName) %>
<div style="width:100%">
<div style="float:left;width: 15%">
<ul style="list-style-type:none">
<% for (int i = 0; i < Model.Categories.Count(); i++)
{ %>
<li style="background-color:Gray; border: 1px solid black; padding: 3px 3px 3px 3px; margin-bottom: 2px">
<%: Html.ActionLink(Model.Categories[i].name, "Edit", new { AcadPeriod = Model.AcadPeriod, ClassificationID=Model.ClassificationID, ReviewID=Model.ReviewID, CategoryID=Model.Categories[i].category_id })%>
</li>
<% }%>
</ul>
</div>
<div style="float:left; width: 80%; margin-left: 5px">
<% foreach (Reviewer.Models.QuestionEditModel qem in Model.Questions) { %>
<%: Html.EditorFor(q=>qem, qem.EntryType,null) %>
<% } %>
</div>
</div>
<div style="clear:both" />
<p>
<input type="submit" value="Save" />
</p>
<% } %>
<div>
<%: Html.ActionLink("Back to List", "Index") %>
</div>
</asp:Content>
Editor Template:
<%# Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Reviewer.Models.QuestionEditModel>" %>
<div style="width:100%; border: 1px solid black">
<div style="width: 100%; border: 1px solid black"><h2><%: Model.QuestionName %></h2></div>
<div style="width:25%; display:inline; border: 1px solid black; float:left">
<%: Model.QuestionText %>
</div>
<div style="width:70%; border: 1px solid black; float:left">
<%: Html.TextAreaFor(model=>model.Answer) %>
<%:Html.ValidationMessageFor(model=>model.Answer) %>
</div>
<div style="clear:both" />
</div>
<fieldset>
<legend>TEXT</legend>
<div class="editor-label">
<%: Html.LabelFor(model => model.QuestionID) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.QuestionID) %>
<%: Html.ValidationMessageFor(model => model.QuestionID) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.QuestionName) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.QuestionName) %>
<%: Html.ValidationMessageFor(model => model.QuestionName) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.QuestionText) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.QuestionText) %>
<%: Html.ValidationMessageFor(model => model.QuestionText) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.DefaultText) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.DefaultText) %>
<%: Html.ValidationMessageFor(model => model.DefaultText) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.EntryType) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.EntryType) %>
<%: Html.ValidationMessageFor(model => model.EntryType) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.HelpText) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.HelpText) %>
<%: Html.ValidationMessageFor(model => model.HelpText) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.Answer) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.Answer) %>
<%: Html.ValidationMessageFor(model => model.Answer) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.OptionValue) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.OptionValue) %>
<%: Html.ValidationMessageFor(model => model.OptionValue) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.completedBy) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.completedBy) %>
<%: Html.ValidationMessageFor(model => model.completedBy) %>
</div>
Option Required: <%:Html.TextBoxFor(model=>model.OptionRequired) %>
Answer Required: <%: Html.TextBoxFor(model=>Model.AnswerRequired) %>
</fieldset>
Edit(GET) Action:
public ActionResult Edit(string AcadPeriod, string ClassificationID, string ReviewID, int CategoryID)
{
Reviewer.Models.ReviewEditModel dset1 = rr.GetReviewEditModel(AcadPeriod, ReviewID, CategoryID.ToString(), ClassificationID);
return View(dset1);
}
Edit(POST) Action:
[HttpPost]
public ActionResult Edit(Reviewer.Models.ReviewEditModel model)
{
try
{
foreach (Reviewer.Models.QuestionEditModel qem in model.Questions)
{
if (qem.Answer == null || qem.OptionValue == null) { qem.completedBy = this.HttpContext.User.Identity.Name; }
}
if (ModelState.IsValid)
{
rr.SaveReviewEditModel(model);
return RedirectToAction("Index");
}
else { return View(model); }
}
catch
{
return View(model);
}
}
You have to tell it what to actually render (<%: %>):
<% foreach (Reviewer.Models.QuestionEditModel qem in Model.Questions) { %>
<%: Html.EditorFor(q=>qem, qem.EntryType, null) %>
<% } %>

Entity Framework persistence problem giving "The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type.."

In the database I have have:
PK CountryID int notnull
PK ServiceID int notnull
PK TaskID int notnull
PK TaskItemID int notnull
PK CorrespondentID int notnull
PK PreviousTask int notnull
IsOnTimeline bit not null
..and 5 other nullable fields
I am using this composite key to ensure uniqueness of the "ServiceSchedule" item. The "Previoustask" field being a concatenation of all the PKs, the idea being that I can build a granular "ServiceSchedule" tasks timeline related from record to record.
The context is:
UPEntities db = new UPEntities(); for all workings here (i.e. repository and db).
The two Edit controller actions look like this:
public ActionResult Edit(int countryid,
int serviceid,
int taskid,
int taskitemid,
int correspondentid)
{
var t = (from s in repository.GetServiceSchedules()
where s.CountryID == countryid
where s.ServiceID == serviceid
where s.TaskID == taskid
where s.TaskItemID == taskitemid
where s.CorrespondentID == correspondentid
select s).First();
return View(t);
}
[HttpPost]
public ActionResult Edit(ServiceSchedule serviceToEdit)
{
var originalService = (from s in repository.GetServiceSchedules()
where s.CountryID == serviceToEdit.CountryID
where s.ServiceID == serviceToEdit.ServiceID
where s.TaskID == serviceToEdit.TaskID
where s.TaskItemID == serviceToEdit.TaskItemID
where s.CorrespondentID == serviceToEdit.CorrespondentID
select s).First();
if (!ModelState.IsValid)
return View(originalService);
db.ApplyPropertyChanges(originalService.EntityKey.EntitySetName, serviceToEdit); //Code throws exception here.......
db.SaveChanges();
return RedirectToAction("Index");
}
Everything seems to work OK up to the "db.ApplyPropertyChanges" line and there I get the error:
The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type 'ProjectName.Models.ServiceSchedule'.
I have noticed that the model passed into the Edit View contains the collections from the related table (e.g. the countries collection off the CountryID) but when the model returns from the view it contains only the PK IDs from the "ServciceSchedule" table and no related collections.
I am currently trying to counter this problem by creating hiddenfors in the view like this but still cant seem to get the complete model back into the controller:
<% using (Html.BeginForm())
{%>
<%= Html.ValidationSummary(true)%>
<fieldset>
<legend>Fields</legend>
<div class="editor-label">
<%= Html.HiddenFor(model => model.CountryID)%>
</div>
<div class="editor-label">
<%= Html.HiddenFor(model => model.ServiceID)%>
</div>
<div class="editor-label">
<%= Html.HiddenFor(model => model.TaskID)%>
</div>
<div class="editor-label">
<%= Html.HiddenFor(model => model.TaskItemID)%>
</div>
<div class="editor-label">
<%= Html.HiddenFor(model => model.CorrespondentID)%>
</div>
<div class="editor-label">
<%= Html.HiddenFor(model => model.Services)%>
</div>
<div class="editor-label">
<%= Html.HiddenFor(model => model.Tasks)%>
</div>
<div class="editor-label">
<%= Html.HiddenFor(model => model.TaskItems)%>
</div>
<div class="editor-label">
<%= Html.HiddenFor(model => model.Correspondents)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.PreviousTask)%>
<%= Html.ValidationMessageFor(model => model.PreviousTask)%>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.Cost)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.Cost, String.Format("{0:F}", Model.Cost))%>
<%= Html.ValidationMessageFor(model => model.Cost)%>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.ChargeOut)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.ChargeOut, String.Format("{0:F}", Model.ChargeOut))%>
<%= Html.ValidationMessageFor(model => model.ChargeOut)%>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.DurationInDays)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.DurationInDays, String.Format("{0:F}", Model.DurationInDays))%>
<%= Html.ValidationMessageFor(model => model.DurationInDays)%>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.JobSection)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.JobSection)%>
<%= Html.ValidationMessageFor(model => model.JobSection)%>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.JobSectionGroup)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.JobSectionGroup)%>
<%= Html.ValidationMessageFor(model => model.JobSectionGroup)%>
</div>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
<% } %>
Also the GetServiceSchedules Repository looks like this:
public class ServicesRepository
{
UPEntities db = new UPEntities();
public List<ServiceSchedule> GetServiceSchedules()
{
return db.ServiceScheduleSet.Include("Countries")
.Include("Services")
.Include("Tasks")
.Include("TaskItems")
.Include("Correspondents")
.ToList();
}
}
(using VS 2008, SQL 2008, MVC2)
Can anyone let me know some more suggeted remedies?