Radtree list view

6 posts, 0 answers
  1. sharath
    sharath avatar
    12 posts
    Member since:
    Aug 2014

    Posted 25 Aug 2014 Link to this post

    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 });
                    }
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Aug 2014 in reply to sharath Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. sharath
    sharath avatar
    12 posts
    Member since:
    Aug 2014

    Posted 22 Sep 2014 in reply to Shinu Link to this post

    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");
                }
            }
  5. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 25 Sep 2014 Link to this post

    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.

     
  6. sharath
    sharath avatar
    12 posts
    Member since:
    Aug 2014

    Posted 25 Sep 2014 in reply to Angel Petrov Link to this post

    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.
  7. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 30 Sep 2014 Link to this post

    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.

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