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
Deepali Patil
NA
142
56.1k
HI. I trying to populate dropdownlist with values in the database in asp.net. But its not working:(
Oct 13 2012 3:53 AM
Here is my code:
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[0].ConnectionString);
SqlCommand cmd = new SqlCommand("select * from Student1", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
drpdownlist.DataTextField = ds.Tables[0].Columns["FullName"].ToString();
drpdownlist.DataValueField = ds.Tables[0].Columns["Id"].ToString();
drpdownlist.DataSource = ds.Tables[0];
drpdownlist.DataBind();
Its giving problem for the first line.
Please help.
Reply
Answers (
5
)
adding namespace to datacontract results null value in WCF request
get value of gridview cell on button click