c# - pass an object to a user controls ViewModel in asp.net mvc -


I have a view that uses a specific view modal.

Various objects of the view modal eg. Foo, bar ... etc.

I have a user control, which has its own view modal in which Foo is the object.

How to pass the Foo object from the page View the usercontrols ViewModel?

If you do this:

  & lt;% HTML .RenderPartial ("partial", model FU); & Gt%;  

Then one of the two things will be.

  1. If the Model.Foo is not of the view , then the user code model < / Code> will be equivalent to Model.Foo , and Model.Foo of Model.Foo of UserControl.
  2. * If the Model.Foo is null of the view, then the model of UserControl model , and Model.Foo of the UserControl will be Model.Foo . If the view's model and models Fu is not the same type and view the model is absent and if the user controller uses the view typed strongly Ugrkantrol models now instead of TViewModel < Code> TUserControlModel

HTML>

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -