473,769 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pagination User Control + Class problems (C#)

markrawlingson
346 Recognized Expert Contributor
Hello,

For starters:

Yes, I am new to asp.net, however I hold a good 9-10 years of experience working with classic asp and am only just now upgrading my skills. I'm picking asp.net up pretty quickly but I'm running into a stumbling block that I just can't seem to get around. I think I know what the problem is, and I'm pretty confident in a work around, but it's not quite what I had hoped for so I thought I'd pick some of the experts brains to see what they think :)

I can't stand those bogus cookie cutter frontpage on drugs gridview dealios. I hated them the second I was introduced to them for the sole reason that one loses control over their data and exactly how that data gets displayed. So, I set out to "correct" that little problem and as such, I may be making my life a little bit more difficult than it has to be right now - but I'm confident it will pay off 100 fold in the future.

I found the repeater control after a few hours and I immediately fell in love. I still didn't like the dozens of lines worth of code in my code behind file that are necessary to support sorting, pagination, and binding the actual data to my repeater - so I set out to set it all up into an easy to use, customizable class object. I've done that, for the most part - but i am running into one LAST little hiccup... (figures, huh!?)

I set the pagination up into a Web User Control and I have that user control set up wonderfully. It displays the correct amount of pages, the next buttons and previous buttons appear and disappear when they are supposed to, the page changing pages. There are only two things I need to tell the custom control, and only one of those two things changes frequently.

1) How many pages are there in total.
2) Which page are we currently on

Obviouly, we need to track which page we are on.. so I set up a method in my class to do just that. It simply gets or sets an integer. That method is then called to change the CurrentPageInde x of my PagedDataSource .

The problem is, upon clickage of the "page" or "next" or "previous" buttons in the pagination control - the page/class seems to load BEFORE the new value gets set!

It's my suspicion that this is the way the compiler works - it first loads the class object, and then loads the page and deals with whatever from there.

If this is the case, It doesn't matter what I set the current page method to, it will always feed an OLD value to the pageddatasource 's CurrentPageInde x .

I have tried using the session instead, and even the viewstate to track and pass the value to the class object but it makes no difference, and if the above is true it stands to reason.

Can anyone suggest a workaround for this? I can think of perhaps using the querystring to track which page.. but that's just so ugly, isnt it?

Would appreciate all the advice you experts can give on this one!

Sincerely,
Mark
Apr 15 '09 #1
1 3556
markrawlingson
346 Recognized Expert Contributor
Oh, and i can provide the entire class if need be - I am just in a hurry right now else I would have posted it already :)
Apr 15 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5816
by: Kruq | last post by:
Is it possible to use pagination with DataList? Can't find it.. :( Kruq
3
8689
by: Joseph D. DeJohn | last post by:
I am trying to get pagination working on a datagrid. Can anyone point me to a resource for help on this? I'm not sure if custom paging is the best option or not.
11
2782
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. This works great and opens all images in the database when I open the url mywebsite/gallery.php, or I can choose certain images (by category) by going to url's like mywebsite/gallery.php?category=landscape Although the above worked perfectly...
3
1879
by: howardr101 | last post by:
Hi, I'm really new to this XSL stuff and there's a lot of information out there on the web, I just can't seem to find a definitive answer to my question, hence...... In FO, I know that you define a block and use the keep-together attribute to specify whether or not the block should be split over multiple pages - unless the block itself is longer than a page.
1
6851
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that i have written for pagination but it displays the link of all the pages at one go i.e. if i have 8 pages showing 10 results per page than it shows links for all 8 pages. Previous 1-10 11-20 21-30 31-40 41-50 51-60 61-70 71-80 Next i want to...
0
2918
by: George Ter-Saakov | last post by:
Trying to quickly create paginated grid. So i am using ListView. Unfortunatelly pagination works a little strange. Pagination control appears correctly. But when i click "2" page postback happens but current page is still first page. Then i click "3" page. Postback happens but current page is now "2" page. Then i click "4" page and again postback happens and page 3 becomes current. Why is that? How to make it work?
16
2779
by: gnawz | last post by:
I have a pagination function I am using in a file called functions.php as below<? //Pagination functions function getPagingQuery($sql, $itemPerPage = 10) { if (isset($_GET) && (int)$_GET > 0) { $page = (int)$_GET; } else { $page = 1; } // start fetching from this row number $offset = ($page - 1) * $itemPerPage; return $sql . " LIMIT $offset, $itemPerPage"; } /* Get the links to navigate between...
4
3575
by: ArizonaJohn | last post by:
Hello, The code below works great. The user enters a name into an HTML form, the code looks up a table with that name, and then that table is displayed. I am trying to use pagination with it, and the pagination almost works. The first page of the pagination works fine, but when I click on one of the links for one of the next pages, the page is blank. I have seen people mention this problem, and they have been told that a variable is...
2
2594
by: kkshansid | last post by:
this is my search page on which i am getting two parameters from previous page but the problem is that as soon as i click any other next pages my sql query fails as it doesnt get these two parameters kindly help <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title>
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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,...
0
10210
Oralloy
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...
1
9990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7406
isladogs
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...
0
6672
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3956
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
3
2814
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.