Loosing Control on postback

liunx

Guest
Hello Fello Progamers,
I am 8 months young to the programing world and really starting to pick up some monentum this last month. So the hard work is paying off.

Here is my delima today (The last three days :confused: ); My page is loading fine. I have 2 ddl on one page and when i make a selection one the first ddl the second ddl will then be visiable populated with the user selections. So, NOW, i have a very comman problem that i am being faced with for the very first time, and the best has got the best of me.. and i need someone to please step up and help out on this one, or at least point me in the right direction.

My problem here is that the ddlB will load ONE TIME after the user makes a selectin from ddla,, and then when a user tries to make another selection from ddla again ddlB is non responicive.. i am sure this is all a post back / databind..

Thank you very much,

Erik...

Here is my code...
=========================================

Option Strict On

Public Class Wood_Blind_Extras_Main
Inherits System.Web.UI.UserControl


Dim IDAttributeCategoryTapeColor As Int32
Dim IDProduct As Int32


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'
hdnProductID.Value = Request.QueryString("IDProduct")
hdnAttributeCategoryTapeColorID.Value = Request.QueryString("IDAttributeCategoryTapeColor")

'
End Sub
'
'...
Private Sub ddlMainOptions_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlMainOptions.SelectedIndexChanged
'
'...
Try
IDProduct = CInt(hdnProductID.Value)
'
Select Case ddlMainOptions.SelectedItem.Value
'
Case "ClothTape"
ddlMainOptions.SelectedItem.Value = hdnAttributeCategoryTapeColorID.Value
IDAttributeCategoryTapeColor = CInt(ddlMainOptions.SelectedItem.Value)
Case "Remote"
ddlMainOptions.SelectedItem.Value = ""
Case "Motorization"
ddlMainOptions.SelectedItem.Value = ""
Case "Routless"
ddlMainOptions.SelectedItem.Value = ""
Case "Extras"
ddlMainOptions.SelectedIndex = -1
Case Else
End Select
'
' 'Place holder
phExtras.Controls.Add(ddlClothTapeColors)
Dim FabricColors As New ConstructionSuperCenter.BCom_NS.Wood_and_Alternitive_Blinds_MAIN
'Get Fabric Colors For DDL
ddlClothTapeColors.DataSource = FabricColors.Get_Standard_Blind_Cloth_Tape_Colors_(IDProduct, IDAttributeCategoryTapeColor)
ddlClothTapeColors.ToolTip = "Please Choose a Cloth Color"
ddlClothTapeColors.DataTextField = "AttributeName"
ddlClothTapeColors.DataValueField = "AttributeName"
ddlClothTapeColors.DataBind()
ddlClothTapeColors.Visible = True
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message & ": " & ex.StackTrace)
End Try
End Sub
===================================================

In case you are wondering i am storing my values from the first page load in a hidden input field..


<input id="hdnAttributeCategoryTapeColorID" name="hdnAttributeCategoryTapeColorID" runat="server">
<input id="hdnProductID" name="hdnProductID" runat="server">

** This will relate to the first line of code in the page load event that i have supplyed...

Thank you in advance..I'm not entirely certain, but I think the problem lies in the fact that you are setting the ListItem values = "". It has been my experience that ListItem in DDL should always have a value, if you don't have some sort of code then at least set the value = to the text. If you have a DDL and all of the values are = "" then the event isn't handled well.

I can't tell what you are trying to do except move values from DDLA to DDLB and removing the selected item from DDLA. If that is the case, then I recommend you use ddlMainOptions.Items.Remove().

Hope that helps.
 
Back
Top