dropdownlist postback to user control

Discussion in 'ASP .Net' started by DC Gringo, Apr 12, 2004.

  1. DC Gringo

    DC Gringo Guest

    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
    --
    _____
    DC G
    DC Gringo, Apr 12, 2004
    #1
    1. Advertising

  2. DC Gringo

    intrader Guest

    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.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.
    intrader, Apr 14, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mad Scientist Jr
    Replies:
    0
    Views:
    635
    Mad Scientist Jr
    Mar 22, 2006
  2. gnewsgroup
    Replies:
    1
    Views:
    387
    gnewsgroup
    Feb 13, 2008
  3. Jonathan Wood

    User Control to Control Other User Control

    Jonathan Wood, Jan 24, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    543
    Jonathan Wood
    Feb 2, 2010
  4. DC Gringo

    dropdownlist postback to user control

    DC Gringo, Apr 12, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    137
    intrader
    Apr 14, 2004
  5. DC Gringo

    dropdownlist postback to user control

    DC Gringo, Apr 12, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    171
    intrader
    Apr 14, 2004
Loading...

Share This Page