Add event to Code Snippet Dropdown?

  •  03-03-2004, 11:21 AM

    Add event to Code Snippet Dropdown?

    In order to replace the functionality of the old editor in the content management application I'm updating, I need to add an event to the code snippet drop down change selection event.  In my C# application I added this code in Page_Load:

     

    // ** This code is tested and works.

    edlistKBType = new DropDownList();

    cmdType = new SqlCommand("select DisplayName, KBTemplateText from KB_TYPE ORDER BY DisplayOrder", conn);

    dtrType = cmdType.ExecuteReader();

    edlistKBType.DataSource = dtrType;

    edlistKBType.DataTextField = "DisplayName";

    edlistKBType.DataValueField = "KBTemplateText";

    edlistKBType.DataBind();

    dtrType.Close();

    cmdType.Dispose();

    kbEditor.CodeSnippetDropDown = edlistKBType;

    kbEditor.CodeSnippetsDropDownTitle = "Document Template";

    kbEditor.CodeSnippetsDropDownWidth = 200;

     

    // *** NEW CODE

    kbEditor.CodeSnippetDropDown.SelectedIndexChanged += new System.EventHandler(this.CodeSnippetDropDown_SelectedIndexChanged);

    kbEditor.CodeSnippetDropDown.AutoPostBack = true;

     

    Then I added this method to the class:

     

    private void CodeSnippetDropDown_SelectedIndexChanged(object sender,

    System.EventArgs e)

    {

    txtKBTitle.Text = kbEditor.CodeSnippetDropDown.SelectedItem.ToString() + ": " + txtKBTitle.Text;

    }

     

    So far, NO DICE.  It's not even succeeding on the AutoPostBack.  If I look at the source code for the .aspx page, the dropdown box isn't posting back, it's only doing the action where it inserts the source code snippet into the editor.  How can I add my new action to the events executed for CodeSnippetDropDown_SelectedIndexChanged ?

View Complete Thread