More in this section

Forums / Developing with Sitefinity / Categories in Edit/Insert: event added not fire

Categories in Edit/Insert: event added not fire

2 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    10 Dec 2008
    Link to this post
    Hi,

    I have added one event SelectedIndexChanged inside CategoriesFields UC with the codebehin but my event don't fire. i have many problems with Categories and need more help to catch and use categories from editedMode not from stored as metafields.

    <asp:DropDownList ID="categoriesList" runat="server" OnSelectedIndexChanged="Cat_SelectedIndexChanged"></asp:DropDownList>


    cs
    protected void Cat_SelectedIndexChanged(object sender, EventArgs e)
    {
    //action
    }

    I have tried after with registrering and override the events

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    InitializeComponent();
    base.OnInit(e);
    }

    private void InitializeComponent()
    {
    this.categoriesList.SelectedIndexChanged += new System.EventHandler(this.Cat_SelectedIndexChanged);
    }
    #endregion


    But NOT FIRE!

    Thanks.
  2. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    01 Jun 2017
    10 Dec 2008
    Link to this post
    Hi Pierre,

    You should set the AutoPostBack property to true on your drop down list. Event is actually being fired, but the postback is not being performed.

    It should look like this:
    <asp:DropDownList ID="categoriesList" runat="server" OnSelectedIndexChanged="Cat_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList> 

    All the best,
    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered