I've implemented an ASP.NET web application that supports 5 different languages.
The web application has 5 .resx files that contain the resources required in order to display the website in the languages it supports. To display the site in the language that the user has selected, I've been setting the Thread.CurrentThread.CurrentUICulture and Thread.CurrentThread.CurrentUICulture in the InitializeCulture page event.
Some of the pages have UpdatePanels wrapped around the content.
From what I remember (from 3 years ago when I was researching globalization), in order to change cultures you have to do a full page update.
So here's the problem:
The user opens a tab and starts working on some page that has an UpdatePanel surrounding the content.
Then the user opens another tab and selects a new language.
The user returns to the original tab and causes a postback to the server...at this point the page never returns control to the user.
How do I get around this problem?
Thanks,
-Frinny
To get around this problem I ended up storing the user's cultural settings into a HiddenField for each page (did this in the MasterPage really). This way I can access the user's original culture/language settings in the Page InitializeCulture event. The user would have to click enter on the URL or exit the page to use the "default" language/culture selected in the other tab.
Related
background:
existing asp.net web application employs a number of dynamically-loaded user
controls and pages
many of these pages and user controls depend on parent page context
a new project containing “version 2” of the application needs to integrate with aforementioned legacy version in production while “version 2” continues to be developed
scenario:
I’m using a response.redirect with a parameterized URL to navigate from “version 2” page back to a dynamically-loaded legacy page - a "page 1", if you will. This works fine. However, the ultimate goal/target is to navigate directly to a dynamically-loaded legacy page which is “2 clicks away” from the initial target. The “clicks” would be from the dynamically-rendered controls.
question:
Is it possible from my “version 2” page in the code-behind to navigate directly to this ultimate target? When I call the user click procedures in code immediately following the call stack from the initial redirect, it still lands me on legacy page 1.
So the basic question is more conceptual in terms of handling direct navigation several “hops” into dynamically-loaded pages. In other words, can navigation be controlled in code-behind from dynamic controls without actually rendering them back to the client onscreen?
Much obliged for any help to get me beyond this impasse.
/John
The crux of the issue was how to reach a dynamically generated target page from a point in the application which required multiple click events (i.e. multiple round trips), and reduce that to a single round-trip in the code-behind.
Invoking consecutive click events in the code-behind without rendering would have been a recursive violation of the page life-cycle.
Essentially, sequential click events cannot be leveraged in 1 round trip - the solution is to leverage the relevant underlying procedure calls, and/or write new ones in order to yield the target page.
I have a usercontrol with a dropdown, a textbox and a search button in the master page. I select a value in the dropdown, fill in text in the textbox and click on the button. On button click it redirects to another page but all the values are reset. How can I get the value selected in the dropdown and the text in the redirected page?
You need to post the values to the other page. You can for example pass the values in the url
redirectedUlr.aspx?value1=1&value2=2 etc...
Or you can store the value in the Session
Session["passedvalues"] = YourValues
Their is several way to handle this
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:
Use a query string.
Get HTTP POST information from the source page.
The following options are available only when the source and target pages are in the same ASP.NET Web application.
Use session state.
Create public properties in the source page and access the property
values in the target page.
Get control information in the target page from controls in the
source page.
For more information and examples, you can read the following article :
http://msdn.microsoft.com/en-us/library/6c3yckfw(v=vs.100).aspx
I come from ASP.NET and I am learning Flex now. I don't know if I can do what I want in flex, so imagine this in ASP: I have an aspx page that loads a Login.ascx control, the control checks if login is correct, and if so the aspx page loads the XXX.ascx control (so there is only one control visible).
I want to do more or less the same in Flex: I have the main application with the code that connects to the database, check the login, and if its correct it loads a new module. I have made everything until the module load, I mean, I have the main application (Login.mxml) associated to a Login.as, and a Module.mxml associated to a Module.as. When the user press the login button (in Login.mxml), a method is fired and checks the login. If it is correct, it shows the new module.
My problem is that it is shown in the same page that the login page, instead of "changing" the page. I have used two ways to do that: ModuleLoader and PopUpManager, and both load the new module in the same page.
QUESTION: How can I load, inside an application, a Flex module in a different page?
If you want to build Applications, I strongly suggest you get out of the page mindset. Excel doesn't have the concept of pages in it's UI as one example. You wouldn't have links tot he formula editor or whatnot.
But, that said you should probably investigate the BrowserManager and how to Deep Link into a flex Application. Then you can change the URL in the browser's address bar when your application view change.
If your adamant about applying the page paradigm to application building
You could also use the navigatetoURL to redirect to a different page which would load a new flex applications.
I am working on a website web site where each user has a culture setting to allow control of resources displayed. The main page has two views, one the log on screen, the second the main menu.
When first loaded the page displays with the culture settings of the previous user (if any). If I then log on as a user with a different culture setting the view changes to the main menu without changing the culture. Go to another page and the user's correct culture settings are picked up, go back to the main menu, uses the correct culture etc.
This is logical but is there a way (without redesigning the site to have a separate log in page and main menu) to reset the culture to the new user's when switching view?
response.redirect does the job
VS2005, ASP.NET, C#, IIS6
Hello friends,
I have a master page divided into three sections i.e. header, details, footer.
The header section contains web user control having AJAX tab container. We are showing or hiding tabs according to user previleges. Initially only one tab is active showing user to log in. When the user logs in other tabs are activated.
I have used <%# OutputCache Duration="120" VaryByParam="none" %> within my user control. When the user logs in NullReferenceException is generated on one of the method within that control.
When I remove the OutputCache, everything works fine.
Could someone guide me what should i do?
Thanks in advance
The "easy" way to fix this is to check if the value is null, if it is null create it.
A better way would be to find out why it is null.
One possibility is that the first time that page is called there is a parameter that determines that one of the controlls should not be created. The second time it is called it is called with a parameter that say that the controll is required, but it is using a cached version of the page that does not have that controll.