Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
customerdata cd = new customerdata;
datatable dt = cd.FgetCustomertype();

fgetcustomertype() returns the datatable and how to represent the datatable in dropdownlist?

Help help.
Posted
Updated 4-May-12 18:06pm
v2

Hi,
You can use ViewData object to send the data to the page.

Controller:
C#
ViewData["Table"]=dt;


View:
C#
DataTable dt=ViewData["Table"];
ddlCountry.DataSource=dt;
ddlCountry.DataValueField="Code";
ddlCountry.DataTextField="Description";


-AK
 
Share this answer
 
Comments
sajan064 5-May-12 20:57pm    
hello amit kmr sinha please tell me in deply bcoz m new to mvc3 frame work

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