TreeList command events don''t fire

4 posts, 0 answers
  1. Evgeniy
    Evgeniy avatar
    2 posts
    Member since:
    Nov 2011

    Posted 24 Nov 2011 Link to this post

    I use TreeList with OnItemCommand handler. In behind code I assign my UserControl  with TreeListEdit and insert as childItem.
    e.Item.OwnerTreeList.EditFormSettings.UserControlPath = " MyControl.ascx ";
      
    e.Item.OwnerTreeList.InsertChildItem((TreeListDataItem)e.Item, newFilterResult);

      In MyControl a have Button with Command = "InitInsert". Well, when I click on button, it dont't fire OnCommand handler. Please, help me to solve this problem.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 24 Nov 2011 Link to this post

    Hello Evgeniy,

    I tried the same scenario in the version 2011.2.712.35 and it worked as expected. Make sure that you have attached the handler for the TreeList.
    C#:
    protected void RadTreeList1_ItemCommand(object sender, TreeListCommandEventArgs e)
    {
     if (e.CommandName == "InitInsert")
     {//code here
     }
    }

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Evgeniy
    Evgeniy avatar
    2 posts
    Member since:
    Nov 2011

    Posted 24 Nov 2011 Link to this post

    Shure.  Look at this snippet.
    <telerik:RadTreeList ID="RadTreeList2" runat="server" ParentDataKeyNames="Parent"
    DataKeyNames
    ="GroupAttribute" AutoGenerateColumns="false" ItemStyle-Width="100%"
    OnItemCreated="RadTreeList2_ItemCreated"     OnItemCommand="RadTreeList2_ItemCommand"
    OnItemDataBound="RadTreeList2_ItemDataBound">

    If You understand me right, I have MyControl.ascx and use it in EditFormSettings like this
    <EditFormSettings UserControlPath="FilterEditText.ascx" EditFormType="WebUserControl" >
        <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
    </EditFormSettings>
    Inside MyControl.ascx I have  Button with Command="InitInsert". And it doesn't fire up in
    protected void RadTreeList2_ItemCommand (object sender, TreeListCommandEventArgs e)
    {
    ...
    }
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 25 Nov 2011 Link to this post

    Hello Evgeniy,

    I tried to replicate the described issue locally but to no avail. Please find attached a sample runnable application which demonstrates the correct firing of ItemCommand on Insert Button Click.
    Test the application on your side and let me know what the difference in your case is.

    Best wishes,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top