| Author: jeeva 20 Aug 2008 | Member Level: Silver | Rating: Points: 6 |
hai guna i think that this will help ful to you
if (!IsPostBack) { l = 0; if (l == 0) { { con = new SqlConnection("server=localhost;database=river;uid=sa;pwd=sa"); com = new SqlCommand("select distinct(pno) from patientreg", con); da = new SqlDataAdapter(); da.SelectCommand = com;
dt = new DataTable(); int k = 0;
da.Fill(dt); //DropDownList1.Items.Add("ry"); while (k < dt.Rows.Count) { DropDownList1.Items.Add(dt.Rows[k]["pno"].ToString()); k++; } } l = 1; } }
this will show the values in dropdownlist from this you can able to get or select the multiple values
|
| Author: ANIL PANDEY 20 Aug 2008 | Member Level: Diamond | Rating: Points: 3 |
hi,
U can not Select multiple values from a single Drop Down list.
If u want to do so u can use the listBox there u can select multiple values.........
Regards Anil
|
| Author: D.Jeya kumar(JK) 20 Aug 2008 | Member Level: Diamond | Rating: Points: 6 |
hi,
you need to use the listbox for multiple selection.
Here is the code for the list box multiple selection
ListBox1.Items.Add(10) ListBox1.Items.Add(20) ListBox1.Items.Add(30) ListBox1.Items.Add(40) ListBox1.Items.Add(50) ListBox1.Items.Add(60)
to select multiple items you need to set the selection mode property for the list box to Multisimple or multiextended
after selection you can get the multiple values like this
For Each litem As Object In ListBox1.SelectedItems() MsgBox(litem) Next
Regards JK
|