selectedindexchanged and user controls

  • Thread starter Thread starter Brent Burkart
  • Start date Start date
B

Brent Burkart

Has anyone experienced any problems with their selectedindexchanged not
firing when there are user controls present on the page? I have 4 controls
on a page and only once I remove all 4 does my dropdownbox
selectedindexchanged work.

Any ideas?
 
Hi Brent,

That sounds really weird. It would help if you could reduce the non-working
sample to minimum size and post it for all to see what may be wrong.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx

To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
 
Thanks, here is the code behind my aspx and the user control. All of my user
controls are pretty much the same. They are just navigational links.



'CODE BEHIND

Imports System.Data

Public Class ProductDetailsPage

Inherits System.Web.UI.Page

Protected WithEvents ModelName As System.Web.UI.WebControls.Label

Protected WithEvents ProductImage As System.Web.UI.WebControls.Image

Protected WithEvents ModelNumber As System.Web.UI.WebControls.Label

Protected WithEvents addToCart As System.Web.UI.WebControls.HyperLink

Protected WithEvents desc As System.Web.UI.WebControls.Label

Protected ReviewList As C_ReviewList

Protected WithEvents Price3 As System.Web.UI.WebControls.Label

Protected WithEvents Price1 As System.Web.UI.WebControls.Label

Protected WithEvents Price2 As System.Web.UI.WebControls.Label

Protected WithEvents infoDrp As System.Web.UI.WebControls.DropDownList

Protected AlsoBoughtList As C_AlsoBought

Dim ProductID2 As Integer

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

' Obtain ProductID from QueryString

Dim ProductID As Integer = CInt(Request.Params("ProductID"))

ProductID2 = ProductID

' Obtain Product Details

Dim products As ProductsDB = New ProductsDB()


Dim myproductinfo As SqlClient.SqlDataReader =
products.GetProductInfo(ProductID)


If myproductinfo.Read Then


infoDrp.DataSource = myproductinfo

infoDrp.DataTextField = "Spec"

infoDrp.DataValueField = "SpecID"

infoDrp.DataBind()

infoDrp.Items.Insert(0, New ListItem("Please Choose", "0"))

infoDrp.SelectedIndex = 0


End If




End Sub

Private Sub infoDrp_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles infoDrp.SelectedIndexChanged

addToCart.NavigateUrl = "AddToCart.aspx?ProductID=" & ProductID2 &
"&SpecID=" & infoDrp.SelectedItem.Value

End Sub

End Class





'USER CONTROL CODE BEHIND

Public MustInherit Class C_Header

Inherits System.Web.UI.UserControl

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub

End Class
 
Back
Top