Linking values between inputs or so
So my first explanation was difficult to read nad It was'nt fully cor开发者_开发百科rect as well. I'll try to explain it again. I have a strongly typed view where you enter a number. This view also has several strongly typed partial-views created in a for-loop. Each partial view is strongly typed and the model-item of each partial has a "Number"-property. The value of this property should be the entered number of the "parent"-view. How do I link the value of the entered number with the number property of the partial view model elements.
Thanks for reading.
I'd be creating a property on B
to hold the number of A
. You could have have B
reference an instance of A
.
The view model should encapsulate all of the data needed for the view (or partial view) to render, it sounds like this includes the "property number" of A
on a B
object.
IF I understand your question correctly, you should simply be able to pass the value of the number (integer or decimal) as the Model parameter to the Partial View Call.
Regardless of whether you are returning a partial or calling a render partial, you can pass the model value in.
So
@Html.RenderPartial("ViewName",Model.WhateverTheNumberIsCalledInYourParentModel)
精彩评论