S
shapper
Hello,
I have a ListView where I use LINQ for data, for example, selecting,
and deleting.
In the ListView item template I added a DataPager.
When I click, for example, "Next Page" or a page number in the
DataPager something strange happens:
It always takes me 2 clicks for the action to be taken.
The only thing that solves this is to move the code I have in my
ListView Load event to the ListView PreRender event.
Please, does anyone has any idea what I am doing wrong?
Here is my ListView code:
Private Sub lvTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Init
lvTags.DataKeyNames = New String() {"TagID"}
lvTags.ID = "lvTags"
lvTags.ItemTemplate = New
TagsTemplate(TemplateType.ItemTemplate)
lvTags.LayoutTemplate = New
TagsTemplate(TemplateType.LayoutTemplate)
End Sub
Private Sub lvTags_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Load
Dim database As New CodeDataContext
Dim tags = From t In database.Tags Select t.TagID, t.Text
lvTags.DataSource = tags
lvTags.DataBind()
End Sub ' lvTags_Load
And my DataPager code which I add inside the ListView ItemTemplate
implementation is:
Private Sub dpTags_Init(ByVal sender As Object, ByVal e As
EventArgs)
Dim dpTags As DataPager = CType(sender, DataPager)
Dim field As New NextPreviousPagerField
field.FirstPageText = "<<"
field.PreviousPageText = "<"
field.NextPageText = ">"
field.LastPageText = ">>"
dpTags.ID = "dpTags"
dpTags.PageSize = 8
dpTags.Fields.Add(field)
End Sub ' dpTags_Init
Thanks,
Miguel
I have a ListView where I use LINQ for data, for example, selecting,
and deleting.
In the ListView item template I added a DataPager.
When I click, for example, "Next Page" or a page number in the
DataPager something strange happens:
It always takes me 2 clicks for the action to be taken.
The only thing that solves this is to move the code I have in my
ListView Load event to the ListView PreRender event.
Please, does anyone has any idea what I am doing wrong?
Here is my ListView code:
Private Sub lvTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Init
lvTags.DataKeyNames = New String() {"TagID"}
lvTags.ID = "lvTags"
lvTags.ItemTemplate = New
TagsTemplate(TemplateType.ItemTemplate)
lvTags.LayoutTemplate = New
TagsTemplate(TemplateType.LayoutTemplate)
End Sub
Private Sub lvTags_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Load
Dim database As New CodeDataContext
Dim tags = From t In database.Tags Select t.TagID, t.Text
lvTags.DataSource = tags
lvTags.DataBind()
End Sub ' lvTags_Load
And my DataPager code which I add inside the ListView ItemTemplate
implementation is:
Private Sub dpTags_Init(ByVal sender As Object, ByVal e As
EventArgs)
Dim dpTags As DataPager = CType(sender, DataPager)
Dim field As New NextPreviousPagerField
field.FirstPageText = "<<"
field.PreviousPageText = "<"
field.NextPageText = ">"
field.LastPageText = ">>"
dpTags.ID = "dpTags"
dpTags.PageSize = 8
dpTags.Fields.Add(field)
End Sub ' dpTags_Init
Thanks,
Miguel