How do I capture the "Codes" drop down "SelectedIndexChanged" event?

Last post 05-19-2005, 2:35 PM by farid. 2 replies.
Sort Posts: Previous Next
  •  05-19-2005, 10:24 AM 6819

    How do I capture the "Codes" drop down "SelectedIndexChanged" event?

    Hello,

    How do I capture the "Codes" drop down "SelectedIndexChanged" event? on the server or the client side?

    Thanks,

    PS: I am open to suggestions (Server or Client solution).  Here is what I tried to do:


            private void PopulateMergeFields()
            {
                if(Editor1.ToolControls["Codes"]!=null)
                {
                    CuteEditor.RichDropDownList dropdown=(CuteEditor.RichDropDownList)Editor1.ToolControls["Codes"].Control;
                    
                    //the first item is just the caption
                    CuteEditor.RichListItem richitem=dropdown.Items[0];

                    //clear the items from configuration files
                    //see Configuration/Shared/Common.config
                    dropdown.Items.Clear();

                    //add the caption - Codes
                    dropdown.Items.Add(richitem);

                    ArrayList list = GetMergeFields();

                    for(int i = 0; i < list.Count; ++i)
                        dropdown.Items.Add(listIdea [I].ToString(), listIdea [I].ToString());

                    dropdown.Attributes["onchange"]="CuteEditor_DropDownCommand(this,'PastHTML')";
                }
            }




    And on the Html page, I added the following javascript function:

    <script language="javascript">
        function CuteEditor_DropDownCommand(element,caption)
        {
            //if the SelectedItem.Value == "[xyz]" then open a popup
            // so that the user can select more merge fields ...
            window.open('http://www.yahoo.com', 'Advanced Merge Fields');
        }
    </script>

    However, this doesn't work.  When I click on the drop down I get:


  •  05-19-2005, 1:16 PM 6834 in reply to 6819

    Re: How do I capture the "Codes" drop down "SelectedIndexChanged" event?

    Hello,
     
    PastHTML is not the right command name . maybe you want 'PasteHTML'
     
    Another way , you could do this:
     
    server code : dropdown.Attributes["onchange"]="MyHandleDropDown(this)";
     
    client script:

    function MyHandleDropDown(select)
    {
        var val=select.value;

        //do with the val here .
        //select.selectedIndex=0;

        CuteEditor_DropDownCommand(select,'PasteHTML');
    }
     
     
    Regards , Terry .
  •  05-19-2005, 2:35 PM 6841 in reply to 6834

    Re: How do I capture the "Codes" drop down "SelectedIndexChanged" event?

    Thanks.  I'll try it!
View as RSS news feed in XML