Hey everyone
Could someone please help ,I've been looking around on google for 2 days now..and I have no luck...:-(
I have at this moment 2 listboxes ...
User selects keywords from the 1st listbox ..
"click add" button ,and the selection value goes to 2nd listbox...I also have a "clear all" button function and a "Clear selected" button function...
That All works fine...but the problem is that I need the 1st listbox to be multi column......example
Keyword | suggested related Keyword (two coulmns)
then add ,clear button functions and a 2nd listbox
Well I've realise that multicolumn is maybe not possible...(well I hope someone can help me...but google is dry on any multicolumn listbox for Asp.net2 web application)
So the Listview......well I'm running on VWD 2005 .net 2 framework..and there's not one for the web application..(I dont want to use .net 3.5 framework)
So what else...Gridview to be the substitute for listbox1 ...so Gridview passing values to listbox and back...But I cant get any codes for this to work like listbox to listbox scenario
to show you what I want please use the following code...(but the first listbox need to be a gridview (or do you have any other ideas of a control) and futher everything needs esle to be the same...functions and the lot
here' my code for listbox to listbox plus function buttons
Source view
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:listbox id="lstAsset" width="276px" runat=server SelectionMode="Multiple" style="z-index: 100; left: 67px; position: absolute; top: 77px" Height="98px">
<asp:listitem>Cat |see also Animals</asp:listitem>
<asp:listitem>Horses | see also Farm Animal or Animals</asp:listitem>
<asp:listitem>Apple |see also Fruit or Apple trees</asp:listitem>
<asp:listitem>Man |see also Human or Homo Sapien</asp:listitem>
<asp:listitem>Surfing | see also Adventure Sports or Beach activities</asp:listitem>
</asp:listbox>
<asp:button ID="Button2" text="Clear Selected" OnClick="RemoveBtn_Click" runat=server Width="94px" style="z-index: 102; left: 368px; position: absolute; top: 121px"/>
<asp:button ID="Button3" text="Add Selected" OnClick="AddBtn_Click" runat=server Width="89px" style="z-index: 106; left: 367px; position: absolute; top: 84px"/>
<asp:button ID="Button1" text="Clear All" OnClick="RemoveAllBtn_Click" runat=server Width="91px" style="z-index: 104; left: 369px; position: absolute; top: 157px"/>
<asp:listbox id="lstSubordinateAsset" width="254px" runat=server SelectionMode="Multiple" style="z-index: 105; left: 69px; position: absolute; top: 213px" Height="104px">
</asp:listbox>
</div>
</form>
</body>
</html>
code behind vb
Imports System.Web.UI.HtmlControls
Imports System.Collections
Partial Class Default 'change your page name
Inherits System.Web.UI.Page
Private lasset As New ArrayList()
Private lsubordinate As New ArrayList()
Private Shared UpdateList As New ArrayList()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Public Sub AddBtn_Click(ByVal Src As [Object], ByVal E As EventArgs)
If lstAsset.SelectedIndex >= 0 Then
Dim i As Integer
For i = 0 To lstAsset.Items.Count - 1
If lstAsset.Items(i).Selected Then
If Not lasset.Contains(lstAsset.Items(i)) Then
lasset.Add(lstAsset.Items(i))
End If
End If
Next i
For i = 0 To lasset.Count - 1
If Not lstSubordinateAsset.Items.Contains(CType(lasset(i), ListItem)) Then
lstSubordinateAsset.Items.Add(CType(lasset(i), ListItem))
End If
lstAsset.Items.Remove(CType(lasset(i), ListItem))
Next i
End If
End Sub
Public Sub RemoveBtn_Click(ByVal Src As [Object], ByVal E As EventArgs)
If Not (lstSubordinateAsset.SelectedItem Is Nothing) Then
Dim i As Integer
For i = 0 To lstSubordinateAsset.Items.Count - 1
If lstSubordinateAsset.Items(i).Selected Then
If Not lsubordinate.Contains(lstSubordinateAsset.Items(i)) Then
lsubordinate.Add(lstSubordinateAsset.Items(i))
End If
End If
Next i
For i = 0 To lsubordinate.Count - 1
If Not lstAsset.Items.Contains(CType(lsubordinate(i), ListItem)) Then
lstAsset.Items.Add(CType(lsubordinate(i), ListItem))
End If
lstSubordinateAsset.Items.Remove(CType(lsubordinate(i), ListItem))
UpdateList.Add(lsubordinate(i))
Next i
End If
End Sub
Public Sub RemoveAllBtn_Click(ByVal Src As [Object], ByVal E As EventArgs)
While lstSubordinateAsset.Items.Count <> 0
Dim i As Integer
For i = 0 To lstSubordinateAsset.Items.Count - 1
If Not lsubordinate.Contains(lstSubordinateAsset.Items(i)) Then
lsubordinate.Add(lstSubordinateAsset.Items(i))
End If
Next i
For i = 0 To lsubordinate.Count - 1
If Not lstAsset.Items.Contains(CType(lsubordinate(i), ListItem)) Then
lstAsset.Items.Add(CType(lsubordinate(i), ListItem))
End If
lstSubordinateAsset.Items.Remove(CType(lsubordinate(i), ListItem))
UpdateList.Add(lsubordinate(i))
Next i
End While
End Sub
End Class
-------------------------------
I would apprieciate this so MUCH If someone can give me code that works with a gridview to achive the same result as above... PLEASE!!!!!!!!! PLEASE!!!!
Thank you so much
Jake