I have two list boxes on my form... lstCanSend and lstRecipients... well
then there are two buttons add and remove between them (your basic select
and pick listing) which uses java script to move the items between list
boxes (the listbox controls are server side ones with runat=server set on
them, the buttons are basic html button i dont want to post back each time
someone clicks on add or remove... that wastes time and bandwidth) well the
add and remove buttons work, but at postback there is no data returned from
the lstRecipients listbox, because when the items were added through java
script it did not get posted back to data (i only want to post back when
thet user clicks on the OK button which sends this data to a processor) here
is my html code with the java script inside it... where should i do the post
back of the lstRecipient data and how do i do it when the user clicks on the
OK button? thanks
<%@ Register TagPrefix="cc1" Namespace="SecureEmail" Assembly="SecureEmail"
%>
<%@ Register TagPrefix="uc1" TagName="ctrlTop" Src="../Themes/ctrlTop.ascx"
%>
<%@ Register TagPrefix="uc1" TagName="ctrlBottom"
Src="../Themes/ctrlBottom.ascx" %>
<%@ Register TagPrefix="uc1" TagName="ctrlLeftSide"
Src="../Themes/ctrlLeftSide.ascx" %>
<%@ Register TagPrefix="uc1" TagName="ctrlRightSide"
Src="../Themes/ctrlRightSide.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="AddressBook.aspx.vb" Inherits="SecureEmail.AddressBook" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>The Reschini Secure E-Mail Network</title>
<meta name="ProgId" content="SharePoint.WebPartPage.Document">
<meta name="WebPartPageExpansion" content="full">
<base target="_self">
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="VBScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<script language="javascript">
function movePersonTo(from,to)
{
// Move this person from this list box to that listbox
for (var i=0; i < from.options.length; i++)
{
var o = from.options[i];
if (o.selected)
{
to.options[to.options.length] = new Option(o.text,o.value,false,false);
}
}
// delete from original list
for (var i = (from.options.length - 1); i >= 0; i--)
{
var o = from.options[i];
if (o.selected)
{
from.options[i] = null;
}
}
from.selectedIndex = -1;
to.selectedIndex = -1;
}
</script>
</HEAD>
<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0"
MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table border="0" width="100%" id="table1" cellspacing="0"
cellpadding="0" height="100%">
<tr>
<td valign="top">
<uc1:ctrlTop id="CtrlTop1" runat="server"></uc1:ctrlTop></td>
</tr>
<tr>
<td valign="top" height="100%">
<table border="0" width="100%" id="table2" height="100%"
cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<uc1:ctrlLeftSide id="CtrlLeftSide1"
runat="server"></uc1:ctrlLeftSide></td>
<td valign="top" width="100%">
<TABLE id="table3" cellSpacing="0" cellPadding="0" width="100%"
bgColor="#a0c6e5" border="0"
class="ToolBar ">
<TR>
<TD>
<P align="left">
<asp:button id="btmCloseAddress" runat="server" Text="OK"
CausesValidation="False" Font-Size="8pt"></asp:button></P>
</TD>
<TD>
<P align="right"><FONT face="Verdana" size="1"></FONT> </P>
</TD>
</TR>
</TABLE>
<table border="0" width="100%" id="table6" cellspacing="0"
cellpadding="0">
<tr>
<td>
<cc1:ctrlPageHeaderBox id="ctrlPageHeaderBox" runat="server"
Font-Size="8pt" Text="Address Book" AutoPostBack="True"></cc1:ctrlPageHeader
Box></td>
</tr>
</table>
<table border="0" id="table4" cellspacing="0" cellpadding="5">
<tr>
<td><FONT face="Verdana" size="2"> Please choose the
recipients</FONT></td>
<td> </td>
<td><FONT face="Verdana" size="2"> Send to</FONT></td>
</tr>
<tr>
<td><asp:listbox id="lstCanSend" runat="server" Width="208px"
Height="168px" SelectionMode="Multiple"></asp:listbox>
</td>
<td>
<table border="0" width="100%" id="table5" height="100%"
cellspacing="0" cellpadding="0">
<tr>
<td><INPUT type="button" value="Add"
onclick="movePersonTo(this.form['lstCanSend'],this.form.lstRecipients)">
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<P><INPUT type="button" value="Remove"
onclick="movePersonTo(this.form['lstRecipients'],this.form.lstCanSend)"></P>
</td>
</tr>
</table>
<P> </P>
<P> </P>
</td>
<td><asp:listbox id="lstRecipients" runat="server" Width="232px"
Height="166px" SelectionMode="Multiple"></asp:listbox>
</td>
</tr>
</table>
<p> </p>
</td>
<td valign="top">
<uc1:ctrlRightSide id="CtrlRightSide1"
runat="server"></uc1:ctrlRightSide></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<uc1:ctrlBottom id="CtrlBottom1" runat="server"></uc1:ctrlBottom></td>
</tr>
</table>
</form>
</body>
</HTML>