[CLOSED] How to get Item selected from a CycleButton inside the method InitializeCulture()?

  1. #1

    [CLOSED] How to get Item selected from a CycleButton inside the method InitializeCulture()?

    Hi,

    The method that makes possible the translation "InitializeCulture()" is executed when the page is loaded before any other method or event is exected.

    I am using a CycleButton to change the languge causing a postback to execute InitializeCulture()

    Because this method is executed before the ItemClick event I am not sure how to get the item seleted in the InitializeCulture() method, could you help me with this please?

    The following example code shows how to do what I want using a asp DropDownList.

    protected override void InitializeCulture()
    {
        string culture = Request["DropDownLanguage"];
    }
  2. #2

    RE: [CLOSED] How to get Item selected from a CycleButton inside the method InitializeCulture()?

    Please post a simplified .aspx code sample demonstrating the complete scenario. I was not able to understand what should be happening based only on your description.

    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] How to get Item selected from a CycleButton inside the method InitializeCulture()?



    Hi Geoffry,

    I was able to solve part of the problem.

    My problem now it is that to make the translation done I need to use Response.Redirect to the current page after the user choose a language.

    When the page is reloaded the value of the active item text it is initialized again.

    Could you please tell me how to keep the active item selected after the page is reloaded in the CycleButton?

    Thanks,



  4. #4

    RE: [CLOSED] How to get Item selected from a CycleButton inside the method InitializeCulture()?

    Again, I don't really understand your requirements just based upon your description. If you need to do a Response.Redirect during a DirectEvent, you can give X.Redirect() a try.

    Hope this helps.


    Geoffrey McGill
    Founder
  5. #5

    RE: [CLOSED] How to get Item selected from a CycleButton inside the method InitializeCulture()?

    I Used X.Redirect() and it works fine, the problem it is that cycleButton.ActiveItem.Text does not keep the last item selected.
  6. #6

    RE: [CLOSED] How to get Item selected from a CycleButton inside the method InitializeCulture()?

    Hi,

    Please see the following sample which demonstrates how to read/set active item

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script runat="server">
            protected void ShowActive(object sender, DirectEventArgs e)
            {
                X.Js.Alert(CycleButton1.ActiveItem.Text);
            }
    
            protected void SetActive(object sender, DirectEventArgs e)
            {
                CycleButton1.ActiveItemIndex = 1;
            }
        </script>
    </head>
    <body style="padding: 10px">
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:CycleButton ID="CycleButton1" runat="server" ShowText="true">
                <Menu>
                    <ext:Menu ID="Menu1" runat="server">
                        <Items>
                            <ext:CheckMenuItem ID="CheckMenuItem1" runat="server" Text="Englis" Icon="Add" />
                            <ext:CheckMenuItem ID="CheckMenuItem2" runat="server" Text="Spanish" Icon="Plugin" Checked="true"/>
                        </Items>
                    </ext:Menu>
                </Menu>
            </ext:CycleButton>
            
            <ext:Button runat="server" Text="Show active">
                <DirectEvents>
                    <Click OnEvent="ShowActive"></Click>
                </DirectEvents>
            </ext:Button>
            
            <ext:Button runat="server" Text="Set active">
                <DirectEvents>
                    <Click OnEvent="SetActive"></Click>
                </DirectEvents>
            </ext:Button>
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] Always selected Item is nothing for combobox as menu item
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 04, 2011, 4:51 PM
  2. [CLOSED] CycleButton active item
    By smart+ in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 01, 2011, 12:20 PM
  3. [CLOSED] get the value of the selected item from a combobox via js
    By Edward in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 03, 2010, 12:06 PM
  4. [CLOSED] [1.0] Get selected item during directevent
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 25, 2010, 2:00 PM
  5. [CLOSED] ComboBox set selected item value
    By pumpkin in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 27, 2009, 7:26 AM

Posting Permissions