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
rathi rathi
NA
19
0
dropdownlist
Jun 14 2006 7:35 AM
private void FillDropDownSQL() { SqlConnection conVendor = new SqlConnection("Data Source=AB2\\SQLEXPRESS;Initial Catalog=Tiger;Integrated Security=True"); SqlCommand comVendor = new SqlCommand("SELECT vendor_name,vendor_code FROM vendor", conVendor); try { conVendor.Open(); DropDownList1.Items.Clear(); SqlDataReader drVendor = comVendor.ExecuteReader(CommandBehavior.CloseConnection); while (drVendor.Read()) { DropDownList1.Items.Add(drVendor[0].ToString()); } } catch (Exception e) { Response.Write(e.ToString());//An error has occurred: " & } conVendor.Close(); } when I give the above method in the page load I am able to see the text part of the dropdownlist . But requirement is that I have to add the vendor_code in the dropdownlist value part . i.e: in the text = vendor_name and value = vender_code. So provide me the guidance to add that.
Reply
Answers (
0
)
Form control with MAC style
How to code Listbox - beginner's help