This is a migrated thread and some comments may be shown as answers.

TreeList command events don''t fire

3 Answers 77 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Evgeniy
Top achievements
Rank 1
Evgeniy asked on 24 Nov 2011, 08:23 AM
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.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Nov 2011, 09:59 AM
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.
0
Evgeniy
Top achievements
Rank 1
answered on 24 Nov 2011, 12:28 PM
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)
{
...
}
0
Maria Ilieva
Telerik team
answered on 25 Nov 2011, 09:53 AM
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
Tags
TreeList
Asked by
Evgeniy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Evgeniy
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or