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 1 2991
Try moving the Datapager outside the Listview ItemTemplate. You should be
able to put it anywhere on the page, and set the PagedControlID to your
ListView
David Wier http://aspnet101.com http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
"shapper" <md*****@gmail.comwrote in message
news:50**********************************@d27g2000 prf.googlegroups.com...
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marc Gravell |
last post by:
In Linq, you can apparently get a meaningful body from and
expression's .ToString(); random question - does anybody know if linq
also includes a parser? It just seemed it might be a handy way to...
|
by: shapper |
last post by:
Hello,
I have two tables:
TagId, PostId
TagId, PostId
How can I delete, given a TagId, the record from Tags and all records
associated with it in PostTags.
|
by: =?Utf-8?B?UmFzbXVz?= |
last post by:
I have a simple LiveView control that databinds to a LinqDataSource that maps
to a table like this:
CREATE TABLE MyTable
(Id int NOT NULL,
Name nvarchar(50) NULL,
Picture image NULL)
The OR...
|
by: shapper |
last post by:
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...
|
by: =?Utf-8?B?TmVkaW0=?= |
last post by:
I am starting a new web application and I was planning on using linq but i
have a bunch of problems.
most forms will display some data from the database, but there always has to
be a filtering...
| |
by: Gaz |
last post by:
Im trying to use c# and linq to simplfy searching through a listview
but cannot get it to work can anyone help?
here is what i got so far which doesnt work.
var qry = from L in...
|
by: Brian Gaze |
last post by:
I have created a ListView control and have bound this to a datasource.
Within the ItemTemplate of the ListView I have added another ListViewControl
which is databound in the code behind. The idea...
|
by: Dean Slindee |
last post by:
Has anyone sourced a WinForm listview control from a LINQ query yet?
In my legacy code, the datasource for the listview has always been an
ADO.NET DataTable. The DataTable works well because it...
|
by: Lloyd Sheen |
last post by:
I was in a thread talking about how to populate a listview from a Linq
query. This got my curiosity up so I created a usercontrol which is a
listview which can be populated from a Linq query.
I...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |