dropdownlist postback to user control

D

DC Gringo

Using code-behind, I have a page "index.aspx" that has a user control
mainHeader.ascx (with a language selection dropdownlist).

Upon selecting a language from the dropdownlist, it should post back
OnSelectedIndexChanged to a Sub "languageSelect" in the index.aspx.vb
code-behind. The variable should then determine which panels are hidden and
which visible.

I get a "compilation error: 'languageSelect' is not a member of
'ASP.mainHeader_ascx'." If I put Sub "languageSelect" in the
mainHeader.ascx, I get a bunch of undeclared classes when I try to build it
(there are several user controls within the mainHeader user control).

--- HERE'S MY DROPDOWNLIST ---

<ASP:DROPDOWNLIST ID="ddlLanguageSelection1" RUNAT="server" FONT-SIZE="8pt"
ENABLEVIEWSTATE="True" ONSELECTEDINDEXCHANGED="languageSelect"
AUTOPOSTBACK="True">


--- HERE'S MY SUB languageSelect

Public Sub languageSelect(ByVal sender As System.Object, ByVal e As
System.EventArgs)

' set up the session variable for population of dependent list
Dim ddl As DropDownList
ddl = sender
Session("sID") = ddlLanguageSelection1.SelectedItem.Value
If Session("sID") = "en" Then
'If langID = "en" Then
mainHeader1.Panel1.Visible = True
mainHeader1.panel3.Visible = True
mainHeader1.Panel5.Visible = True
mainNav1.panel1.Visible = True
sectionHeader1.Panel1.Visible = True
sectionHeader1.Panel3.Visible = True
sectionHeader1.Panel5.Visible = True
executiveBriefHeadlines1.Panel1.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel1.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel3.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel5.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel7.Visible = True
specialReports1.Panel1.Visible = True
specialReports1.Panel3.Visible = True
weatherHazards1.Panel1.Visible = True
weatherHazards1.Panel3.Visible = True
weatherHazards1.Panel5.Visible = True
weatherHazards1.Panel7.Visible = True
weatherHazards1.Panel9.Visible = True
imagery1.Panel3.Visible = True
planningAndResponse1.Panel1.Visible = True
livelihoods1.Panel1.Visible = True

'ElseIf langID = "es" Then
ElseIf Session("sID") = "es" Then
mainHeader1.Panel2.Visible = True
mainHeader1.Panel4.Visible = True
mainHeader1.Panel6.Visible = True
mainNav1.Panel2.Visible = True
sectionHeader1.Panel2.Visible = True
sectionHeader1.Panel4.Visible = True
sectionHeader1.Panel6.Visible = True
executiveBriefHeadlines1.Panel2.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel2.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel4.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel6.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel8.Visible = True
specialReports1.Panel2.Visible = True
specialReports1.Panel4.Visible = True
weatherHazards1.Panel2.Visible = True
weatherHazards1.Panel4.Visible = True
weatherHazards1.Panel6.Visible = True
weatherHazards1.Panel8.Visible = True
weatherHazards1.Panel10.Visible = True
imagery1.Panel4.Visible = True
planningAndResponse1.Panel2.Visible = True
livelihoods1.Panel2.Visible = True

End If
End Sub
 
I

intrader

DC said:
Using code-behind, I have a page "index.aspx" that has a user control
mainHeader.ascx (with a language selection dropdownlist).

Upon selecting a language from the dropdownlist, it should post back
OnSelectedIndexChanged to a Sub "languageSelect" in the index.aspx.vb
code-behind. The variable should then determine which panels are hidden
and which visible.

I get a "compilation error: 'languageSelect' is not a member of
'ASP.mainHeader_ascx'." If I put Sub "languageSelect" in the
mainHeader.ascx, I get a bunch of undeclared classes when I try to build
it (there are several user controls within the mainHeader user control).

--- HERE'S MY DROPDOWNLIST ---

<ASP:DROPDOWNLIST ID="ddlLanguageSelection1" RUNAT="server"
FONT-SIZE="8pt" ENABLEVIEWSTATE="True"
ONSELECTEDINDEXCHANGED="languageSelect" AUTOPOSTBACK="True">


--- HERE'S MY SUB languageSelect

Public Sub languageSelect(ByVal sender As System.Object, ByVal e As
System.EventArgs)

' set up the session variable for population of dependent list
Dim ddl As DropDownList
ddl = sender
Session("sID") = ddlLanguageSelection1.SelectedItem.Value
If Session("sID") = "en" Then
'If langID = "en" Then
mainHeader1.Panel1.Visible = True
mainHeader1.panel3.Visible = True
mainHeader1.Panel5.Visible = True
mainNav1.panel1.Visible = True
sectionHeader1.Panel1.Visible = True
sectionHeader1.Panel3.Visible = True
sectionHeader1.Panel5.Visible = True
executiveBriefHeadlines1.Panel1.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel1.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel3.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel5.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel7.Visible = True
specialReports1.Panel1.Visible = True
specialReports1.Panel3.Visible = True
weatherHazards1.Panel1.Visible = True
weatherHazards1.Panel3.Visible = True
weatherHazards1.Panel5.Visible = True
weatherHazards1.Panel7.Visible = True
weatherHazards1.Panel9.Visible = True
imagery1.Panel3.Visible = True
planningAndResponse1.Panel1.Visible = True
livelihoods1.Panel1.Visible = True

'ElseIf langID = "es" Then
ElseIf Session("sID") = "es" Then
mainHeader1.Panel2.Visible = True
mainHeader1.Panel4.Visible = True
mainHeader1.Panel6.Visible = True
mainNav1.Panel2.Visible = True
sectionHeader1.Panel2.Visible = True
sectionHeader1.Panel4.Visible = True
sectionHeader1.Panel6.Visible = True
executiveBriefHeadlines1.Panel2.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel2.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel4.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel6.Visible = True
famineAlertStatusHeadlinesBySeverity1.Panel8.Visible = True
specialReports1.Panel2.Visible = True
specialReports1.Panel4.Visible = True
weatherHazards1.Panel2.Visible = True
weatherHazards1.Panel4.Visible = True
weatherHazards1.Panel6.Visible = True
weatherHazards1.Panel8.Visible = True
weatherHazards1.Panel10.Visible = True
imagery1.Panel4.Visible = True
planningAndResponse1.Panel2.Visible = True
livelihoods1.Panel2.Visible = True

End If
End Sub
I don't get a clear picture of where you are placing the languageSelect
method. It should be a member of the code behind class; further I don't see
that you are delegating properly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,829
Latest member
PIXThurman

Latest Threads

Top