*** below is still not right, needs more work
in the controller create
string id is passed in to be the key to retrieve the event id
then pass to registration model (create a new mode), so registration can contain the event name and id. but I need to make even name can not be modified on the create view for registration, so make it readonly...
// GET: Registration/Create
public ActionResult Create(string id)
{
MSWEvent mswEvent = new MSWEvent();
mswEvent = repository.FindMSWEvent(new MongoDB.Bson.ObjectId(id));
string mswEventName = mswEvent.Name;
//ViewBag.MSWEventsList = mswEvents = GetMSWEventslist();
ViewBag.mswEventName = mswEventName;
Registration reg = new Registration();
reg.MSWEventName = mswEventName;
return View(reg);
}
in the create view
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.MSWEventName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextBoxFor(model => model.MSWEventName, new {@disabled = "disabled", @readonly = "readonly", htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.MSWEventName, "", new { @class = "text-danger" })
</div>
</div>
No comments:
Post a Comment