Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 30th, 2004, 02:35 PM
Authorized User
 
Join Date: Jan 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default listbox in edititemtemplate

I have a listbox in an edititemtemplate but can't get the listbox to work. It's there, I can see it, but the scrollbar doesn't work and the selected item isn't selected (it's fed the selected items through a property in a web usercontrol).

The same usercontrol work fine when not in edit mode

Here is the usercontrol:
================================
    Public theselectedItems As String

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        'selectedItems = "020,009"
        bindList(theselectedItems)
    End Sub

    Sub bindList(ByVal phred As String)
        Dim ds As DataSet
        Dim sqlStr As String = "select whatever from wherever"
        ds = New DataSet
        Dim dr As DataRow
        sqlDA = New SqlDataAdapter(sqlStr, sqlConn)
        sqlDA.Fill(ds, "departments")
        lst.DataSource = ds
        lst.DataBind()
        Dim aArr As Array
        lst.Enabled = True
        aArr = Split(Trim(phred), ",")
        Dim x As Integer = 0, y As Integer = 0
        For Each dr In ds.Tables(0).Rows
            For x = 0 To UBound(aArr)
                If CStr(Trim(aArr(x))) = dr(0) Then
                    lst.Items(y).Selected = True
                End If
            Next
            'lst.Items(y).Selected = True
            y += 1
        Next
        lst.Items.Insert(0, "ALL")
    End Sub
========================================

here is the html:
========================================
    <asp:TemplateColumn HeaderText="Department(s)">
    <HeaderStyle Wrap="False"></HeaderStyle>
    <ItemTemplate>
    <asp:label Runat="server" text='<%# trim(DataBinder.Eval(Container, "DataItem.departmentSecurity")) %>'>
    </asp:label>
    <uc1:deptListBox theselectedItems='<%#trim(databinder.eval(Containe r, "dataitem.departmentsecurity"))%>' id="DeptListBox1" runat="server"></uc1:deptListBox>
    </ItemTemplate>
    <EditItemTemplate>
    <uc1:deptListBox theselectedItems='<%#trim(databinder.eval(Containe r, "dataitem.departmentsecurity"))%>' id="Deptlistbox2" runat="server"></uc1:deptListBox>
    <asp:ListBox Font-Names="verdana, arial" Font-size="10px" ID=deptList Runat=server DataTextField="departmentName" DataValueField="deptNum" Selectionmode=multiple DataSource='<%#buildDeptList(trim(databinder.eval( Container, "dataitem.departmentsecurity")))%>' Enabled="true">
    </asp:ListBox>
    </EditItemTemplate>
    </asp:TemplateColumn>
==============================================


mark








Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with dropdownlist in editItemTemplate hertendreef ASP.NET 2.0 Professional 4 July 31st, 2007 05:56 PM
Datalist-edititemtemplate-RadioButtonList cp75 ASP.NET 1.0 and 1.1 Basics 1 September 1st, 2006 12:56 PM
strange problem with EditItemTemplate hertendreef ASP.NET 2.0 Professional 0 August 17th, 2006 08:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.