View Single Post
Old June 16th, 2006, 07:22 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi Aaron,

Not sure what's going wrong in your situation. Are you creating controls dynamically?? Here's what I did (and what works for me):

User Control Markup (Test.ascx)
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Test.ascx.vb" Inherits="MyControl" %>
<asp:DropDownList ID="DropDownList1" runat="server">
User Control Code Behind (Test.ascx.vb)
Partial Class MyControl
  Inherits System.Web.UI.UserControl

  Public ReadOnly Property MyDropDown() As DropDownList
      Return Me.DropDownList1
    End Get
  End Property

End Class
Page with the control: (Test.aspx)
      <uc1:Test ID="Test1" runat="server" />
      <asp:Button ID="Button1" runat="server" Text="Button" /></div>
      where uc1:Test refers to my custom control called MyControl in the file Test.ascx.

Code behind of the page: (Test.aspx.vb)
Partial Class Test
  Inherits System.Web.UI.Page

  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  End Sub
End Class
When I run this page and click the button, one item is removed from the list.

Does this work for you?

Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004