passing querystring from user control to master page's content page

Hi all,

       I have a master page which contains two linkbuttons. I want that when user clicks first link button then querystring value is passed to content page's Initialize culture method. how can i do this.

English | Spanish < - user control link

Master page contains this user control

Default page's initializeCulture method need to know which link is clicked and then set culture according.

 code inside initializeculute is like this

if (Request.QueryString["Culture"] == null)


Culture =




Culture = Request.QueryString[
"Culture"].ToString();Culture = Culture == "ES" ? "es-ES" : "en-US";


Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Culture);

Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(Culture);


how to get this Request.QueryString["Culture"] from user control inside master page ?

Please help me with code or links


3/6/2009 8:11:29 PM 13714 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 36

Please put this code in the master page's mark up code,

        <asp:HyperLink ID="hlEnglish" NavigateUrl="~/Demo.aspx?Culture=en-US" runat="server">English</asp:HyperLink>
        <asp:HyperLink ID="hlSpanish" NavigateUrl="~/Demo.aspx?Culture=es-ES" runat="server">Spanish</asp:HyperLink>
and put this code in any pages's code behind,
        string Culture = Request.QueryString["Culture"];
Hong-Gang Chen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
3/11/2009 10:29:18 AM

Similar Artilces:

Content controls have to be top-level controls in a content page or a nested master page that references a master page.
Why in the world am I getting this error? The solutions I have seen either don't apply or don't work.  Here is my master page code:<%@ Master Language="C#" AutoEventWireup="false" CodeFile="TechLMSMasters/MainSide.master.cs" Inherits="MainSide" %> <%@ Register TagPrefix="usercontrol" TagName="Search" Src="~/library/uc/Search.ascx" %> <%@ Register TagPrefix="usercontrol" TagName="UserName" Src="~/library/uc/UserNameDisplay.ascx" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns=""> <head runat="server"> <title>Untitled Page</title> <asp:ContentPlaceHolder id="head" runat="server"></asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> <DIV class="user" id="userName" runat="server"><usercontrol:username id="userNameDsp" runat="server"></usercontrol:username></DIV> <DIV class="search" id="search" runat="server"><usercontrol:search id="pageSea...

How to set a Master Page's control's property through content page on a postback event?
Hi all, i m using a master page in my application. i have a panel on master page and a tab container with three tab panels on content page. i want to set/change  the visibility of the panel control when the tab is changed on the content page. By default the panel is invisible. To implement this i executed the following steps: 1. Set AutoPostBack of tacontainer to true 2. Wrote an event handler for ActiveTabIndexChanged event of the tab container 3 Wrote the following code on Tab changed event   if (TabContainerEmpPerformance.ActiveTabIndex == 1) { ...

Problem to use TreeView Control in a 'content page' This Error Occur "Only Content controls are allowed directly in a content page that contains Content controls."
hi I am trying to use the TreeView Control inside the content page (Page that has a master page is a content page). On compiling the project I got the following ASP.Net runtime error: "Only Content controls are allowed directly in a content page that contains Content controls."B@b@R J Issue resolved. I was putting script tag in the content page that is not allowed. when remove the script from content page problem is resolved.B@b@R J...

Error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.
when I make a directory on my root, and in that directory I put a masterpage and a web form ... I get always an error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.   Does somebody know what the problem is ? Is it possible you can't set a masterpage in a directory ... ?Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) i've founded ... I had to nest my masterpage ...Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) Hi Joeri Pansaerts, I am receiving the same error as the one posted here, Could you please share your solution with me. I am using a single Master Page. Thank You, Sudhe Hi Sudhe,  Are you using 2 masterpages ?Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) Hi Joeri, Thank you for the reply. I am using a single master page, however I had figured out the solution. Thanks once again, Sudhe hi, I also geting the same error, I am using single master page and a web form. please can any one help me to solve this problem....

ERROR Content controls have to be top-level controls in a content page or a nested master page that references a master page.
This all used to work until about 5 minutes ago. Did I change something? For some reason I am now getting this error: Content controls have to be top-level controls in a content page or a nested master page that references a master page. What I have:  I have a masterpage inside of a directory. That directory is a first level directory with its own web.config file....The whole thing is protected by the web.config file above it (in the main public directory). That main public directory has a masterpage as well. I am not currently linking the two masterpages together becuase...

Passing values from content page to user control on master page
I have a content page that pulls the info for a product. Surrounding this is a master page that has some user controls on it that show content that is specific to the data being pulled in the content page. I already have the content page setting properties on the master page in the code behind, and then the master pages code behind feeding the user controls - all seems to work but seems a tad inefficient in some cases - fine when I need to go back to the databse to fetch more related records, but this particular issue shouldn't need to do that.  My content page initiates a Product cla...

Need to access a Label Control on the Master Page from a user control attached to a content page
Hello all, I have a master page (say  site.master)  with a status Label in it. I have a content page ( say content.aspx)  that has a user control (say usercontrol.ascx). One of the Button Click Events in the usercontrol.ascx needs to pass on some text onto the status label on the masterpage(LabelStatusMsg) and display it. I have been able to do this directly off a content page (content.aspx) by using the following code (VB)  on the master page <%@ MasterType virtualpath="~/site.master" %> and Dim mpLabel As Label = CType(Master.FindControl("LabelStatusMsg"),...

How could a master page control call a content page's function?
Dear all: For example: 1. In master page, place a button named "button1" . 2. Add three content page, ( add some code )3. Run application, in content page 1, click button1, show "this is page1",  in content page2, click button1, show "this is page2", and so on . Besides, these code should be in every content page instead of in master page, because actually action should be very complex, master can't predict everything. Is this possible?  Thanks!  Here's a great tutorial that may get you started: Creating a Common Toolbar in ASP.NET ...

How do i get master page's Controls value into Content page!!!
  Hi to All,   I have a Master Page that Contains 4 dropdown lists and 2 Checkboxlists(that contains lot of check box list items) and one Search Button. now i want to search according to master page's controls parameters and display it on content my problem is how do i get the master page's controls(dropdown lists,Checkboxlists)  values into content page. i did use properties for that in master page and calling these properties in  content page like this: Master.master:public string RegionState { get {if (Session["regionState"] == nu...

Passing Variable from Content Page to Web User Control embedded in a Master Page
Hi there,I have a content page (mypictures.aspx). I have a Master Page with the following code:<%@ Register TagPrefix="ECC" TagName="LeftNav" Src="leftnav.ascx" %>......................... <ECC:LeftNav ID="LeftNav1" Section="Sales" SubSection="" TertiarySection="" runat="server"/>................................  I have the LeftNav - Web User Control (leftnav.ascx). Question:Depending on the content page i am viewing (i.e. mypictures.aspx), I want to change a graphic file in leftnav.ascx file which is embedded or called by the Master Page.I am pretty novi...

Accessing a master page's control in a nested content Page(Urgent)
Hi all, I have a masterpage rm_master.masterand another masterpage rm_sub.master which inherits from rm_master.master. Now I want to access a dropdownlist control in a content page which derieves from rm_select_master. the code i used wasDropDownList DropDownList1 = (DropDownList)Master.FindControl("DropDownList1");string a; a = DropDownList1.Text;   The error i got was "Object reference not set to an instance of an object". Please help.. Thanks in advance.. Bharath You can try Page.FindControl or use the mastertype directivePlease remember to click “Mark as Answer” so I know if my answer was good enough for you. Thanks. Hi Clarifying ,   The DropDownList is in the First Level master page(rm_master) and i want to read the selected item in  this dropdown in the content page derived from the nested masterpage rm_sub.master. Thanks  expose the dropdownlist as a public property on the masterpage, then, from your page, you can do:Page.Master.Master.DropdownlistIDHope this helps !Rinze Cats---------please select 'mark as answer' if this post helped you! hi, how to access controls in nested masterpage check my post Please Mark as Answer if it helps you  it's better to expose it as a propertyHope this helps !Rinze Cats---------please select 'mark as answer' if this post helped you!...

Can I hide a user control's control from the hosting page's client script?
Okay, my previous question was not unswered and I guess you can't hide a control's panel with server code then show it with client code. Now this is what I try to do: on the hosting page's onload event, call a function to hide the user control's penal. Here is the deal: the user control was looped as many times as data required. So the penals will be name mypanel1, my panel2, etc... that is not even a problem if I know if the following is true: * Do all server codes finish running before the page get sent back to the client? Say the database gave me 5 penals, I can then determine how many times to call the panels to hide. Yes, all the server code is run before the page is sent back to the client....

How to do post back in a dynamically created user control [provided that update panel is in the master page of the page where user control is added] {B/C of FileUpload Control}
I have a register my scriptmanager and place the update panel around contenttempalte for my pages int the master page. Now in one of my pages i am adding some user controls dynamically. In two of my user user controls I have FileUpload control which will not work under partial post back. So I want's full postback for them How could I do that {Provided that i am on the user control,which is inside the page ,and page have the contenttemplat...

convertion from page to content page or from user control to content page
Hi, I have converted an 1.1 application to 2.0.  Now what I am looking for some enhancement.  I added a master page and now I want to add other pages as content pages. but those pages which I am converting into content have some user control. Now either I can convert those user control to content pages ( which i want to look for if it is possible),  Or I am thinking i shouldn't convert those user control to content pages cause they might be just good. So looking for some of those people opinion who have worked through this so can I get opinion here please.thanks&nb...

how to pass ddl1.selectedvalue from a content page to a User Control page ( ascx page)
 Hi All,I have a DropDownList in a content page. i would like to access its selectedvalue my user control page. the below is DDL<asp:dropdownlist id="ddl1" runat="server" autopostback="true">            <asp:listitem value="6" >6</asp:listitem>            <asp:listitem value="12" >12</asp:listitem>            <asp:listitem value="24"...

Label control's text doesn't appear to be set (in the page which has a user control )when trying to update the text property in the FormView's ItemUpdated event
Hi There,I have a user control which hosts a formview control, gridview control and a label control. The grid view is usedto show rows in the DB and when clicked to edit each row, a form view opens up in edit mode with that particular row info. So I have nothing in the item template.My first question it mandatory to have smth in the itemtemplate of the form view.I have controls in edititemtemplate and insertitemtemplate.When a particular row is edited, I would like to show a status msg showing that the row has been updated.For this, I use the ItemUpdated event of the formview and try ...

Hook up to a control's event located on the Master Page from the Content Page PLEASE HELP
I have a master page with a button, and I what to hook the button click event on the content page I allready tried this example but in vb it doesn't work. Thank you ALL. Master Page Code: Public Event OnbtnGrava_Click As EventHandler Protected Sub btnGrava_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGrava.Click RaiseEvent OnbtnGrava_Click(sender, e) End Sub Content Page code: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim mpButton ...

Using controls from pages, master pages, and user controls
How would I structure my site in this scenario: I'd like to use a dropdownlist all over my site, sometimes in a regular page, sometimes in a master page, and sometimes in a user control.  I wish to bind its events programmatically, so normally I would just put that in the codebehind.  However, I notice a lot of code duplication because I have to declare the control in everywhere, in my base page (which all my pages inherit from), in my base master page (which all my master pages inherit from) and in my base user control (which all my user controls inherit from).How should I be...

CS0012 when referencing controls on master page's master page.
 I'm working with a content page that has a master page (we'll call it ChildMaster). ChildMaster also has a master page (ParentMaster). There is a control on ParentMaster I need to access from the content page. The code looks like this:  ControlType controlInstance = (ControlType) Master.Master.FindControl("controlID");  When I upload, I get CS0012 telling me that ParentMaster is defined in an assembly that is not referenced, and I need to add a reference to some assembly with a funky random-looking name (which changes when I reupload ParentMaster). Up t...

Master Page , User Control,Content page
 Hi friend ,I have user control at master page, I want to access it's property using content page I have done code but getting problem in deployment.((ASP.usercontrols_travel_hotel_directory_ascx)Master.FindControl("ucHotel_Directory")).Visible = false;  But I am getting following error in deployment project Error    137    The type or namespace name 'usercontrols_travel_animation_ascx' does not exist in the namespace 'ASP' (are you missing an assembly reference?)    d:\By Shakti5385\EternalMewar\Eterna...

Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control.  The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...

How can I access the property a control on a master page from the master page's code behind.
On my master page I have a label. I want to change this label's text property based on an element of the querystring. (label.text = "NewValue")All child pages using this master will display the same thing so I was trying to put the code in the master page so as not to have to duplicate it for the child pages or put it in a base class and use FindControl.Is it possible to access from a master page's codebehind the property of a server control that is placed on a master page's aspx? If so how?(I saw similar questions, but they all came from the view of a child accessing the property.)Thank you...

How to over write a user control in master page from content page?
Pals, I tried to access a usercontrol in master page from content page but in vain.. For ordinary pages we are able to access the usercontrol using this line. uclAddlInformation is the user control i am using in the ab.aspx.. Label lblh = (Label)uclAddlInformation.FindControl("LblEquipments"); It doesnt work with master pages..Anybody tried this? first find the control  (air coded);         ContentPlaceHolder content;        Label label;         UserC...

Master page - Content page
I have a user control in the Master Page and another user control in the content page. I have to do something in the content page user control according to the actions in the master page user control. I don't know how to achieve it. Please help  If this post was useful to you, please mark it as answer.ClientSideAsp.Net | Blog Create an event in the master page. Raise the event when the user control in master page has that action. Now handle this event in the content page and in the event do what you want to in the content page's user control.  Vikram www.vikramlakhotia.c...

Web resources about - passing querystring from user control to master page's content page -

Platform Updates: Operation Developer Love
Since last Wednesday's post , we announced all the events in april we will be attending. Defaulting new apps to sandbox mode Starting today, ...

Oxford Professor of Poetry - Wikipedia, the free encyclopedia
(£4,695 as of 2005) plus £40 in travel expenses for each Creweian Oration . The Professor of Poetry delivers three lectures each year. In addition, ...

Z- blog跨站脚本攻击漏洞 - 80sec
Z- blog跨站脚本攻击漏洞

Check Websites For Bad Links And Invalid References In Mac - Integrity
One thing which should be considered to maintain the integrity of a website is that it must not have too many broken links, as they don't only ...

Smart cache-busting for your WordPress stylesheet
Is this a frustration you're familiar with? If you're like me you mess around with your Wordpress CSS stylesheet fairly ...

Getting Schooled: An America Tonight special series - Al Jazeera America
On air and online, America Tonight explores in depth some of the biggest hurdles keeping kids from a good education

1.7.0 YUI 3.7.3 APIs Classes Modules Everything A.DataType.DateMath A.HTML5 A.Node A.NodeList A.Plugin.IO Anim App App.Base App.Content ...

Serverside stylesheet switcher
Stylesheet switcher using jQuery This page can be used so that the stylesheet switcher degrades gracefully where Javascript is disabled or the ...

DEA Educational Foundation Gift Shop - Apparel, Office Supplies, Desktop, T-Shirts, Polo Shirts, Hats ...
0 Items My Account - Order Status A Problem Occurred: Invalid input or characters from QueryString. Invalid input or characters from Querystring. ...

What is the limit on QueryString / GET / URL parameters? Finding content
What is the limit on QueryString / GET / URL parameters?

Resources last updated: 3/4/2016 11:57:26 AM