Here is where i am at: :eek:

I am faced with a comon newbie problem and i have bet my brains in for 4 days over this and now i am seeling help.
I have a dda that has static content, i have ddlB that loads depending on the selection made from ddlA, i have ddlC that loads from the selection from ddlA. that all load fine that is not the issue here. The issue here is that after they load and are visiable, i need to knoe what to inplement to make them go back to visiable = false.. i have tried various implementing and have not been able to come up with any luck.

Looking for help here, ,or just a simple url so that i can study up on this.

Thank You,
Erik,.,,


The page loads, ddls load fine,, now they will not unload,, i only need eaither the clothtapeddl or the remoteddl to be visiable at one time..

I have tried the if.~~~~.visiable = true Then ~~~~.visiable= false,, and a couple of other thing however could not pull this one off.

Looking for help here.


Erik..

Option Strict On

Public Class Wood_Blind_Extras_Main
Inherits System.Web.UI.UserControl


Dim IDA_TapCor As Int32
Dim IDProduct As Int32
Dim IDA_Remote As Int32
'
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'
hdnProductID.Value = Request.QueryString("IDProduct")
hdnIDA_TapCor.Value = Request.QueryString("IDA_TapCor")
hdnIDA_Remote.Value = Request.QueryString("IDA_Remote")
'
End Sub
'
'...
Private Sub ddlMainOptions_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlMainOptions.SelectedIndexChanged
'
'...
Try
'
Select Case ddlMainOptions.SelectedItem.Value
'
Case "ClothTape"
ddlMainOptions.SelectedItem.Value = hdnIDA_TapCor.Value
IDA_TapCor = CInt(ddlMainOptions.SelectedItem.Value)
GetTapeColors()
Case "Remote"
ddlMainOptions.SelectedItem.Value = hdnIDA_Remote.Value
IDA_Remote = CInt(ddlMainOptions.SelectedItem.Value)
GetRemote()
Case "Motorization"
ddlMainOptions.SelectedItem.Value = ""
Case "Routless"
ddlMainOptions.SelectedItem.Value = ""
Case "Extras"

Case Else
End Select
'
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message & ": " & ex.StackTrace)
End Try
End Sub
'
Private Sub GetTapeColors() ' ClothTape colors for Wood and Alternitive Blinds
'
Try
IDProduct = CInt(hdnProductID.Value)
'
Dim ClothTapeColors As New ConstructionSuperCenter.BCom_NS.Wood_and_Alternitive_Blinds_MAIN
'Get Fabric Colors For DDL
ddlClothTapeColors.DataSource = ClothTapeColors.Get_Standard_Blind_Cloth_Tape_Colors_(IDProduct, IDA_TapCor)
ddlClothTapeColors.ToolTip = "Please Choose a Cloth Color"
ddlClothTapeColors.DataTextField = "AttributeName"
ddlClothTapeColors.DataValueField = "AttributeName"
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message & ": " & ex.StackTrace)
End Try
ddlClothTapeColors.DataBind()
End Sub
'
Private Sub GetRemote() 'Get Lets the consumer know if there is a remote for this product
'
Try
IDProduct = CInt(hdnProductID.Value)
'
Dim BlindRemote As New ConstructionSuperCenter.BCom_NS.Wood_and_Alternitive_Blinds_MAIN
'Get blind remote option
ddlBlindRemote.DataSource = BlindRemote.Get_Standard_Blind_Remote_(IDProduct, IDA_Remote)
ddlBlindRemote.ToolTip = "Remote Option"
ddlBlindRemote.DataTextField = "AttributeName"
ddlBlindRemote.DataValueField = "AttributeName"
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message & ": " & ex.StackTrace)
End Try
ddlBlindRemote.DataBind()
End Sub
End Class

What event are you wishing to happen to cause them to become invisible?

I hope you guys do not get up set with the code that i am going to post; however, i really need to in order to show what i am tring to do.

I have a simply problem to the experienced programmer. I have an ascx control that has three ddls. One of the ddls being visiable all the time so that the user can keep returning to that ddl for different options, and the other two ddls are the receivers of the selectedItems.value of the main ddl (In other words i am using the selectedItem.value to filter the contents that will be visiable in the receiving ddl) HOWEVER,
i HAVE THE G_D Problem and i can not get this MF to work.

All i need is for ddlA, to always be visiable,,,, and ddlB,, and ddlc to toggel between visiable and not depending on the value of the ddlA,,,,,,,,,,,,,WHERE IN THE HE_ _ AM i going wrong here,, i am into my 2nd week with this,,

I did create a seperate solution and made a little demo with the data coming from the northwind database and it works great; however, with the twist that i am putting on my code,, i am not successfull...

I am not receiving an error,, what is happening is that the ddlB,, and ddlc will both load like the should on the first post back and when i make another selection from ddlA (Main ddl) both ddlB and ddlc disapear and will not reload,, I have done every thing,, it must be in the page load or InT load; however, i am not far along with my learning venture to tamper with the INT_Load portion of my page.


I am going to first post the code that works ,, so someone can see the directiion that i am heading..l. Then i will post the code that i am tring to get to work..

Please,,, all help is very much needed!

======================vb.net that work................(I have included the xml data also for this one)
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Not Page.IsPostBack Then
intddls()
End If
'
End Sub
'
Private Sub intddls()
'
Dim dsDDLOptions As New DataSet
dsDDLOptions.ReadXml(Server.MapPath("XML/DDL_XML_F.xml"))
'Load the ddl
ddla.DataSource = dsDDLOptions
ddla.DataMember = "OptionValues"
ddla.DataTextField = "option"
ddla.DataValueField = "value"
ddla.DataBind()
'
'add Dummy
ddla.Items.Insert(0, New ListItem("Options", String.Empty))
ddla.AutoPostBack = True
ddlb.Visible = False
ddlc.Visible = False
'
End Sub
'
'
Private Sub ddla_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddla.SelectedIndexChanged
'
If ddla.SelectedIndex <= 0 Then
ddlb.Visible = False
ddlc.Visible = False
ddlb.SelectedIndex = 0
ddlc.SelectedIndex = 0
Else
If ddla.SelectedIndex >= 0 And ddlb.SelectedIndex <= 0 Then
ddlb.Visible = False
End If
If ddla.SelectedIndex >= 0 And ddlc.SelectedIndex <= 0 Then
ddlc.Visible = False
End If
End If

Select Case ddla.SelectedIndex
Case 1
ddlb_Routless()
Case 2
ddlc_Remote()
End Select
End Sub
'
Private Sub ddlb_Routless()
'
Dim cnn As SqlConnection = New SqlConnection("Data Source= Desktop; Initial Catalog=Northwind; Trusted_Connection=Yes")
cnn.Open()
Dim da As New SqlDataAdapter("Select * from customers", cnn)
Dim ds As New DataSet
da.Fill(ds, "Table")
ddlb.DataSource = ds
ddlb.DataMember = "table"
ddlb.DataTextField = "City"
ddlb.DataValueField = "City"
ddlb.DataBind()
ddlb.Visible = True
ddlb.Items.Insert(0, New ListItem("Routless Option", String.Empty))
'cnn.Close()
End Sub
'
'
Private Sub ddlc_Remote()
'
Dim cnn As SqlConnection = New SqlConnection("Data Source= Desktop; Initial Catalog=Northwind; Trusted_Connection=Yes")
cnn.Open()
Dim da1 As New SqlDataAdapter("Select * from Employees", cnn)
Dim ds1 As New DataSet
da1.Fill(ds1, "Table")
ddlb.DataSource = ds1
ddlb.DataMember = "table"
ddlb.DataTextField = "FirstName"
ddlb.DataValueField = "FirstName"
ddlb.DataBind()
ddlb.Visible = True
ddlb.Items.Insert(0, New ListItem("Remote Option", String.Empty))
cnn.Close()
End Sub

End Class
==============XML FOR WORKING DDLS EXAMPLE..........

<?xml version="1.0" encoding="utf-8" ?>
<DdlDatabase>
<OptionValues>
<option>Routless</option>
<value>Routless</value>
</OptionValues>
<OptionValues>
<option>Remote</option>
<value>Remote</value>
</OptionValues>
<OptionValues>
<option>Cloth Tape</option>
<value>ClothTape</value>
</OptionValues>
<OptionValues>
<option>Motorization</option>
<value>Motorization</value>
</OptionValues>
</DdlDatabase>
=================nOT WORKING......................
Option Strict On
Imports System.Data.SqlClient
Imports System.Xml


Dim IDA_TapCor As Int32
Dim IDProduct As Int32
Dim IDA_Remote As Int32
'
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'
hdnProductID.Value = Request.QueryString("IDProduct")
hdnIDA_TapCor.Value = Request.QueryString("IDA_TapCor")
hdnIDA_Remote.Value = Request.QueryString("IDA_Remote")
'
If Not Page.IsPostBack Then
intddls()
End If

End Sub
'
'...
Private Sub intddls()
'
Dim dsDDLOptions As New DataSet
dsDDLOptions.ReadXml(Server.MapPath("XML/Blind_Extras_ddl.xml"))
'Load the ddl
ddlMainOptions.DataSource = dsDDLOptions
ddlMainOptions.DataMember = "OptionValues"
ddlMainOptions.DataTextField = "option"
ddlMainOptions.DataValueField = "value"
ddlMainOptions.DataBind()
'
'add Dummy
ddlMainOptions.Items.Insert(0, New ListItem("Options", String.Empty))
ddlMainOptions.AutoPostBack = True
ddlClothTapeColors.Visible = False
ddlBlindRemote.Visible = False
'
End Sub
'
'
Private Sub ddlMainOptions_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlMainOptions.SelectedIndexChanged
'
'...
If ddlMainOptions.SelectedIndex <= 0 Then
ddlClothTapeColors.Visible = False
ddlBlindRemote.Visible = False
ddlClothTapeColors.SelectedIndex = 0
ddlBlindRemote.SelectedIndex = 0
'Else
' If ddlMainOptions.SelectedIndex >= 0 And ddlClothTapeColors.SelectedIndex <= 0 Then
' ddlClothTapeColors.Visible = False
' End If
' If ddlMainOptions.SelectedIndex >= 0 And ddlBlindRemote.SelectedIndex <= 0 Then
' ddlBlindRemote.Visible = False
' End If
End If
Try
'
'
Select Case ddlMainOptions.SelectedValue
'
Case "ClothTape"
GetTapeColors()
Case "Remote"
GetRemote()
'Case "Motorization"
' ddlMainOptions.SelectedItem.Value = ""
'Case "Routless"
' ddlMainOptions.SelectedItem.Value = ""
'Case "Extras"
End Select
'
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message & ": " & ex.StackTrace)
End Try
End Sub
'
Private Sub GetTapeColors() ' ClothTape colors for Wood and Alternitive Blinds
'
Try
IDProduct = CInt(hdnProductID.Value)
'
If ddlMainOptions.SelectedItem.Value = "ClothTape" Then
ddlMainOptions.SelectedItem.Value = hdnIDA_TapCor.Value
IDA_TapCor = CInt(ddlMainOptions.SelectedItem.Value)
End If
'
Dim ClothTapeColors As New ConstructionSuperCenter.BCom_NS.Wood_and_Alternitive_Blinds_MAIN
'Get Fabric Colors For DDL
ddlClothTapeColors.DataSource = ClothTapeColors.Get_Standard_Blind_Cloth_Tape_Colors_(IDProduct, IDA_TapCor)
ddlClothTapeColors.ToolTip = "Please Choose a Cloth Color"
ddlClothTapeColors.DataTextField = "AttributeName"
ddlClothTapeColors.DataValueField = "AttributeName"
ddlClothTapeColors.DataBind()
ddlClothTapeColors.Visible = True
ddlClothTapeColors.Items.Insert(0, New ListItem("Cloth Colors", String.Empty))
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message & ": " & ex.StackTrace)
End Try
End Sub
'
Private Sub GetRemote() ' Lets the consumer know if there is a remote for this product
'
Try
IDProduct = CInt(hdnProductID.Value)
'
If ddlMainOptions.SelectedItem.Value = "Remote" Then
ddlMainOptions.SelectedItem.Value = hdnIDA_Remote.Value
IDA_Remote = CInt(ddlMainOptions.SelectedItem.Value)
End If
'
Dim BlindRemote As New ConstructionSuperCenter.BCom_NS.Wood_and_Alternitive_Blinds_MAIN
'Get blind remote option for DDL
ddlBlindRemote.DataSource = BlindRemote.Get_Standard_Blind_Remote_(IDProduct, IDA_Remote)
ddlBlindRemote.ToolTip = "Remote Option"
ddlBlindRemote.DataTextField = "AttributeName"
ddlBlindRemote.DataValueField = "AttributeName"
ddlBlindRemote.DataBind()
ddlBlindRemote.Visible = True
ddlBlindRemote.Items.Insert(0, New ListItem("Remote Option", String.Empty))
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex.Message & ": " & ex.StackTrace)
End Try
End Sub
'
End Class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.