ListBox w/ LoadingPanel

4 posts, 0 answers
  1. Ron
    Ron avatar
    86 posts
    Member since:
    Sep 2009

    Posted 16 Jun 2011 Link to this post

    Hello,

    I have a small problem where items in a listbox are not visible after it has been populated.  The setup is very simple in that I have the RadAjaxManager and a RadAjaxLoadingPanel.  The RadAjaxManager is setup where I have a button as the AjaxControlID and the UpdateControl is the listbox.  When I click the button, which does a call to active directory to get a list of users and then populate those users in the listbox, the loadingpanel shows as expected over the listbox.  However, when the operation is complete and the loading panel is gone, the listbox appears empty with no items.  If I cause a post back from some other action, the items that should have appeared in the listbox will suddenly show up.  Without the AjaxManager and LoadingPanel, clicking the button will cause a normal postback and the listbox will properly display the items that were added to it.  Following is my html and the code for populating the box.

    <%@ Page Title="" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="securitymanagement.aspx.vb" Inherits="pages_securitymanagement" %>
      
    <asp:Content ID="HeaderContent" ContentPlaceHolderID="SiteHeadContent" Runat="Server">
    </asp:Content>
    <asp:Content ID="BodyContent" ContentPlaceHolderID="SiteBodyContent" Runat="Server">
        <telerik:RadAjaxManager ID="RadAjaxManager" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="SearchForObject">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ObjectList" 
                            LoadingPanelID="RadAjaxLoadingPanel" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" Runat="server" />
        <telerik:RadSplitter runat="Server" ID="SiteParent" Width="100%" BorderSize="0" BorderStyle="None"
            PanesBorderSize="0" Height="100%" Orientation="Vertical" VisibleDuringInit="false">
            <telerik:RadPane ID="LeftPane" runat="server" Width="300px" Scrolling="None">
                <div class="padding20">
                    <h4>Security Tasks</h4>
                    <div class="padding10top">
                        <asp:RadioButtonList ID="SecurityTasks" runat="server" AutoPostBack="true">
                            <asp:ListItem Text="Role Management" Value="0" Selected="True" />
                            <asp:ListItem Text="Membership Managment" Value="1" />
                        </asp:RadioButtonList>
                    </div>
                </div>
            </telerik:RadPane>
            <telerik:RadPane ID="RightPane" runat="server" Scrolling="Both" Height="100%" CssClass="panefix">
                <div class="padding20">
                    <telerik:RadMultiPage ID="MultiPage" SelectedIndex="0" RenderSelectedPageOnly="true" runat="server">
                        <telerik:RadPageView ID="RolesPage" runat="server">
                            <h4>Role Management</h4>
                            <div class="padding10top">
                                <div class="floatleft">
                                    <asp:Panel ID="CurrentRolesGroup" runat="server" GroupingText="Current Roles">
                                        <div class="padding10">
                                            <div>
                                                <telerik:RadListBox ID="RolesList" runat="server" Height="300px" AutoPostBack="true"
                                                Width="255px" DataSourceID="RoleManagementDataSource" DataKeyField="RoleName" 
                                                DataSortField="RoleName" DataTextField="RoleName" DataValueField="RoleName" />
                                            </div>
                                            <div class="padding10top"><telerik:RadButton ID="RemoveRole" Text="Remove" runat="server" Width="100px" /></div>
                                        </div>
                                    </asp:Panel>
                                </div>
                                <div class="floatleft padding20left">
                                    <asp:Panel ID="RolePermissionsGroup" runat="server" GroupingText="Role Permissions">
                                        <div class="padding10">
                                            <div>
                                                <telerik:RadListBox ID="RolePermissions" runat="server" Height="300px" Width="255px"
                                                CheckBoxes="true" DataSourceID="PermissionsDataSource" DataKeyField="permission_id"
                                                DataTextField="name" DataValueField="permission_id" Enabled="false" />
                                            </div>
                                            <div class="padding10top"><telerik:RadButton ID="ApplyPerms" Text="Apply" runat="server" Width="100px" /></div>
                                        </div>
                                    </asp:Panel>
                                </div>
                                <div class="floatleft clear">
                                    <asp:Panel ID="NewRoleGroup" runat="server" GroupingText="Role Permissions">
                                        <div class="padding10">
                                            <div><telerik:RadTextBox ID="NewRole" runat="server" Width="250px" /></div>
                                            <div class="padding10top"><telerik:RadButton ID="AddRole" Text="Add" runat="server" Width="100px" /></div>
                                        </div>
                                    </asp:Panel>
                                </div>
                            </div>
                        </telerik:RadPageView>
                        <telerik:RadPageView ID="MembershipPage" runat="server">
                            <h4>Membership Management</h4>
                            <div class="padding10top">
                                <div class="floatleft">
                                    <asp:Panel ID="RoleMembersGroup" runat="server" GroupingText="Current Roles">
                                        <div class="padding10">
                                            <div>Select Role:</div>
                                            <div>
                                                <asp:DropDownList ID="SelectRole" runat="server" DataSourceID="RoleManagementDataSource"
                                                DataTextField="RoleName" DataValueField="RoleName" AutoPostBack="true" Width="250px" />
                                            </div>
                                            <div class="padding10top">
                                                <telerik:RadListBox ID="MembersList" runat="server" Height="300px" Width="255px"
                                                DataSourceID="MembersDataSource" DataKeyField="UserName" DataTextField="UserName" DataValueField="UserName" />
                                            </div>
                                            <div class="padding10top"><telerik:RadButton ID="RemoveMember" Text="Remove" runat="server" Width="100px" /></div>
                                        </div>
                                    </asp:Panel>
                                </div>
                                <div class="floatleft padding20left">
                                    <asp:Panel ID="SearchMembersGroup" runat="server" GroupingText="Role Permissions">
                                        <div class="padding10">
                                            <div>Search User or Group:</div>
                                            <div><telerik:RadTextBox ID="ObjectToSearch" runat="server" Width="350px" /></div>
                                            <div class="padding10top">
                                                <telerik:RadListBox ID="ObjectList" runat="server" Height="300px" Width="355px" Sort="Ascending"  />
                                            </div>
                                            <div class="padding10top">
                                                <telerik:RadButton ID="SearchForObject" Text="Search" runat="server" Width="100px" />
                                                <telerik:RadButton ID="AddObject" Text="Add" runat="server" Width="100px" />
                                            </div>
                                        </div>
                                    </asp:Panel>
                                </div>
                            </div>
                        </telerik:RadPageView>
                    </telerik:RadMultiPage>
                </div>
            </telerik:RadPane>
        </telerik:RadSplitter>
        <asp:SqlDataSource ID="RoleManagementDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:aspcfg_db %>" 
            SelectCommand="aspnet_Roles_GetAllRoles" 
            SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:Parameter Name="ApplicationName" DefaultValue="MAC" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="PermissionsDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:mac_db %>" 
            SelectCommand="Permissions_GetAllPermissions" 
            SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="MembersDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:aspcfg_db %>" 
            SelectCommand="aspnet_UsersInRoles_GetUsersInRoles" 
            SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="SelectRole" Name="RoleName"
                    PropertyName="SelectedValue" Type="String" />
                <asp:Parameter Name="ApplicationName" DefaultValue="MAC" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </asp:Content>

    Protected Sub SearchForObject_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles SearchForObject.Click
        If Not ObjectToSearch.Text = String.Empty Then
            ObjectList.Items.Clear()
            Dim searchedObjects As SearchResultCollection = SearchForUsersGroups(ObjectToSearch.Text)
            For Each oneObject As SearchResult In searchedObjects
                Dim item As RadListBoxItem
                If oneObject.Properties.Contains("displayName") Then
                    item = New RadListBoxItem( _
                        oneObject.Properties("displayName")(0).ToString, _
                        oneObject.Properties("distinguishedName")(0).ToString)
                Else
                    item = New RadListBoxItem( _
                        oneObject.Properties("name")(0).ToString, _
                        oneObject.Properties("distinguishedName")(0).ToString)
                End If
                ObjectList.Items.Add(item)
            Next
            ObjectList.SortItems()
        End If
    End Sub

    Thanks,
    Ron
  2. Ron
    Ron avatar
    86 posts
    Member since:
    Sep 2009

    Posted 17 Jun 2011 Link to this post

    Anyone have any ideas?  In the meantime I did a test of using the asp.net ListBox control, and that also exhibits the same results of not showing the items in the listbox after they have been added until another postback is called.  Is there any type of refreshing I need to do to the list box?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ron
    Ron avatar
    86 posts
    Member since:
    Sep 2009

    Posted 17 Jun 2011 Link to this post

    As another test, I instead put the listbox and the button inside a RadAjaxPanel with an associated RadAjaxLoading Panel.  When I then click the button and perform the postback to populate the listbox with the result set from the Active Directory search, the items appear in the listbox as expected.  However, using this method rather than the RadAjaxManager provides for less flexibility.

    So i am still looking for a solution to using the RadAjaxManager.
  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 21 Jun 2011 Link to this post

    Hello Ron,

    Since you have already opened a support ticket for this issue, my suggestion is to continue the discussion there until we have a solution which could be shared here as a reference for other users.

    All the best,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top