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

Radtree list view

5 Answers 82 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
sharath
Top achievements
Rank 1
sharath asked on 25 Aug 2014, 01:05 PM
Hello geeks,

In our project we're using telerik's Radtreelist which contains the fields. And this treelist is postback everytime after clicking clicking on + symbol also on clicking of book button which is available after clicking on + symbol. Please help. I'm posting my code as well.

This is .aspx code.

<telerik:RadTreeList ID="rtlAvailableSlots" runat="server" OnNeedDataSource="rtlAvailableSlots_NeedDataSource"
        ParentDataKeyNames="ParentID" DataKeyNames="ID" PageSize="10" AutoGenerateColumns="false"
        AllowSorting="true" AllowPaging="false" HeaderStyle-Height="0%" Height="100%"
        OnItemCommand="rtlAvailableSlots_ItemCommand" OnItemCreated="rtlAvailableSlots_ItemCreated">
        <Columns>
            <telerik:TreeListBoundColumn DataField="ID" UniqueName="ID" Visible="false" />
            <telerik:TreeListBoundColumn DataField="Name" UniqueName="Name" />
            <telerik:TreeListBoundColumn DataField="AdviserName" UniqueName="AdviserName" />
            <telerik:TreeListBoundColumn DataField="BookDetail" UniqueName="BookDetail" Visible="false" />
             <telerik:TreeListBoundColumn DataField="Appt_Mode" UniqueName="Appt_Mode" Visible="false" />
            <telerik:TreeListButtonColumn ButtonType="LinkButton" DataTextField="BookLinkText"
                CommandName="BookAppt">
            </telerik:TreeListButtonColumn>
            <telerik:TreeListImageColumn UniqueName="VideoImageColumn" DataImageUrlFields="VideoImageText"
                DataImageUrlFormatString="~/Graphics/Video16.png" ItemStyle-HorizontalAlign="Center">
            </telerik:TreeListImageColumn>
            <telerik:TreeListImageColumn UniqueName="ImagesColumn" DataImageUrlFields="PreferImageText"
                DataImageUrlFormatString="~/Graphics/{0}.png" ItemStyle-HorizontalAlign="Center"
                DataAlternateTextField="PreferToolTip">
            </telerik:TreeListImageColumn>
            <telerik:TreeListBoundColumn DataField="FacilityId" UniqueName="FacilityId" Visible="false" />
            <telerik:TreeListBoundColumn DataField="FacilityResource" UniqueName="FacilityResource" Visible="false" />
            <telerik:TreeListBoundColumn DataField="AdviserResource" UniqueName="AdviserResource" Visible="false" />
            <telerik:TreeListBoundColumn DataField="TravelDetail" UniqueName="TravelDetail" Visible="false" />
        </Columns>
        <ClientSettings>
            <ClientEvents OnKeyPress="showSpinner" />
        </ClientSettings>
    </telerik:RadTreeList>




This is .cs.

 
                if (!IsPostBack)
                {
                    rtlAvailableSlots.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 0, NestedLevel = 0 });
                    rtlAvailableSlots.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 1, NestedLevel = 0 });
                    rtlAvailableSlots.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 2, NestedLevel = 0 });
                }

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Aug 2014, 07:53 AM
Hi Sharath,

This is the default behavior of the color. In order to avoid the PostBack try to ajaxify the RadTreeList as follows.

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rtlAvailableSlots">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rtlAvailableSlots" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

Thanks,
Shinu.
0
sharath
Top achievements
Rank 1
answered on 22 Sep 2014, 10:28 AM
Hi ,Thanks for your reply. But even after ajaxifying, the entire page is reloading. We are using OnNeedDataSource methos to bind the data to the treelist. Please help me with this. I will paste my entire code below. Both .cs and aspx.


.aspx.

<telerik:RadTreeList ID="rtlAvailableSlots" runat="server" OnNeedDataSource="rtlAvailableSlots_NeedDataSource"
        ParentDataKeyNames="ParentID" DataKeyNames="ID" PageSize="10" AutoGenerateColumns="false"
        AllowSorting="true" AllowPaging="false" HeaderStyle-Height="0%" Height="100%"
        OnItemCommand="rtlAvailableSlots_ItemCommand" OnItemCreated="rtlAvailableSlots_ItemCreated">
        <Columns>
            <telerik:TreeListBoundColumn DataField="ID" UniqueName="ID" Visible="false" />
            <telerik:TreeListBoundColumn DataField="Name" UniqueName="Name" />
            <telerik:TreeListBoundColumn DataField="AdviserName" UniqueName="AdviserName" />
            <telerik:TreeListBoundColumn DataField="BookDetail" UniqueName="BookDetail" Visible="false" />
             <telerik:TreeListBoundColumn DataField="Appt_Mode" UniqueName="Appt_Mode" Visible="false" />
            <telerik:TreeListButtonColumn ButtonType="LinkButton" DataTextField="BookLinkText"
                CommandName="BookAppt">
            </telerik:TreeListButtonColumn>
            <telerik:TreeListImageColumn UniqueName="VideoImageColumn" DataImageUrlFields="VideoImageText"
                DataImageUrlFormatString="~/Graphics/Video16.png" ItemStyle-HorizontalAlign="Center">
            </telerik:TreeListImageColumn>
            <telerik:TreeListImageColumn UniqueName="ImagesColumn" DataImageUrlFields="PreferImageText"
                DataImageUrlFormatString="~/Graphics/{0}.png" ItemStyle-HorizontalAlign="Center"
                DataAlternateTextField="PreferToolTip">
            </telerik:TreeListImageColumn>
            <telerik:TreeListBoundColumn DataField="FacilityId" UniqueName="FacilityId" Visible="false" />
            <telerik:TreeListBoundColumn DataField="FacilityResource" UniqueName="FacilityResource" Visible="false" />
            <telerik:TreeListBoundColumn DataField="AdviserResource" UniqueName="AdviserResource" Visible="false" />
            <telerik:TreeListBoundColumn DataField="TravelDetail" UniqueName="TravelDetail" Visible="false" />
        </Columns>

.cs



 protected override void Page_Load(object sender, EventArgs e)
        {
            try
            {
                signedOnLanguage = globalSessionData.GetItem("SignedOn_Language");
                long selectedDay = apptSession.GetIntItem("SelectedSlotDayNumber");

                ExtendedXmlNode oSearchResponse = apptSession.GetExtendedXmlNodeItem("SearchRsp");

                // Building the page title
                Page.Title = SearchResultsDetail.FillTitleDetailText(
                                            selectedDay,
                                            finderSession.GetExtendedXmlNodeItem("Purpose_Data"),
                                            oSearchReq,
                                            oSearchResponse);

                // Creates a list of available slots to be displayed in the tree list
                bool amendMode = thisProcessID == AMConstants.AmendAppointment;

                slotBindlist = SearchResultsDetail.FillAvailabilitySlotDetail(
                                            selectedDay,
                                            oSearchReq,
                                            oSearchResponse,
                                            signedOnLanguage,
                                            GetLocalResourceObject("Preferred_Slot").ToString(),
                                            GetLocalResourceObject("Non_Preferred_Slot").ToString(),
                                            amendMode);

                if (!IsPostBack)
                {
                    rtlAvailableSlots.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 0, NestedLevel = 0 });
                    rtlAvailableSlots.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 1, NestedLevel = 0 });
                    rtlAvailableSlots.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 2, NestedLevel = 0 });
                }

                rtlAvailableSlots.ItemCommand += new EventHandler<TreeListCommandEventArgs>(rtlAvailableSlots_ItemCommand);

                // Make the video conference row visible if there is at least one slot that can hold a video appt
                trVideoConference.Visible = amendMode ? false : (slotBindlist.Where(x => x.Appt_Mode == (byte)ApptMode.VideoLink).Count() > 0);

            }


protected void rtlAvailableSlots_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
        {
            try
            {
                rtlAvailableSlots.DataSource = slotBindlist;
            }
            catch (Exception oExcept)
            {
                if (TraceConfiguration.SwitchOn(TraceType.Exception))
                    Tracer.SendEvent("", oExcept, "Function:{0}", "rtlAvailableSlots_NeedDataSource");
            }
        }
0
Angel Petrov
Telerik team
answered on 25 Sep 2014, 07:24 AM
Hello,

As Shinu mentioned this is the default behavior of the control. When the user presses the expand button the control triggers a postback in order to create and populate the child items. However by ajaxifying only the RadTreeList you should be able to avoid a full page reload. From that point of view it seems that there might be a problem in the AJAX configuration.

Please share with us the entire page contents(markup and code-behind) so we could research what is causing the unwanted behavior. If the page is ajaxifyed by a RadAjaxManager please remove it and wrap only the RadTreeList in a RadAjaxPanel. That way you should be able to achieve the desired effect.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
sharath
Top achievements
Rank 1
answered on 25 Sep 2014, 09:10 AM
Thanks a lot for coming back with answer Angel. Initially i had ajaxified , the radtreeview, since it didn't work, i removed it. Please find the respective .aspx page and .cs page in the attachment. Please remove the .png from all the three files attached.
0
Angel Petrov
Telerik team
answered on 30 Sep 2014, 07:30 AM
Hello,

From the provided code I did not notice a RadAjaxManager or RadAjaxPanel definition which means that it is expected for the entire content to be refreshed since a full postback will occur when a RadTreeList node gets expanded. However by wrapping the RadTreeList in a RadAjaxPanel(as demonstrated below) you should be able to resolve the problem.

ASPX:
<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">
        <telerik:RadTreeList ID="rtlAvailableSlots" runat="server" OnNeedDataSource="rtlAvailableSlots_NeedDataSource"
            ParentDataKeyNames="ParentID" DataKeyNames="ID" PageSize="10" AutoGenerateColumns="false"
            AllowSorting="true" AllowPaging="false" HeaderStyle-Height="0%" Height="100%"
            OnItemCommand="rtlAvailableSlots_ItemCommand" OnItemCreated="rtlAvailableSlots_ItemCreated">
            <Columns>
                ....
        <clientsettings>
            <ClientEvents OnKeyPress="showSpinner" />
        </clientsettings>
        </telerik:RadTreeList>
    </telerik:RadAjaxPanel>

If the issue persist after applying the above please share with us a runnable sample which clearly illustrates it. That way we will inspect it locally and precisely determine what is causing the problem on hand.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeView
Asked by
sharath
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
sharath
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or