Support forums
in

Can a dropdown selection trigger a popup?

Last post 03-06-2006, 2:08 PM by rokinroj. 2 replies.
Sort Posts: Previous Next
  •  03-03-2006, 7:18 PM 16694

    Can a dropdown selection trigger a popup?

    I am trying to use javascript to pop a window based on an item selection in a custom dropdown.
     
    protected void Page_Load(object sender, System.EventArgs e)
    {
     // Put user code to initialize the page here
     Ajax.Utility.RegisterTypeForAjax(typeof(EditContent));
            
            Editor.AutoConfigure = CuteEditor.AutoConfigure.Default;
            if (!IsPostBack)
            {
                  CuteEditor.ToolControl toolctrl = Editor.ToolControls["CustomItems"];
                  if (toolctrl != null)
                  {
                       CuteEditor.RichDropDownList dropdown = (CuteEditor.RichDropDownList)toolctrl.Control;
       
                       //Add the onchange attribute to the dropdown to call my custom function
                       dropdown.Attributes["onchange"] = "DropDownChange(this)";
                       //the first item is the caption       
                       CuteEditor.RichListItem richitem = dropdown.Items[0];
                       //clear the items from configuration files       
                       dropdown.Items.Clear();
                       //Add the items and values to the list
                       dropdown.Items.Add(richitem);
       
                       //Add the new items to the drop down
                       dropdown.Items.Add("Insert Footer Info","Insert Footer Info");
                       dropdown.Items.Add("Insert Header Info", "Insert Header Info");
                  }
            }
    }
     
    function DropDownChange(element)
    {
     //check element for desired values
     alert(element);
     alert(element.value);
     alert(element.toString());
     alert(element.name);
    }
     
    Of course I don't want to just alert the values, but at that point I should be able to see the values that were past over, but I dont.  All of the alert box's say eith '0' or "undefined'.  Is there abetter way to do this?
     
    Thanks
     
     
  •  03-06-2006, 11:45 AM 16757 in reply to 16694

    Re: Can a dropdown selection trigger a popup?

    Please try the following code:
     
    function DropDownChange(element)
    {
     
     var editor=CuteEditor_GetEditor(element);
       
     if(element._IsRichDropDown=="True")
     {
      var val=element.GetValue();
      if(val=='null')val='';
      try
      {
       alert(val);
      }
      finally
      {
       element.SetSelectedIndex(0);
      }
     }
     else
     {
      try
      {
       if(element.value)
       {
        var val=element.value;
        if(val=='null')val='';
        alert(val);
       }
      }
      finally
      {
       element.selectedIndex=0;
      }
     }
     editor.FocusDocument();
    }

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-06-2006, 2:08 PM 16763 in reply to 16757

    Re: Can a dropdown selection trigger a popup?

    Very nice!  Thanks  :-)
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems