RadTreeList TreeListBoundColumn valur void function

3 posts, 0 answers
  1. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 24 Jan 2013 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Jan 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 25 Jan 2013 Link to this post

    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.
Back to Top