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

MultiItemEdit

1 Answer 63 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Gijo
Top achievements
Rank 1
Gijo asked on 29 Aug 2011, 06:57 PM
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;

 

 

 

    }

}

 

1 Answer, 1 is accepted

Sort by
0
Gijo
Top achievements
Rank 1
answered on 31 Aug 2011, 05:30 PM

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();

 

 

}

 

Tags
TreeList
Asked by
Gijo
Top achievements
Rank 1
Answers by
Gijo
Top achievements
Rank 1
Share this question
or