adding DataBind

Discussion in 'ASP .Net' started by tshad, Oct 28, 2009.

  1. tshad

    tshad Guest

    I picked up this control on the net that allows you to simulate a
    MultiSelect dropdown using a listbox.

    Is there a way to databind to the control that actually databinds to the
    listbox inside the control?

    The code for the control is:
    *********************************************************
    <%@ Control Language="c#" AutoEventWireup="false"
    Codebehind="MultiSelectDropDown.ascx.cs"
    Inherits="MultiDropdownSample.MultiSelectDropDown"
    TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
    <HTML>
    <HEAD>
    <TITLE>MultiselectionDropdown</TITLE>
    </HEAD>
    <meta content="False" name="vs_snapToGrid">
    <meta content="True" name="vs_showGrid">
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5"
    name="vs_targetSchema">
    <script language="javascript">
    function SelectedIndexChanged(ctlId)
    {
    var control = document.getElementById(ctlId+'DDList');
    var strSelText='';
    for(var i = 0; i < control.length; i ++)
    {
    if(control.options.selected)
    {
    strSelText +=control.options.text + ',';
    }
    }
    if (strSelText.length>0)
    strSelText=strSelText.substring(0,strSelText.length-1);
    var ddLabel = document.getElementById(ctlId+"DDLabel");
    ddLabel.innerHTML = strSelText;
    ddLabel.innerText = strSelText;
    ddLabel.title = strSelText;
    }

    function OpenListBox(ctlId)
    {
    var lstBox = document.getElementById(ctlId+"DDList");
    if (lstBox.style.visibility == "visible")
    { CloseListBox(ctlId) ; }
    else
    {
    lstBox.style.visibility = "visible";
    lstBox.style.height="100px";
    }
    }

    function CloseListBox(ctlId)
    {
    var panel = document.getElementById(ctlId+"Panel2");
    var tabl = document.getElementById(ctlId+"Table2");
    var lstBox = document.getElementById(ctlId+"DDList");
    lstBox.style.visibility = "hidden";
    lstBox.style.height="0px";
    panel.style.height=tabl.style.height;
    }
    </script>
    <asp:panel id="Panel2" Height="1px" runat="server" Width="160px"
    BackColor="White">
    <TABLE id="Table2" style="TABLE-LAYOUT: fixed; HEIGHT: 24px"
    cellSpacing="0" borderColorDark="#cccccc"
    cellPadding="0" width="100%" borderColorLight="#7eb3e3" border="1"
    runat="server">
    <TR id="rowDD" style="HEIGHT: 15px" runat="server">
    <TD noWrap>
    <asp:Label id="DDLabel" style="CURSOR: default" runat="server"
    Width="134px" ToolTip="" Font-Size="Smaller"
    Font-Names="Arial" BorderColor="Transparent" BorderStyle="None"
    height="15px"></asp:Label></TD>
    <TD id="colDDImage" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px;
    PADDING-BOTTOM: 0px; PADDING-TOP: 0px; BACKGROUND-COLOR: #7eb3e3"
    width="20" background="Image/DDImage.bmp" runat="server"></TD>
    </TR>
    </TABLE>
    <DIV style="Z-INDEX: 9999; POSITION: absolute">
    <asp:ListBox id="DDList" Height="72px" runat="server" Width="100%"
    SelectionMode="Multiple"></asp:ListBox></DIV>
    </asp:panel>
    </HTML>
    ********************************************************************************************

    Thanks,

    Tom
    tshad, Oct 28, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ante Perkovic

    Me.databind() stops button handlers?

    Ante Perkovic, Jun 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    904
    Ante Perkovic
    Jun 30, 2003
  2. Admin
    Replies:
    0
    Views:
    653
    Admin
    Jul 8, 2003
  3. Kimberly Walker

    Dropdownlist adding data after databind

    Kimberly Walker, Oct 23, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    452
    Kimberly Walker
    Oct 23, 2003
  4. =?Utf-8?B?TFU=?=
    Replies:
    4
    Views:
    714
    =?Utf-8?B?TFU=?=
    Mar 24, 2005
  5. Michael
    Replies:
    0
    Views:
    210
    Michael
    Dec 29, 2003
Loading...

Share This Page