Datapager does not change the results shown

5 posts, 0 answers
  1. John Smith
    John Smith avatar
    11 posts
    Member since:
    Oct 2009

    Posted 13 Sep 2010 Link to this post

    The page tabs show up on the datapager, and only the first 10 items are shown.   When I click on one of the page numbers though, a) the results don't change; b) the new page number is not highlighted (when I click a second time, it is highlighted however but the results still don't change).

    Any help would be much appreciated.

    My aspx markup:
    <table border="0" cellspacing="0" cellpadding="4">
        <tr>
            <td>
                <telerik:RadTextBox ID="txtInstitutionName" runat="server" Columns="30" /><asp:RequiredFieldValidator
                    ID="RequiredFieldValidator1" ControlToValidate="txtInstitutionName" runat="server"
                    ErrorMessage="*" />
            </td>
            <td>
                <asp:Button ID="btnSearch" runat="server" Text="Search" />
            </td>
        </tr>
    </table>
    <telerik:RadListView ID="listInstitutions" runat="server" AllowPaging="true">
        <ItemTemplate>
            <li>
                <%# Eval("InstitutionName") %></li>
        </ItemTemplate>
        <EmptyDataTemplate>
            No financial institution was found.</EmptyDataTemplate>
        <LayoutTemplate>
            <ul>
                <li id="itemPlaceholder" runat="server" />
            </ul>
            <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="listInstitutions" PageSize="10" >
                <Fields>
                    <telerik:RadDataPagerButtonField FieldType="Numeric" />
                </Fields>
            </telerik:RadDataPager>
        </LayoutTemplate>
    </telerik:RadListView>


    My code for clicking the submit button:
    InstitutionContext = New ProjectTobyEntities()
     
    Dim institutionQuery As ObjectQuery(Of Institution) = _
        From i In InstitutionContext.Institutions _
        Where i.InstitutionName.Contains(txtInstitutionName.Text) And i.Active = True
        Select i
     
    listInstitutions.DataSource = CType(institutionQuery, ObjectQuery).Execute(MergeOption.NoTracking)
    listInstitutions.DataBind()
  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 13 Sep 2010 Link to this post

    Hi John,

    Please verify that you have correctly configure RadListView to use advanced data-binding (through NeedDataSource).

    Regards,
    Rosen
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John Smith
    John Smith avatar
    11 posts
    Member since:
    Oct 2009

    Posted 13 Sep 2010 Link to this post

    Hi Rosen

    Well, no I hadn't.   I believe I have now though:

    I added this sub:
    Private Sub listInstitutions_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadListViewNeedDataSourceEventArgs) Handles listInstitutions.NeedDataSource
        InstitutionContext = New ProjectTobyEntities()
     
        Dim institutionQuery As ObjectQuery(Of Institution) = _
            From i In InstitutionContext.Institutions _
            Where i.InstitutionName.Contains(txtInstitutionName.Text) And i.Active = True
            Select i
     
        listInstitutions.DataSource = CType(institutionQuery, ObjectQuery).Execute(MergeOption.NoTracking)
    End Sub

    And also modified the markup like this:
    <telerik:RadListView ID="listInstitutions" runat="server" AllowPaging="true"
        OnNeedDataSource="listInstitutions_NeedDataSource" DataKeyNames="InstitutionId" >

    But I now get a compilation error: BC30456: 'listInstitutions_NeedDataSource' is not a member of 'ASP.accountadd_aspx'.

    Any further help about where I've gone wrong would be greatly appreciated.  Regards, John
  5. John Smith
    John Smith avatar
    11 posts
    Member since:
    Oct 2009

    Posted 13 Sep 2010 Link to this post

    Solved!  I managed to solve this by removing 

    OnNeedDataSource="listInstitutions_NeedDataSource"

    from the markup.   I don't know if this is a problem with the example code, or just my not understanding the code well enough.

    Thanks for your help, Rosen.

    Regards, John
  6. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 13 Sep 2010 Link to this post

    Hello John,

    As you may know in order code-behind methods/properties to be accessible from page's markup their accessibility level should be at least protected.
    Also you do not need to hook the handler in the markup as you have already set it in the code behind.

    All the best,
    Rosen
    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
UI for ASP.NET Ajax is Ready for VS 2017