Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   dropdownlist postback to user control (http://www.velocityreviews.com/forums/t756606-dropdownlist-postback-to-user-control.html)

DC Gringo 04-12-2004 07:55 PM

dropdownlist postback to user control
 
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.Visib le = True
famineAlertStatusHeadlinesBySeverity1.Panel3.Visib le = True
famineAlertStatusHeadlinesBySeverity1.Panel5.Visib le = True
famineAlertStatusHeadlinesBySeverity1.Panel7.Visib le = 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.Visib le = True
famineAlertStatusHeadlinesBySeverity1.Panel4.Visib le = True
famineAlertStatusHeadlinesBySeverity1.Panel6.Visib le = True
famineAlertStatusHeadlinesBySeverity1.Panel8.Visib le = 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
--
_____
DC G



intrader 04-14-2004 04:09 AM

Re: dropdownlist postback to user control
 
DC Gringo wrote:

> 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.Visib le = True
> famineAlertStatusHeadlinesBySeverity1.Panel3.Visib le = True
> famineAlertStatusHeadlinesBySeverity1.Panel5.Visib le = True
> famineAlertStatusHeadlinesBySeverity1.Panel7.Visib le = 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.Visib le = True
> famineAlertStatusHeadlinesBySeverity1.Panel4.Visib le = True
> famineAlertStatusHeadlinesBySeverity1.Panel6.Visib le = True
> famineAlertStatusHeadlinesBySeverity1.Panel8.Visib le = 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.



All times are GMT. The time now is 04:30 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.