1

I am applying globalization on my hotel management system web portal and I am stuck with an issue.My issue is that I have a drop down list of two languages English and Spanish and I set autopostback="true" so from drop down I select spanish and my web page successfully convert english language to spanish by calling the method below

 protected override void InitializeCulture()
        {

            if (Request.Form["ctl00$contentplaceholder1$language_drp"] != null)
            {

                UICulture = Request.Form["ctl00$contentplaceholder1$language_drp"];
            }

            base.InitializeCulture();
        }

As I have set autopostback property true so this function get called successfull. and I have also edit control from which I can edit my hotel details in spanish or in english and I have used tab container for all information's of hotels. but when I click on edit my page doesnot post back to true that is why I am unable to call iniliaze culture method and that is why I my page language is not convertable. I applied autopostback property true in tabcontainer but failed. in tab container I have tab panels. here is my code

<asp:TabContainer ID="TabContainerHotelDetails" runat="server" AutoPostBack="true"  
            Width="100%" OnLoad="TabContainerHotelDetails_Load">
            <asp:TabPanel runat="server"  HeaderText="General" ID="TabGeneral" >
                <ContentTemplate>
                    <asp:Panel ID="PanelInfo" runat="server"  Width="100%" GroupingText="<%$ Resources:Resource, LocalizedInformation %>">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="20%">
                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaHotelName" runat="server" Text="<%$ Resources:Resource, LocalizedHotelName %>"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaHotelStatus" runat="server" Text="<%$ Resources:Resource, LocalizedStatus %>"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaMemberShip" runat="server" Text="<%$ Resources:Resource, LocalizedMemberShipType %>"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaUserName" runat="server" Text="<%$ Resources:Resource, LocalizedUserName %>"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaEmail" runat="server" Text="<%$ Resources:Resource, LocalizedEmail %>"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaTotalPoint" runat="server" Text="<%$ Resources:Resource, LocalizedTotalPoint %>"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaRegistrationDate" runat="server" Text="<%$ Resources:Resource, LocalizedRegisteredDate %>"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaLastLogin" runat="server" Text="<%$ Resources:Resource, LocalizedLastLogin %>"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaEmailActivated" runat="server" Text="<%$ Resources:Resource, LocalizedEmailActivated %>"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="metaLockedOut" runat="server" Text="<%$ Resources:Resource, LocalizedLockedOut %>"></asp:Label>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td width="5%" style="border-right: 1px dotted black;">
                                </td>
                                <td>
                                    <table border="0" cellpadding="0" cellspacing="0" style="padding-left: 10px;">
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="lblHotelName" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="lblStatus" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="lblMembershipType" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="lblUserName" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="lblEmail" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="lblTotalPoints" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="lblRegisteredDate" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:Label ID="lblLastLogin" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:CheckBox ID="chkEmailActivated" runat="server" OnCheckedChanged="chkEmailActivated_CheckedChanged"
                                                    AutoPostBack="True" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 10px; height: 30px;">
                                                <asp:CheckBox ID="chkLockedOut" runat="server" OnCheckedChanged="chkLockedOut_CheckedChanged"
                                                    AutoPostBack="True" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>

Is there any way I can easily do this or alternatives for this so my iniliazeculture method get called after I click on edit. Please help as I am very new to stack overflow. I don't actually know good way to post questions.

Lain
  • 2,166
  • 4
  • 23
  • 47
aami
  • 297
  • 2
  • 8
  • 20

2 Answers2

0

you can use web method to initializeculture. for that you have to initially create javascript method that will call when you clicked on edit tab and from that script you can call page level web method to initializeculture. hopefully this will help you.

Candy
  • 407
  • 1
  • 7
  • 19
  • update panel will work when there is postback. in your case the postback is not occuring on clicking of edit tab. – Candy Mar 21 '13 at 05:48
  • what about it if i use update panel under my tabcontainer and set autopost back property true ? but actual problem is tab container autopost back is set to true but why tab tab panels under tab container not post back the page? – aami Mar 21 '13 at 05:50
  • i am thinking about another solution,is there any way i post back another page while getting page id from query string ? see if (Request.QueryString["HotelID"] != null) //here i want to post back page { mean to say that when i click on edit button which is on another page so how i can post back my first page where i want to initialize culture? i simply want to post back first page to call my iniliaze culture after query string ? is that any idea? – aami Mar 21 '13 at 06:28
0

here i found answer after two days of my searching. the answer is very simple :)

i set the value of my language to UICulture

protected override void InitializeCulture()
        {
            if (Request.Form["ctl00$contentplaceholder1$language_drp"] != null)
            {

                UICulture = Request.Form["ctl00$contentplaceholder1$language_drp"];
            }
            if (Request.QueryString["HotelID"] != null)
            {

                this.UICulture = "es";
            }
            base.InitializeCulture();
        }

and its working fine :)

aami
  • 297
  • 2
  • 8
  • 20