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(ByV al sender As Object, ByVal e As
EventArgs) Handles lvTags.Init
lvTags.DataKeyN ames = New String() {"TagID"}
lvTags.ID = "lvTags"
lvTags.ItemTemp late = New
TagsTemplate(Te mplateType.Item Template)
lvTags.LayoutTe mplate = New
TagsTemplate(Te mplateType.Layo utTemplate)
End Sub
Private Sub lvTags_Load(ByV al 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.DataSour ce = tags
lvTags.DataBind ()
End Sub ' lvTags_Load
And my DataPager code which I add inside the ListView ItemTemplate
implementation is:
Private Sub dpTags_Init(ByV al sender As Object, ByVal e As
EventArgs)
Dim dpTags As DataPager = CType(sender, DataPager)
Dim field As New NextPreviousPag erField
field.FirstPage Text = "<<"
field.PreviousP ageText = "<"
field.NextPageT ext = ">"
field.LastPageT ext = ">>"
dpTags.ID = "dpTags"
dpTags.PageSize = 8
dpTags.Fields.A dd(field)
End Sub ' dpTags_Init
Thanks,
Miguel 1 3019
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******** *************** ***********@d27 g2000prf.google groups.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(ByV al sender As Object, ByVal e As
EventArgs) Handles lvTags.Init
lvTags.DataKeyN ames = New String() {"TagID"}
lvTags.ID = "lvTags"
lvTags.ItemTemp late = New
TagsTemplate(Te mplateType.Item Template)
lvTags.LayoutTe mplate = New
TagsTemplate(Te mplateType.Layo utTemplate)
End Sub
Private Sub lvTags_Load(ByV al 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.DataSour ce = tags
lvTags.DataBind ()
End Sub ' lvTags_Load
And my DataPager code which I add inside the ListView ItemTemplate
implementation is:
Private Sub dpTags_Init(ByV al sender As Object, ByVal e As
EventArgs)
Dim dpTags As DataPager = CType(sender, DataPager)
Dim field As New NextPreviousPag erField
field.FirstPage Text = "<<"
field.PreviousP ageText = "<"
field.NextPageT ext = ">"
field.LastPageT ext = ">>"
dpTags.ID = "dpTags"
dpTags.PageSize = 8
dpTags.Fields.A dd(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
write a safe but easy implementation (i.e. no codedom) for an
IBindingListView.Filter (by compiling to a Predicate<T>).
Anybody know if this is possible at all?
Marc
|
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 mapper class (made in the VS 2008 designer) has a property of type
System.Data.Linq.Binary
|
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 number in the
DataPager something strange happens:
It always takes me 2 clicks for the action to be taken.
|
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 support - you need to be able to filter the data based on one
or more columns (I make the filter in runtime). The data also has to be paged
(with user selected sort column).
First I wanted to use the LinqDataSource for this, but it does not have a...
| |
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 listviewname.items.all
|
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 is that when clicking on the
"Show details" button the ListView for the appropriate row binds in the
codebehind and displays the detail data for the selected row. I did
something similar with a gridview control previously, but want to be able to...
|
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 provides the column
header names associated with the listview's datacolumn headers.
Can the column header information be provided by IQueryable object? Anyone
have some rudimentary sample code showing how to do this?
Thanks,
|
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 has all the same properties / methods available to a listview but behind
the scenes it is really a virtual listview. It is quick to load (33K items
in less than a second including the query).
It can be sorted and uses the dynamic linq vb...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |