Hi
I have 2 ListBoxes/DropDown with Checkboxes. In one ListBox/DropDowm i will be listing all Departments . Between 2 Boxes there will be 2 arrows (Left & Right) . When user ticks checkboxes then all those selected Department from Left Box & select right arrow that Department's should get moved in the Right box & vice-versa using C# . This part is finished .
Now i want all those Departments which are in Right Side Box , i want then to assign Deptt Head . Then i want them to be saved . How best it can be done.
Thanks
Loading
Jagjit SainiPosted Nov 29, 2011, 1:32 AM
Thanx. R u clear reagrding first functionality .
In 2nd suppose there are 4 persons . I want that Person A will report to Mr A , Person B will report to Mr B . (Mr A , Mr B will be in dropdown list & so on.) . How i should create functionality & screen for this inclusive of first part. Then record should be added in Database . If there are 4 person then 4 records will be added , if three then three.
Thanx.
Mayur GujrathiPosted Nov 29, 2011, 1:22 AM
Karthik AgarwalPosted Nov 29, 2011, 1:19 AM
Jagjit SainiPosted Nov 29, 2011, 1:05 AM
Sorry to bother u . First Part that is moving from one list to another has been done. Now those in the 2nd list i want them to be assigned Deptt Heads . I have specific list i.e dropdown list will be used . But how this can be done .
Thanks
Karthik AgarwalPosted Nov 29, 2011, 12:55 AM
Jagjit SainiPosted Nov 29, 2011, 12:26 AM
See loop is o.k . How i can get it enter from user, should it be through Gridview ot there is some other solution . Can u help.
Thanx
Karthik AgarwalPosted Nov 28, 2011, 5:44 AM
for(int i = 0; i < listBox1.Items.Count; i++)
{
if (list1.Items[0].Selected == true)
{
///assign your dept head here
}
elseif (list1.Items[1].Selected)
{
///assign your dept head here
}
elseif (list1.Items[2].Selected)
{
///assign your dept head here
}
else
{
}
}
Jagjit SainiPosted Nov 28, 2011, 5:33 AM
For each one i have to select , not common to all.
Thanx
Karthik AgarwalPosted Nov 28, 2011, 5:19 AM
Jagjit SainiPosted Nov 28, 2011, 5:16 AM
It's O.K . MY requirement is Now i want all those Departments which are in Right Side Box , i want each of them to assign Deptt Head . Then i want them to be saved . How best it can be done.
Thanks
Karthik AgarwalPosted Nov 28, 2011, 5:01 AM
http://www.codeproject.com/KB/aspnet/List_Box_Control.aspx
Karthik AgarwalPosted Nov 28, 2011, 4:56 AM
foreach(object obj in listBox1.Items)
{
//do whatever you want here
}
or else
You can save the items in the list box as follows:
string [] str= new string[10];
int i = 0;
foreach(String item in listBox1.Items)
{
str[i] = listBox1.Item[i];
i++;
}
And now you have all your listbox1 strings in your str array.