• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 710
  • Last Modified:

Request.Form cannot find dropdownlist on TabContainer.TabPanel

I call  InitializeCulture (override, see code from VB codebehind) as the result of a selectedIndex change from a dropdownlist.  When the DropDownListLanguage control  is placed on the web page it works fine.  When the DropDownListLanguage control is moved to tabpanel 0 of a AJAX toolkit tabcontainer the Request.Form can no longer find it and the culture is not intialized to the newly selected value.  Is there a way for Request.Form to find a dropdownlist when it is placed on a tabpanel of a tabcontainer?  Or any other idea to let me keep DropDownListLanguage control on the tabpanel and still change the culture using an override of InitializeCulture .
Protected Overrides Sub InitializeCulture()
        If Request.Form("DropDownListLanguage") IsNot Nothing Then
            Dim sCulture As String = ""
            Dim selectedLanguage As String = Request.Form("DropDownListLanguage")
            If selectedLanguage = "English" Then
                sCulture = "en-US"
            ElseIf selectedLanguage = "Español" Then
                sCulture = "es-MX"
                sCulture = "en-US"
            End If

            UICulture = sCulture
            Culture = sCulture
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(sCulture)
            Thread.CurrentThread.CurrentUICulture = New CultureInfo(sCulture)
        End If
    End Sub

Open in new window

1 Solution
Is the drop down list a .NET drop down list or a standard HTML one?

If it is an ASP.NET drop down list you should not reference it via Request.Form


Dim selected Language as String = DropDownListLanguage.SelectedValue

If it is an ASP.NET drop down list and you have a reason for referencing it as Request.Form("DropDownListLanguage") then I would suggest that it has been renamed on the page due to the fact that it is now embedded inside another ASP.NET object.

If this is the case you will need to reference it as Request.Form(DropDownListLanguage.ClientID)

ClientID is the name that the control was given when the page was rendered.

You can check this yourself by looking at the source of the page and seeing what name the control has been given.
cnxmaxAuthor Commented:
Great Thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now