TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sunny Bhor
NA
31
591
Pass Dynamic data to View
Nov 13 2018 1:12 AM
I have mvc web application in which I passed the dynamic data to view which is coming from db context.
Which will be the better approach either use expando object or viewbag/viewdata ?
Current code :
Viewbag.List1 = context.getlist1();
Viewbag.List2 = context.getlist2();
Viewbag.List3 = context.getlist3();
Viewbag.List4 = context.getlist4();
ViewBag.string1 = string1;
ViewBag.string2 = string 2;
I am trying to change code like
dynamic tempModel = new ExpandoObject();
tempModel .List1 = context.getlist1();
tempModel .List2 = context.getlist2();
tempModel .List3 = context.getlist3();
tempModel .List4 = context.getlist4();
tempModel .string1 = string1;
tempModel .string2 = string 2;
And pass tempModel to View.
Reply
Answers (
6
)
Difference between Valid and Invalid Certificates.
After clickon print button from gridview