|
xxx
Creating Swapper Listboxes with
EasyListBox
by Peter Brunone
This example shows how to generate a simple two-listbox set
and populate it from a SQL Server database.
The second list holds all the selected items, which can be re-ordered by the user.
filename=/experiments/easylistbox/elb_linked.aspx
<%@ Page Language="VB" %>
<%@ Register TagPrefix="ELB" Namespace="ELB" Assembly="EasyListBox" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Configuration.ConfigurationSettings" %>
<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
If Not Page.IsPostBack Then
Dim strConn as string = AppSettings("LearnaspSamples")
Dim strSQL as string =" use northwind select ProductID, ProductName " & _
"from [Current Product List] order by ProductName "
Dim myDS As New DataSet()
Dim myAdapter As New SqlDataAdapter(strSQL, strConn)
myAdapter.Fill(myDS, "ProductList")
lstProducts.DataSource = myDS.Tables("ProductList")
lstProducts.DataBind()
Else
lblSelectedValues.Text = "<b>Selected:</b><br />" & Join(lstSelected.AllValues, ",<br />")
End If
End Sub
</script>
<html>
<head>
<title>Swapper list demo by EasyListBox.com</title>
</head>
<body bgcolor="#dddddd">
<form id="mainForm" runat="server">
<br /><br />
<ELB:EasyListBox id="lstProducts" runat="server"
IsSwapTarget="True"
Width="250px"
Height="250px"
ButtonColor="#002299"
ArrowColor="#f6f6ff"
BackGround="#f6f6ff"
TextColor="black"
Style="position:absolute;top:50px;left:50px;"
DataValueField="ProductName"
DataTextField="ProductName"
/>
<ELB:ActionButton id="btnRight" runat="server"
Action="SwapItem"
SourceList="lstProducts"
TargetList="lstSelected"
Text=" > "
Style="position:absolute;top:120px;left:310px;"
/>
<ELB:ActionButton id="btnLeft" runat="server"
Action="SwapItem"
SourceList="lstSelected"
TargetList="lstProducts"
Text=" < "
Style="position:absolute;top:170px;left:310px;"
/>
<ELB:EasyListBox id="lstSelected" runat="server"
IsSwapTarget="True"
Width="250px"
Height="250px"
ButtonColor="#002299"
ArrowColor="#f0f0f9"
BackGround="#f0f0f9"
TextColor="#006600"
RollBGColor="#007722"
Style="position:absolute;top:50px;left:350px;"
DataValueField="ProductName"
DataTextField="ProductName"
/>
<ELB:ActionButton id="btnUp" runat="server"
Action="MoveUp"
TargetList="lstSelected"
Text="Move up"
Style="position:absolute;top:300px;left:370px;"
/>
<ELB:ActionButton id="btnDown" runat="server"
Action="MoveDown"
TargetList="lstSelected"
Text="Move down"
Style="position:absolute;top:300px;left:470px;"
/>
<br />
<input type="submit" value="Submit Form"
Style="position:absolute;top:330px;left:400px;font-family:tahoma;" />
<br /><br />
<asp:Label id="lblSelectedValues" runat="server"
Style="position:absolute;top:360px;left:400px;font-family:tahoma;font-size:10pt;"
/>
</form>
</body>
</html>
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|