Click here to Skip to main content
15,888,333 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to select more than one checklist box in the checklistbox using window checklistbox tool.
Posted
Comments
SRK90 8-Aug-14 5:55am    
Can you please explain some more to get clear idea of what you are trying?
Member 10891595 8-Aug-14 6:07am    
sir i m a fresher now and start to learn .net

dear sir i have checklistbox and have more than one item in that checklistbox
now i want to check(select) more than one item in the checklistbox and provide the some condition on that when i finish checking
SRK90 8-Aug-14 6:10am    
So you mean you have multiple checklist box and you need to access methos based on N number of checklist box got selected? ... Please correct me if i am worng.
Member 10891595 8-Aug-14 6:28am    
yes sir i have two checklist box in first checklistbox1 i have some items(like fullname,address etc) in it same for the checklistbox2 i have some item(like f_name,l_name)


now i want a functionality that when i m click on fullname in checklistbox1 it can be split into fname and l_name item in checklistbox2


i hope u understand my question???????
SRK90 8-Aug-14 7:01am    
As i far i understand i have mentioned my solution in the below TAB. Pleas have a look on it and let me know.

1 solution

Please consider the below example and please proceed with changing the codings based on your requirement. Please let me know if you need any help in this.

In ASPX :

<asp:listbox id="ListBox1" runat="server" xmlns:asp="#unknown" />
<asp:listbox id="ListBox2" runat="server" xmlns:asp="#unknown" />


<asp:button id="btn1" runat="server" onclick="btn1_onClick" xmlns:asp="#unknown" />



In .cs :

On page load method add values to List Box1

i.e -> ListBox1.Items.Add("Full Name");

then

protected void btn1_onClick(Object sender , Eventargs e)
{
string text = "";
foreach (System.Data.DataRowView item in ListBox1.SelectedItems)
{
text += item.Row.Field<string>(0) + ", ";
}
string[] names = text.Split(' ');
ListBox2.DataSource = names;

}



Happy Coding :)
 
Share this answer
 
v2
Comments
Member 10891595 8-Aug-14 7:39am    
it have a error in following line

text += item.Row.Field(0) + ", ";
SRK90 8-Aug-14 7:40am    
what is the error you are getting ? Please post that.

Before that plz try this :


text = ListBox1.GetItemText(ListBox1.SelectedValue);

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