CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 3/30/2008 4:54:52 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 15 Views: 57 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
16 Items, 1 Pages 1 |< << Go >> >|
AnshumanT
Asp.Net User
Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 4:54:52 PM

0/0

How does Request["Language1"] work from inside the content place holder. I am having trouble getting this code to run.

I have a page that I have created from a masterpage. This page contains a content placeholder. Inside the content place holder is my dropdownlist "Language1". When InitializeCulture() is overwritten I do not see the collection being written to the string. the language variable is always null hence the languages being selected are not getting written to.

   protected override void InitializeCulture()

   {

       string language = Request["LanguageSelector"];

       if (language != null && language != "")

       {

           Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);

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

       }

   }

 

ASPX Code content file is as below: 

<asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ContentPlaceHolderLanguageSelector">

   <asp:DropDownList ID="LanguageSelector" runat="server" AutoPostBack="true" OnSelectedIndexChanged="LanguageSelector_SelectedIndexChang ed">

       <asp:ListItem Value="auto">Auto</asp:ListItem>

       <asp:ListItem Value="fr">French</asp:ListItem>

       <asp:ListItem Value="en-US">English (US)</asp:ListItem>

       <asp:ListItem Value="en-GB">English (UK)</asp:ListItem>

   </asp:DropDownList>

</asp:Content>

 

anas
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 6:49:23 PM

0/0

 

the problem is :InitializeCulture will be called in an early stages !

please read how they solve this issue using the session  :

here :http://www.c-sharpcorner.com/UploadFile/munnamax/Localization03172007031927AM/Localization.aspx


Anas Ghanem | My Blog | Online VB - C# Converter | Aljazeera
AnshumanT
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 8:16:59 PM

0/0

 Thank you for replying..

 

Based on your code below:

 

protected override void InitializeCulture()
{
    //string culture = Request.Form["ddSelLanguage"];
    string culture = Session["Language"].ToString();
    if (string.IsNullOrEmpty(culture))
        culture = "Auto";
    //Use this
    UICulture = culture;
    Culture = culture;
    //OR This
    if (culture != "Auto")
    {
        System.Globalization.CultureInfo MyCltr = new System.Globalization.CultureInfo(culture);
        System.Threading.Thread.CurrentThread.CurrentCulture = MyCltr;
        System.Threading.Thread.CurrentThread.CurrentUICulture = MyCltr;
    }
    base.InitializeCulture();
}
 

Code:

In "Default.aspx" file I have a drop-down by which user can select specific language, i have Arabic and English languages and by default "Auto" is set. I have used Auto-postback property of the drop-down & even you can make use of submit button for the same.

Once you got the selected language you can hold that value in the session as explained in the above code.

Session["Language"] = Request.Form["ddSelLanguage"];

While overriding the InitializeCulture() method you can assign this to the culture variable.

 

 

the Session["Language"] when I set this in the InitializeCulture as you have show above, it gives me an error as Object Reference not set to an instance of an object error... 

 

anas
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 8:51:16 PM

0/0

ok

lets go back to your solution , please change your code to this :

 

        protected override void InitializeCulture()
        {

            string language = Request[LanguageSelector.UniqueId];

            if (language != null && language != "")
            {

                Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);

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

            }

        }

 

in selectedindexChanged of the dropDownlist  , add this code :

Response.Redirect(Request.RawUrl);


Anas Ghanem | My Blog | Online VB - C# Converter | Aljazeera
AnshumanT
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 9:04:40 PM

0/0

Here is the error after adding the above

 

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 38:     {
Line 39:
Line 40: string language = Request[LanguageSelector.UniqueID];
Line 41: if (language != null && language != "")
Line 42: {
 

anas
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 9:16:03 PM

0/0

sorry,

 use this

string language = Request.Form[LanguageSelector.UniqueId];


 


Anas Ghanem | My Blog | Online VB - C# Converter | Aljazeera
AnshumanT
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 9:31:00 PM

0/0

 I tried that since I thought that might be the issue, but that gives me the same problem. Unless it is expecting me to use that LanguageSelector.UniqueID in quotation.

AnshumanT
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 9:41:31 PM

0/0

 running this in the debug mode i find that the LanguageSelector DDL is always a null. not sure why that is.

 from my initializeculture()

language = Request.Form[LanguageSelector.UniqueID];

here the language is also a null hence the new culture is never set based on the if condition placed.

 

why would the LanguageSelector DDL  be a null, is it because it is inside a ContentPlaceHolder on this page?

 

 

<asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ContentPlaceHolderLanguageSelector">

    <asp:DropDownList ID="LanguageSelector" runat="server" AutoPostBack="true" OnSelectedIndexChanged="LanguageSelector_SelectedIndexChanged">
        <asp:ListItem Value="auto">Auto</asp:ListItem>
        <asp:ListItem Value="fr">French</asp:ListItem>
        <asp:ListItem Value="en-US">English (US)</asp:ListItem>
        <asp:ListItem Value="en-GB">English (UK)</asp:ListItem>
    </asp:DropDownList>

</asp:Content>
 

I have pulled all my hair out of my head..this works on a simple page, but on this page derived from the masterpage template the same code is useless..hmm

 

 

 
anas
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 9:58:21 PM

0/0

yes the problem is that its inside a content place holder ,

to know what is the key that we need to use it for Request.Form(

you need to add a break point at InitilizeCulture and watch the values of Request.Form.AllKeys

its an array of all keys in the form , try to find the key the ends with the ID of your dropdownlist ,

 then copy it and in your code , pass that key to Request.Form(" key that found ")

 

 


Anas Ghanem | My Blog | Online VB - C# Converter | Aljazeera
AnshumanT
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 10:48:11 PM

0/0

I did exactly as suggested, inside my Request.Form.AllKeys I have a value of {string[0]} and that is all.


 

anas
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 10:57:31 PM

0/0

what about this :

language = Request.Form["ctl00$ContentPlaceHolderLanguageSelector$LanguageSelector"];

Note: you must postback the form to have that value ! it wil not be available for the first page Load !

 

can you tell me where did you placed LanguageSelector ? and from where you are trying to access it ?

 


Anas Ghanem | My Blog | Online VB - C# Converter | Aljazeera
AnshumanT
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 11:22:41 PM

0/0

 LanguageSelector sits inside a content holder on default.aspx page. I have a label on this page on a separate contentholder on the same default.aspx page.

The Code behind the default.aspx page is trying to access the LanguageSelector as we have been trying to succesfully get the language selected items into the local string language variable. The LanguageSelector is doing the AutoPostBack = True.

What do you mean by the form has to do the postback? Where do I handle tis one.

anas
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/30/2008 11:40:05 PM

0/0

AnshumanT:
What do you mean by the form has to do the postback? Where do I handle tis one.

I mean the Request.Form will not contains any value in the first time the page is loaded !

it contains the values when you change the DropDownList selection ( or press a button  ) !

But it seems that its not the problem !

Please in the Defautl.aspx page , you must remove any content that refers to the Master page content that holds the DropDownlist :

what i mean is :

assume you have this in your master :

                  <asp:ContentPlaceHolder ID="ContentPlaceHolderLanguageSelector" runat="server">
                    <asp:DropDownList ID="LanguageSelector" runat="server">
                       .....
                    </asp:DropDownList>
                  </asp:ContentPlaceHolder>
 

 

Now :in  content page (defautl.aspx) , if you have any content control(asp:Content )  that referes to the  above "ContentPlaceHolderLanguageSelector" ContentPlaceHolder ,

some thing like this :

 

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolderLanguageSelector">
</asp:Content>
then , you will get nothing for the Language dropDownlist in the Request.Form.. keys , 
so please remove any content that referece to the master page content Placeholder where you placed the DropDwonlist !
 

Anas Ghanem | My Blog | Online VB - C# Converter | Aljazeera
anas
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.3/31/2008 12:06:32 AM

0/0

Hi

Lets try  this solution :

 

        protected override void InitializeCulture()
        {
            DropDownList ddl = Master.FindControl("ContentPlaceHolderLanguageSelector").FindControl("LanguageSelector") as DropDownList;
            string lang = ddl.SelectedValue;
            if (!string.IsNullOrEmpty(lang))
            {
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang);
            }
          
            base.InitializeCulture();

        }

 

And in LanguageSelector SelectedIndexChanged :

 

        protected void LanguageSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            // issue extra redirect to apply latest language
            Response.Redirect(Request.RawUrl);
        }
  

Regards,


Anas Ghanem | My Blog | Online VB - C# Converter | Aljazeera
AnshumanT
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.4/8/2008 3:10:25 AM

0/0

I finally was able to figure it out.

If you are using a masterpage template then you got to STRONGLY TYPE the control from the masterpage. To do this you have to have the directive..

 

<%@ MasterType virtualpath="~/Masters/Master1.master" %> on your *.aspx pages. this will then allow you to locate the control on your master page
and then the this value was set.
I finally got the code to work, but not by overide initializeculture is what i figured out, i set the threads and the culture on the page load.
so this portion worked for me... 
 
 


 

AnshumanT
Asp.Net User
Re: Multi Language Support Request["Lanaguage"] is not working. Please Help.4/8/2008 3:12:12 AM

0/0

 check this website this might help clear up some problems on the initialize culture.

 

 

http://msdn2.microsoft.com/en-us/library/xxwa0ff0.aspx
 
 
 
16 Items, 1 Pages 1 |< << Go >> >|


Free Download:

... http://www.macromedia. com/support/search/ - Macromedia (MM) Technotes ...
Search engine friendly multi-language support on widgets.opera.com ... Before, the language you selected for the site was stored in a cookie. ... updating various sources of URLs in the system to include the request language when necessary, .... We hope this is of help to you or someone else in the future. ... If you're not a registered member, please sign up. Username:. Password: ...
URL aliases not working for content not in default language ... I'll classify this as a support request for now. .... I hope this can help you, I will look forward to find a GOOD way to correct this problem . ..... @kees@ qrios: please write your example which alias is not working. ...
New ways to select language for spell check - OpenOffice.org Ninja Awww, not fix yet? Seem like this has been a request since OoO 1.1 in 2003! ... If so please switch to DicOOo version 1.8 and be sure to get rid of the ... I support the proposition that changing languages/dictionaries in OO is a dogs ... If you have a long multi language doc, this is kind of time consuming. ...
Hungarian language support request - Miscellaneous | Google Groups There was an error processing your request. Please try again. Standard view View as tree ... to help Google translate Google Analytics also to hungarian language ? ... and stats in Google Analytics, because their english is not the best. ... Subject: Re: Hungarian language support request ...
DotNetNuke > Products > Development > Forge > Module - Reports ... Please help me. By sachingedam on 9/21/2005. Re: DotNetNuke Language Pack Creation (1) ... but what to do in the Multilanguage modules? Here it isn't possible to change the the selector. ... Oussama Ghanem ARABIC-LEBANON Category for language pack request. By samgh on 6/29/2008 ... Your browser does not support frames.
Search: korean language support request!! 123,abc --> support Mr.Kim --> support 가나다, 사랑 . ... multiple live streams with playlist selection. Hi, can anyone help me .... hi, could you give me the write code? this is not working stream.php [code] .... Please Help. If you are going to use the meta element for flashvars, ...
Nabble - Apache Directory Project - [jira] Created: (DIRSTUDIO-397 ... [jira] Created: (DIRSTUDIO-397) request for multi-language GUI. request for ... Please do not use Java properties files for multi-language, XML is better ..... It seems eclipse plug-in only support multi-language with .properties files. ... I think this is a good working-model. Generally, multi-language task can be ...
Emerald: Article Request - Multiple language supports in search ... Document Access:. Please select from the following options: ... The diversity of the internet is reflected not only in its users, ... Multiple language support features in search engines remain at the lexical level. ... current status of multiple language support in search engines, help users to effectively utilise ...
2008111775 | sh404sef and Joomfish 2 compatibility | sh404SEF and ... Meaning you can now have SEF urls on a Joomla 1.5.x multi-lingual site! ... 7; using sh404sef and Joomfish requires that you turn off the Language ... Please do not ask question on this blog, you have zero chances to get an answer. ... DO NOT USE THIS FOR SUPPORT REQUEST DO NOT USE THIS FOR SUPPORT REQUEST ...

Videos:
Using open source tools for performance testing Google London Test Automation Conference (LTAC) Google Tech Talks September 8th, 2006 Presenter: Goranka Bjedov
(888)MOAX.ORG Microsoft Offfice Accounting Xchange ... (888)MOAX.ORG Microsoft Offfice Accounting Xchange 4_IT_JOURNAL.wmv - 31 min - Apr 23, 2008 USStudios - http://www.onafree.com (1 Rating ...
Web Applications and the Ubiquitous Web Google TechTalks February 1, 2006 Dave Raggett Dave Raggett is currently a W3C Fellow from Canon, and W3C Activity Lead for Multimodal ...
Charlie Rose - Judy Woodruff & Mike Allen / Wole Soyinka ... Segment 1: Guest host Judy Woodruff talks politics with Mike Allen of Time magazine. Segment 2: Nobel laureate Wole Soyinka talks with guest ...
www.moldytoaster.com to one of the vegetable dishes. The old girl has her two nieces home for the holidays--devilish handsome, larky girls--so we have determined to ...
Long Beach City Council Meeting Long Beach City Council Meeting
Santa Monica Council Meeting Santa Monica Council Meeting
Long Beach City Council Meeting Long Beach City Council Meeting
Long Beach City Council Meeting Long Beach City Council Meeting
www.moldytoaster.com re in a galaxy to some provincial Belle Vue-terrace or Prospect-place; where they endeavour to forestall the bachelors with promiscuous orange ...
Books:
Learning to Request in a Second Language: A Study of Child Interlanguage Pragmatics Authors: Machiko Achiba, Pages: 223, Published: 2003
The Complete Idiot's Guide to Assertiveness Authors: Jeff Davidson, Mba Davidson, Pages: 337, Published: 1997
Record of proceedings Authors: unknown, Pages: 0, Published: 2007
Understanding Child Development: Psychological Perspectives in an Interdisciplinary Field of Inquiry Authors: Sara Meadows, Pages: 250, Published: 1986
Pragmatic Competence and Foreign Language Teaching Authors: Alicia Martínez Flor, Esther Usó Juan, Ana Fernández Guerra, Universitat Jaume I, Publicacions de la, Pages: 281, Published: 2003
The American Directory of Writer's Guidelines: More Than 1,600 Magazine Editors And Book Publishers Explain What They Are Looking For From Freelancers Authors: Stephen Blake Mettee, Michelle Doland, Doris Hall, Pages: 834, Published: 2005
How to Make it Big as a Consultant Authors: William A. Cohen, Pages: 348, Published: 2001
Language and Gender: A Reader Authors: Jennifer Coates, Pages: 513, Published: 1998
Difficult Conversations in Medicine Authors: Elisabeth Macdonald, Pages: 231, Published: 2004

Web:
Request.Form is not working, please help - Macromedia Dynamic HTML Request.Form is not working, please help Macromedia Dynamic HTML. ... language=" javascript">ShowDateTime(showDateTime)




Search This Site:










sitemap.current node - object reference not set to...

tree view question

findcontrol content/masterpage

getting page titles from sitemap

question on master pages

accessing controls in a wizard header?

skin file

tree view nodes text only

checked custom treenode appearance

sitemapnode "title" getting truncated with "..."

javascript popup calender with masterpage

menuitemclick event does not fire

my treeview webcontrols only works on my localhost and not on the website

menu control does not appear the same in ie and firefox

opening page in iframe along with masterpage

custom content for page derived from master.

frontpage within contentplaceholder ???

disabling treenode in a treeview programmatically

dynamically create wizardsteps

accessing usercontrol's properties that is in a master page from an aspx page

can i change a treeview's text size depending on what my browser's text size is set to?

disabling treenode checkedboxes (javascript) on load if parent is not checked

themes in .net 2.0 apply for html controls

user controls inside master page

master pages

how to change dynamically a sitemapnode of web.sitemap?

multiple instances of a user control on the same page

newbie - unable to apply css to my mywebsite

treeview's treenodecheckchanged problem

body background image (css) and themes

  Privacy | Contact Us
All Times Are GMT