3 Replies - 6073 Views - Last Post: 28 July 2012 - 10:24 AM Rate Topic: -----

#1 menukadevinda  Icon User is offline

  • D.I.C Regular

Reputation: -7
  • View blog
  • Posts: 470
  • Joined: 14-April 11

how to pass 2 models to view + mvc4 asp.net

Posted 27 July 2012 - 01:29 AM

Hi all,

I wanted to create a hirachy grid with telerik controles. I am new to telerik. I use MVVM architechure.

I can passe one modle to view and display content.
but in hirachy view I dont know how to deal with 2 models beacuse by default only one model can be passe to view .

how to solve this. please help
Is This A Good Question/Topic? 0
  • +

Replies To: how to pass 2 models to view + mvc4 asp.net

#2 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 445
  • View blog
  • Posts: 1,501
  • Joined: 28-April 09

Re: how to pass 2 models to view + mvc4 asp.net

Posted 27 July 2012 - 02:52 PM

You could create a class that includes both classes you want to pass to the view and use that as your model
Was This Post Helpful? 0
  • +
  • -

#3 menukadevinda  Icon User is offline

  • D.I.C Regular

Reputation: -7
  • View blog
  • Posts: 470
  • Joined: 14-April 11

Re: how to pass 2 models to view + mvc4 asp.net

Posted 28 July 2012 - 08:06 AM

2 class in one class. can you show me an example code for that

thanks in advance
Was This Post Helpful? 0
  • +
  • -

#4 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 445
  • View blog
  • Posts: 1,501
  • Joined: 28-April 09

Re: how to pass 2 models to view + mvc4 asp.net

Posted 28 July 2012 - 10:24 AM

Just the same as you'd make any class, you're just using your classes as properties instead of string, int or some other premade type.

public class SomeClass
{
    public AClass classOne {get;set;}
    public BClass classTwo {get;set;}
}



Here's a link to a tutorial on using ViewModels.

This post has been edited by Nakor: 28 July 2012 - 10:33 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1