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

update panel didn't close after updating

1 Answer 10 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Ray
Top achievements
Rank 1
Ray asked on 30 Sep 2013, 08:57 AM
Hi experts,

I have two simple questions:

1. I use treelist default update panel for updating/inserting, it works fine except that the panel didn't collapse after I click 'update' button, the data has been updated though, so I need to click 'cancel' button to hide the update panel after updating.

2. I wonder how to define the textbox width in update panel, I didn't see anything obvious setting.

My aspx code :
<telerik:RadTreeList ID="RadTreeList1" runat="server"
              OnUpdateCommand="RadTreeList1_UpdateCommand"
              OnInsertCommand="RadTreeList1_InsertCommand"
              OnDeleteCommand="RadTreeList1_DeleteCommand"
              DataSourceID="SqlDataSource1"
              AllowMultiItemSelection="True"
              ParentDataKeyNames="parentId"
              DataKeyNames="id" AutoGenerateColumns="False" Skin="Office2007"
              AllowRecursiveDelete="True"
              OnItemDrop="RadTreeList1_ItemDrop"
              >
 
               <Columns>
                    <telerik:TreeListDragDropColumn Visible="true" HeaderStyle-Width="20px" UniqueName="TreeListDragDropColumn"></telerik:TreeListDragDropColumn>
                     <telerik:TreeListTemplateColumn Visible="false" HeaderText="" UniqueName="ColumnUniqueName" DataField="Id">
                      <ItemTemplate>
                          <asp:Label ID="lblId" runat="server" Text='<%# Bind("Id") %>' Visible="false"></asp:Label>
                      </ItemTemplate>
                     </telerik:TreeListTemplateColumn>
 
                    <telerik:TreeListEditCommandColumn UniqueName="InsertCommandColumn" ButtonType="ImageButton" ShowEditButton="false" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center"></telerik:TreeListEditCommandColumn>
 
                    <telerik:TreeListButtonColumn CommandName="Edit" Text="Edit" UniqueName="EditCommandColumn" ButtonType="ImageButton" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center"></telerik:TreeListButtonColumn>
 
                    <telerik:TreeListButtonColumn UniqueName="DeleteCommandColumn" Text="Delete" CommandName="Delete" ButtonType="ImageButton" HeaderStyle-Width="30px"></telerik:TreeListButtonColumn>
 
                    <telerik:TreeListBoundColumn Visible="false" DataField="id" HeaderText="ID" ReadOnly="true" UniqueName="id" HeaderStyle-Width="60px" ForceExtractValue="Always"></telerik:TreeListBoundColumn>
 
                    <telerik:TreeListBoundColumn DataField="title" HeaderText="Title" UniqueName="title" HeaderStyle-Width="300px"></telerik:TreeListBoundColumn>
 
                    <telerik:TreeListBoundColumn DataField="link" HeaderText="Link" UniqueName="link" HeaderStyle-Width="300px"></telerik:TreeListBoundColumn>
 
                    <telerik:TreeListBoundColumn DataField="rank" HeaderText="Rank" UniqueName="rank" HeaderStyle-Width="60px"></telerik:TreeListBoundColumn>
 
                    <telerik:TreeListBoundColumn Visible="false" DataField="parentId" HeaderText="Parent ID" HeaderStyle-Width="80px" ReadOnly="true"></telerik:TreeListBoundColumn>
 
               </Columns>
               <ClientSettings AllowItemsDragDrop="true">
                              <Selecting AllowItemSelection="True"></Selecting>
                              <ClientEvents OnItemDropping="itemDropping" OnItemDragging="itemDragging"
                              OnTreeListCreated="function(sender) { treeList1 = sender; }">
                              </ClientEvents>
                         </ClientSettings>
          </telerik:RadTreeList>



Many thanks for your help!
Ray

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 03 Oct 2013, 08:55 AM
Hi Ray,

Please refer to  this help article regarding updating "RadTreeList". Also, please ensure that you have the following in your "UpdateCommand":
protected void RadTreeList1_UpdateCommand(object sender, Telerik.Web.UI.TreeListCommandEventArgs e)
{
    //Canceling out the automatic datasource operation (needed if you use a datasource control)
    e.Canceled = true;
 
    ....
 
    //Closing the edit form and rebinding the treelist control
    RadTreeList1.EditIndexes.Clear();
    RadTreeList1.Rebind();
}

About your second question, you could handle the "ItemCreated" server-side event and change the "TreeListEditFormItem" TextBox control "Width" property as shown bellow:
protected void RadTreeList1_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
{
    if (e.Item is TreeListEditFormItem)
    {
        TreeListEditFormItem item = e.Item as TreeListEditFormItem;
        (item["title"].Controls[0] as TextBox).Width = Unit.Pixel(50);
    }
}

Hope that helps

 

Regards,
Konstantin Dikov
Telerik
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 the blog feed now.
Tags
TreeList
Asked by
Ray
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or