C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




dropdown asp.net control


Posted Date: 20 Aug 2008      Total Responses: 3

Posted By: gunapandian       Member Level: Bronze     Points: 1


how we can select a multiple values in dropdown.



Responses

Author: jeeva    20 Aug 2008Member Level: SilverRating:     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 2008Member Level: DiamondRating:     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 2008Member Level: DiamondRating:     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



Post Reply
You must Sign In to post a response.
Next : can anyone solve this issue?
Previous : when we have to call dispose and finalize method in asp.net?
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

internet fax

Contact Us    Privacy Policy    Terms Of Use