4 posts, 0 answers
  1. Neil
    Neil avatar
    50 posts
    Member since:
    Mar 2009

    Posted 09 Jun 2010 Link to this post

    I am trying to hide the DataPager if not results are being returned.  Here is my markup:

    <telerik:RadListView ID="ProductResults" Width="100%" AllowPaging="True" runat="server" AllowSorting="true" ItemPlaceholderID="ProductsHolder" DataKeyNames="Key.Id"
                    <div class="PagingContainer" id="RadListView1"
                        <asp:Panel ID="ProductsHolder" runat="server" /> 
                        <asp:Panel ID="PagingPanel" runat="server"
                            <div id="Paging" runat="server" style="float: left; clear: both;"
                            <telerik:RadDataPager Skin="Default" AllowSEOPaging="true" SEOPagingQueryPageKey="page" 
                                Font-Bold="false" BackColor="#FFFFFF" BorderColor="#FFFFFF" ID="ProductResultsPager" 
                                runat="server" PagedControlID="ProductResults" PageSize="12"
                                    <telerik:RadDataPagerButtonField FieldType="FirstPrev" /> 
                                    <telerik:RadDataPagerButtonField FieldType="Numeric" /> 
                                    <telerik:RadDataPagerButtonField FieldType="NextLast" /> 
                                            <div style="float: right; text-align: right; font-family: Arial;"
                                                    <asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.Owner.StartRowIndex+1%>" /> 
                                                    <asp:Label runat="server" ID="TotalPagesLabel" Text="<%# Container.Owner.StartRowIndex+Container.Owner.PageSize %>" /> 
                                                    <asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.Owner.TotalRowCount%>" /> 
                                                    <br /> 
                    <div class="itemPicker" style="float: left; height: 75px; width: 215px; margin: 7px; padding: 10px 5px 10px 5px; border: solid 1px #ccc;"
                        <div style="width: 75px; float: left; margin: 0 0 0 5px;"
                            <id="ProductImageLink" runat="server"
                                <img border="0" src="<%# Eval("Value")%>"></a> 
                        <div style="width: 120px; float: left; padding-left: 10px;"
                            <id="ProductLink" class="ProductSearchGridResultTitle" runat="server"
                                <%# Eval("Key.Title")%> 

    I am using FindControl to get access to the DataPager, and when I step through my code, and value.count  is 0, I get a null exception  on dataPager:

    if (value.Count == 0) 
                        NoResults.Visible = true
                        RadDataPager dataPager = (RadDataPager)ProductResults.FindControl("ProductResultsPager"); 
                        dataPager.Visible = false


    Thanks in advance!

  2. Neil
    Neil avatar
    50 posts
    Member since:
    Mar 2009

    Posted 10 Jun 2010 Link to this post

    By adding FindingControl in a LayoutCreated event, I was able to hide the control.

    protected void ProductResults_LayoutCreated(object sender, EventArgs e) 
                if (ProductCountLiteral.Text == "0"
                    ((RadDataPager)ProductResults.FindControl("ProductResultsPager")).Visible = false

  3. Pams
    Pams avatar
    61 posts
    Member since:
    Sep 2010

    Posted 12 Oct 2010 Link to this post

    I have problem with finding controls
    I have a radgrid with several columns.
    And one column has gridtemplatecolumn. In the item template of grid template column i am having Radlistview. 
    My reqirement is I need to place a list of images in that colmn for each row. The nmber of images vary depending on the row id.
    So, I though of using Radlistview in the Itemtemplate of gridtemplatecolumn.
    <telerik:GridTemplateColumn UniqueName="DocumentStatus_Template">
         <label id="status">
             Document Status</label>
    <telerik:RadListView ID="DocumentStatusRadListView" runat="server" 
                             ItemPlaceholderID="DocumentStatusContainerPanel" >
                                    <asp:Panel ID="DocumentStatusContainerPanel" runat="server">
                                    <div class="Stacked">                                  
                                        <asp:Image ID="StatusImg" runat="server" />                               

    I get the data from database in the code behind and I am planning to bind the images for each row in the code behind.
    I will check the data of radgrid for each row and accordingly I have to bind the images. ( we have total of 5 images).
    But each row may contain any number from 1 to 5.
     Bt the problem is I am not able to get the Image ID in code behind so that I can give the image url.

       var listView = (item["DocumentStatus_Template"].FindControl("DocumentStatusRadListView") as RadListView);

    Is this right way to do. Or is there a better way to proceed
    Can I have a code snnippet.

    Thanks in advance
  4. Pavlina
    Pavlina avatar
    6162 posts

    Posted 14 Oct 2010 Link to this post

    Hi Pams,

    Please examine this article:
    Accessing cells and rows

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top