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

paging, fetching data again

1 Answer 54 Views
ListView
This is a migrated thread and some comments may be shown as answers.
James Shelton Agar
Top achievements
Rank 2
James Shelton Agar asked on 25 Jun 2010, 01:20 AM
When the RadlistView page changed, it tend to call NeedDatasource and reload data, but when i say .datasouce = something; .databind(); when page change, it still go for needdatasource and try to reload data.
Is there anyway that the radlistview/grid not going round the trip and fetching data again? 

following code working but will fetch data again
 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="AListingsGrid"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="AListingsGrid" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <telerik:RadListView ID="AListingsGrid" runat="server" AllowPaging="True" ItemPlaceholderID="PropertiesContianer" 
        PageSize="1"
        <LayoutTemplate> 
            <fieldset id="RadListView1"
                <telerik:RadDataPager ID="RadDataPager2" PageSize="1" runat="server" Style="border: none;" 
                    PagedControlID="AListingsGrid"
                    <Fields> 
                        <telerik:RadDataPagerButtonField FieldType="Numeric" /> 
                    </Fields> 
                </telerik:RadDataPager> 
                <asp:PlaceHolder ID="PropertiesContianer" runat="server" /> 
            </fieldset> 
        </LayoutTemplate> 
        <ItemTemplate> 
            <div> 
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 
            </div> 
        </ItemTemplate> 
    </telerik:RadListView> 

  Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load 
        If Not Me.IsPostBack Then 
            
        End If 
    End Sub 
 
 
 
    Private Sub RadListView1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadListViewItemEventArgs) Handles AListingsGrid.ItemDataBound 
        If (TypeOf (e.Item) Is RadListViewDataItem) Then 
            Dim dataBoundItem = DirectCast(e.Item, RadListViewDataItem) 
            Dim astr = DirectCast(dataBoundItem.DataItem, String
            DirectCast(dataBoundItem.FindControl("Label1"), Label).Text = astr 
        End If 
    End Sub 
 
    Private Sub AListingsGrid_NeedDataSource(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadListViewNeedDataSourceEventArgs) Handles AListingsGrid.NeedDataSource 
        Dim alst As New List(Of String
        Dim i As Integer 
        For i = 0 To 10 
            alst.Add(String.Format("item {0}", i.ToString)) 
        Next 
        AListingsGrid.DataSource = alst 
    End Sub 

1 Answer, 1 is accepted

Sort by
0
BaiH
Top achievements
Rank 1
answered on 25 Jun 2010, 09:08 AM
No, the control needs the data for the next page, therefore you should supply it.

--BH
Tags
ListView
Asked by
James Shelton Agar
Top achievements
Rank 2
Answers by
BaiH
Top achievements
Rank 1
Share this question
or