Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all,

I have three tables as BillingHead, BillingType, BillingSubType. All they have ID`s as primary key and names respectively. BillingHeadID is an foreign key for constraint for BillingType table, and BillingTypeID is an Foreign Key Constraint for BillingSubType.

Now I want an dropdown list of BillingHead names into Create View of Billing Type and BillingType name into BiullingSubType.

I am using the MVC 5 and EntityFramework6. And also using database first method.
Posted

1 solution

 
Share this answer
 
Comments
DT_2 28-Apr-14 6:12am    
Abhinav, I am new on MVC, and all the above link I know. that is not the solution. How can I directly do that with ViewBag?

In my BillingTypeController.cs I write following

ViewBag.Names = _entities.BillingHeads.OrderBy(b => b.Name).ToList();

How Can I retreive data from above in View?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900