- Joined
- Nov 2, 2006
- Messages
- 1
- Reaction score
- 0
Hello friends,
I got very interesting problem. i have two list boxes, when i select an item from one list box and click the button it should be transfered from one list box to another one. Please dont give me the code to do this..... I have the code It was working for my previous application but the same code it not working now for these list boxes. i didn't find any difference. actually the problem is, The selected item value i am getting in coe behind is false(actually it should be true.)...
I would be really Thankfull if any would help me in this regard.
Thanks in advance.......
i am also giving the code check this it may help you to solve the problem.
Code in aspx file
<table cellSpacing="0" cellPadding="0" width="85%" border="0">
<tr>
<td vAlign="top" width="100%">
<asp:ListBox id="ListProjectAttributesFrom" tabIndex="1" runat="server" SelectionMode="Multiple" Visible="true" Width="200px" Height="100px">
<asp:ListItem></asp:ListItem>
</asp:ListBox></td>
<td>
<asp:button id="Next" Runat="server" CssClass="buttonStyle" Text=">" Width="50"></asp:button></div>
<td vAlign="top"><asp:listbox id="ListProjectAttributesTo" SelectionMode="Multiple" Runat="server" CssClass="ForListBox"
ONCHANGE="test()" Width="200" Height="100" AutoPostBack="True">
<asp:ListItem></asp:ListItem>
</asp:listbox></td>
<td> </td>
</tr>
</table>
Code For buttonclikck in Codebehind ( in C#.net ):
private void Next_Click(object sender, System.EventArgs e)
{
foreach(ListItem item in ListProjectAttributesFrom.Items)
{
if (item.Selected == true)
{
if (!ListProjectAttributesTo.Items.Contains(item))
{
ListProjectAttributesTo.Items.Add(item);
//BtnAddSave.Enabled=true;
}
}
}
foreach(ListItem item in ListProjectAttributesTo.Items)
{
ListProjectAttributesFrom.Items.Remove(item);
if (item.Selected == true)
{
item.Selected=false;
}
}
}
I got very interesting problem. i have two list boxes, when i select an item from one list box and click the button it should be transfered from one list box to another one. Please dont give me the code to do this..... I have the code It was working for my previous application but the same code it not working now for these list boxes. i didn't find any difference. actually the problem is, The selected item value i am getting in coe behind is false(actually it should be true.)...
I would be really Thankfull if any would help me in this regard.
Thanks in advance.......
i am also giving the code check this it may help you to solve the problem.
Code in aspx file
<table cellSpacing="0" cellPadding="0" width="85%" border="0">
<tr>
<td vAlign="top" width="100%">
<asp:ListBox id="ListProjectAttributesFrom" tabIndex="1" runat="server" SelectionMode="Multiple" Visible="true" Width="200px" Height="100px">
<asp:ListItem></asp:ListItem>
</asp:ListBox></td>
<td>
<asp:button id="Next" Runat="server" CssClass="buttonStyle" Text=">" Width="50"></asp:button></div>
<td vAlign="top"><asp:listbox id="ListProjectAttributesTo" SelectionMode="Multiple" Runat="server" CssClass="ForListBox"
ONCHANGE="test()" Width="200" Height="100" AutoPostBack="True">
<asp:ListItem></asp:ListItem>
</asp:listbox></td>
<td> </td>
</tr>
</table>
Code For buttonclikck in Codebehind ( in C#.net ):
private void Next_Click(object sender, System.EventArgs e)
{
foreach(ListItem item in ListProjectAttributesFrom.Items)
{
if (item.Selected == true)
{
if (!ListProjectAttributesTo.Items.Contains(item))
{
ListProjectAttributesTo.Items.Add(item);
//BtnAddSave.Enabled=true;
}
}
}
foreach(ListItem item in ListProjectAttributesTo.Items)
{
ListProjectAttributesFrom.Items.Remove(item);
if (item.Selected == true)
{
item.Selected=false;
}
}
}