MultiItemEdit

2 posts, 0 answers
  1. Gijo
    Gijo avatar
    26 posts
    Member since:
    Jan 2008

    Posted 29 Aug 2011 Link to this post

    I have a TreeList with multiitemedit enabled as below.  Only one column 'Limit' is editable. I have two buttons placed outside the TreeList, one for edit and one for update(This is a user specification that the user doesn't want to go to each row and perform edit/update).  I have two problems here.

    1. I have to click the Edit button twice to bring the TreeList  to edit mode
    2. In the button click of Update button(btnUpdate_Click), I am not able to get the updated value in the edit box for 'Limit' column .

    Thanks in Advance!

    <

     

    telerik:RadTreeList ID="RadTreeList1" runat="server" DataKeyNames="ID" ParentDataKeyNames="PID"

     

     

    OnNeedDataSource="RadTreeList1_NeedDataSource" AutoGenerateColumns="false" HeaderStyle-Font-Bold="true" AllowMultiItemEdit= "true" EditMode="InPlace">

     

     

     

    <Columns>

     

     

    <telerik:TreeListBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID" Visible="false" ReadOnly="true">

     

     

    </telerik:TreeListBoundColumn>

     

     

    <telerik:TreeListBoundColumn DataField="PID" HeaderText="PID" UniqueName="PID" Visible="false" ReadOnly="true">

     

     

    </telerik:TreeListBoundColumn>

     

     

    <telerik:TreeListBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name" ItemStyle-Width="150px" HeaderStyle-Width="150px" ReadOnly="true">

     

     

    </telerik:TreeListBoundColumn>

     

     

    <telerik:TreeListBoundColumn DataField="Limit" HeaderText="Limit" UniqueName="Limit" ItemStyle-Width="150px" HeaderStyle-Width="150px">

     

     

    </telerik:TreeListBoundColumn>

     

     

    <telerik:TreeListBoundColumn DataField="Expense" HeaderText="Expense" UniqueName="Expense" ItemStyle-Width="150px" HeaderStyle-Width="150px" ReadOnly="true">

     

     

    </telerik:TreeListBoundColumn>

     

     

    </Columns>

     

     

    </telerik:RadTreeList>


     

     

    protected void RadTreeList1_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)

     

    {

        tbl =

    new CounterPartyHierarchy.CounterPartyHierachyTableDataTable();

     

        tbl.ReadXml(

    @"..\hierarchy.xml");

     

        RadTreeList1.DataSource = tbl;

    }

     

     

    protected void btnEdit_Click(object sender, EventArgs e)

     

    {

     

        foreach (TreeListDataItem item in RadTreeList1.Items)

     

        {

            item.Edit =

    true;

     

        }

    }

     

    protected void btnUpdate_Click(object sender, EventArgs e)

     

    {

     

        Hashtable table = new Hashtable();

     

     

        foreach (TreeListDataItem item in RadTreeList1.EditItems)

     

        {

            

     

     

    string limit= (item.GetColumnEditor("Limit") as TreeListTextBoxColumnEditor).TextBoxControl.Text;

     

     

     

        }

    }

     

  2. Gijo
    Gijo avatar
    26 posts
    Member since:
    Jan 2008

    Posted 31 Aug 2011 Link to this post

    Rebinding the TreeList to the datasource after setting Edit property of item to true did the trick. See below the changes

     

     

    protected void btnEdit_Click(object sender, EventArgs e)

     

    {

     

    foreach (TreeListDataItem item in RadTreeList1.Items)

     

    {

    item.Edit =

    true;

     

    }

    RadTreeList1.Rebind();

    }

     

    protected void btnUpdate_Click(object sender, EventArgs e)

     

    {

     

    Hashtable table = new Hashtable();

     

     

    foreach (TreeListDataItem item in RadTreeList1.EditItems)

     

    {

     

    string lastName = (item.GetColumnEditor("CreditLimit") as TreeListTextBoxColumnEditor).TextBoxControl.Text;

     

    item.Edit =

    false;

     

    }

    RadTreeList1.Rebind();

     

     

    }

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top