DataPager Strange Behavior

Discussion in 'ASP .Net' started by shapper, Nov 22, 2007.

  1. shapper

    shapper Guest

    Hello,

    I am using the new ASP.NET 3.5 ListView and DataPager.

    Everything is working fine but I am getting a strange behavior in the
    DataPager.

    When I click a pager button for the first time nothing happens.

    When I click the second time it starts to work.

    For this moment on every time I click a pager button the action taken
    is the correspondent to my previous click.

    What is going on?

    My ListView uses a Linq as DataSource:

    Private Sub lvTags_Init(ByVal sender As Object, ByVal e As
    EventArgs) Handles lvTags.Init
    With lvTags
    .DataKeyNames = New String() {"TagId"}
    .DataSource = ldsTags
    .ID = "lvTags"
    .ItemTemplate = New
    ListTemplate(ListTemplate.TemplateType.ItemTemplate)
    .LayoutTemplate = New
    ListTemplate(ListTemplate.TemplateType.LayoutTemplate)
    End With
    End Sub

    Private Sub lvTags_Load(ByVal sender As Object, ByVal e As
    EventArgs) Handles lvTags.Load
    lvTags.DataBind()
    End Sub

    Private Sub ldsTags_Init(ByVal sender As Object, ByVal e As
    EventArgs) Handles ldsTags.Init
    ldsTags.ID = "ldsTags"
    End Sub

    Private Sub ldsTags_Selecting(ByVal sender As Object, ByVal e As
    LinqDataSourceSelectEventArgs) Handles ldsTags.Selecting
    Dim cms As New CMSDataContext
    Dim tags = From t In cms.Tags _
    Select t.TagID, _
    t.Text
    e.Result = tags
    End Sub


    The DataPager is created in the LayoutTemplate of my ListView
    implemented by the class ListTemplate that I created:

    Private Sub dpTags_Init(ByVal sender As Object, ByVal e As
    EventArgs)

    Dim dpTags As DataPager = CType(sender, DataPager)
    Dim npfPages As New NumericPagerField
    With npfPages
    .ButtonCount = 5
    .ButtonType = ButtonType.Link
    ........................................
    End With

    With dpTags
    .ID = "dpTags"
    .PageSize = 8
    .Add(npfPages)
    End With

    End Sub

    What am I doing wrong?

    Thanks,

    Miguel
    shapper, Nov 22, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shapper
    Replies:
    0
    Views:
    542
    shapper
    Nov 26, 2007
  2. Mark Olbert

    DataPager and ListView: Custom Datasource

    Mark Olbert, Jan 5, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    5,657
    Walter Wang [MSFT]
    Jan 9, 2008
  3. Nedim

    datapager with custom loading

    Nedim, Jan 5, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    446
  4. shapper

    Custom DataPager. How?

    shapper, Feb 24, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    531
    Michael Nemtsev [MVP]
    Feb 24, 2008
  5. shapper
    Replies:
    0
    Views:
    294
    shapper
    Mar 2, 2008
Loading...

Share This Page