[RESOLVED]Rendering Partial View's

Hi all_

I have a scenario where i need to display partial view’s on main view depending on some business logic that i am getting from an Entity Model.

to make this a bit clear, think that i have table 

Create Table tblUsers
(UserId int Not Null Primary Key,
WidgetA bit,WidgetB bit,WidgetC bit)

so WidgetA,B,C… are partial views on my MVC application depending on the userid i will turn the bit operators and i will decide  whether to display the respective widget i.e partial view .

so how can i achieve the above scenario, please can anyone shed some light or any sample code.

appreciate your response,

Jeeva.

create a table like below 

Create Table tblUsers
(UserId int Not Null Primary Key,
Widget char(1)) –if you design a table like this , in future if widget get increased you can simply insert  the value , 

and insert Widget like below

USERID Widget

1             A

2             A

3             C

4             B 

5             C

6             B

and then select the table based on userid it will give you widget like below

Select widget from tblUser where userId = 3

Output :-

widget

C

so based on the value you can choose the partial view

Thanks,

Senthil

can you post the sample code like how to create an entity based off the table and display the widgets(partial view’s).

i need Mvc code and entity framework code if possible.

thanks,

Jeeva

Hi jeeva99,

Thanks for your post.

jeeva99

can you post the sample code like how to create an entity based off the table and display the widgets(partial view’s).

There’s a sample,please check this:

Using jQuery for displaying ASP.NET MVC Partial View to Perform Edit Operation

Hope this can be helpful.

Best Regards,

Eileen

Leave a Reply