I have the following in knockout
<select multiple="multiple" height="5" data-bind="options:allItems,
selectedOptions:selectedItems"> </select>
The above generates a list of all the items in the "observableArray" in the knockout script.
I need to somehow bind this, almost as if it were an @html.etc element in razor.
For example, I have the following
@using (Html.BeginForm("SubmitFull", "ENCOUNTER", null))
{
@Html.HiddenFor(model => model.Name)
@Html.ValidationSummary(true)
<fieldset>
<legend>ENCOUNTER</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Date)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Date)
@Html.ValidationMessageFor(model => model.Date)
</div>
So when I click the button at the bottom of my page, the model that I defined at the top of the view
@model MVC_MONGODB.Models.PATIENT.Patient
will be loaded up now with a "Date" property and a "Name" property.
I need to also load up with model with the values from the knockout observableArray. I have never done this before, I'm not sure what the best way to do it is, or even any possible way, I'm not even 100% sure it's possible.
http://knockoutmvc.com/ seems like a promising reference.
Using "ValueUpdate" seems like a possibility or maybe a (input type="hidden") element somewhere..
I want to basically have the textbox from the knockout code I mentioned at the top of this question, to act as if it was actually inside
@Html.TextAreaFor(model => model.ChiefComplaintsStr, 5, 100, new {
HtmlAttributes = new { } })