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

RadTreeList TreeListBoundColumn valur void function

2 Answers 72 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
mohamed
Top achievements
Rank 1
mohamed asked on 24 Jan 2013, 12:07 PM
How to find the treelistboundcolumn value in void function call

<telerik:RadTreeList ID="RadTreeListWork" runat="server" OnNeedDataSource="RadTreeListWork_NeedDataSource"
                        ParentDataKeyNames="WorkParentId" DataKeyNames="WorkId" AutoGenerateColumns="False"
                        OnItemDataBound="RadTreeListWork_ItemDataBound" EditMode="PopUp" AllowMultiItemEdit="False"
                        Culture="(Default)" GridLines="None" IsItemInserted="false" ShowOuterBorders="False"
                        Width="900px">
                        <%--AllowPaging="true" PageSize="10"--%>
                        <Columns>
                            <telerik:TreeListBoundColumn DataField="WorkId" HeaderText="WorkId" ReadOnly="true"
                                UniqueName="WorkId" HeaderStyle-Width="75px" ForceExtractValue="Always" Visible="false" />
                            <telerik:TreeListBoundColumn DataField="WorkParentId" HeaderText="WorkParentId" HeaderStyle-Width="65px"
                                UniqueName="WorkParentId" ReadOnly="true" ForceExtractValue="Always" Visible="false" />
                            <telerik:TreeListBoundColumn DataField="WorkName" HeaderText="Name" UniqueName="WorkName"
                                HeaderStyle-Width="70px" />
                            <telerik:TreeListBoundColumn DataField="WorkDescription" HeaderText="Description"
                                UniqueName="WorkDescription" HeaderStyle-Width="170px" />


.cs

foreach (TreeListDataItem item in RadTreeListWork.Items)
               {
                   dtl1 = new xmlDSPrepareClaimDtl();
 
                   int? id = (int?)item.GetDataKeyValue("WorkId");
                   int? Parentid = (int?)item.GetDataKeyValue("WorkParentId");

i find like that id is coming but parent id and other things are not come

Thanks Advance,
Mohamed.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Jan 2013, 04:36 AM
Hi,

Try the following code snippet to achieve your scenario.

C#:
foreach (TreeListDataItem item in RadTreeList1.Items)
   {
      string Parentid = item["WorkParentId"].Text;
   }

Hope this helps.

Regards,
Princy.
0
mohamed
Top achievements
Rank 1
answered on 25 Jan 2013, 06:49 AM
Thanks for ur reply Princy,

see the image if i click the submit button one of the treelist value clear ,
that field is entry field another one field is assign field and also read only ,

.aspx
<telerik:TreeListTemplateColumn HeaderText="Quantity " HeaderStyle-Width="50px" DataField="EntQnty1"
                                UniqueName="EntQnty">
                                <ItemTemplate>
                                    <telerik:RadNumericTextBox MaxLength="5" ID="EntQntyId" Width="50px" runat="server">
                                    </telerik:RadNumericTextBox>
                                    <asp:HiddenField ID="HdnQuantity" runat="server" Value='<%# Bind("Quantity") %>' />
                                </ItemTemplate>
                            </telerik:TreeListTemplateColumn>
                            <telerik:TreeListTemplateColumn HeaderText="Balance Qty" HeaderStyle-Width="70px"
                                DataField="EntQnty" UniqueName="BalanceQty">
                                <ItemTemplate>
                                    <telerik:RadNumericTextBox runat="server" ID="BalQnty2" MaxLength="5" ReadOnly="true"
                                        Width="70px">
                                    </telerik:RadNumericTextBox>
                                </ItemTemplate>
                            </telerik:TreeListTemplateColumn>

.cs
protected void Submit_Click(object sender, EventArgs e)
        {
            //Response.Redirect("AssignEmail.aspx");
 
            foreach (TreeListDataItem item in RadTreeListWork.Items)
            {
                int? id = (int?)item.GetDataKeyValue("WorkId");               
                double? value = (item["EntQnty"].FindControl("EntQntyId") as RadNumericTextBox).Value;
                if (value > 0)
                {
                    string preference = ("UPDATE WorkDefination SET BalanceQty = '" + value + "'  where WorkId = " + id);
                    long RecordAffect = oDBClientADO.ExecuteSql(preference);
                }
            }
            //addsav();
        }


Thanks advance,
Mohamed.
Tags
TreeList
Asked by
mohamed
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
mohamed
Top achievements
Rank 1
Share this question
or