473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Pagination User Control + Class problems (C#)

markrawlingson
346 Expert 100+
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 CurrentPageIndex 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 CurrentPageIndex .

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 3526
markrawlingson
346 Expert 100+
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
by: Kruq | last post by:
Is it possible to use pagination with DataList? Can't find it.. :( Kruq
3
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
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. ...
3
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...
1
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...
0
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...
16
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) ...
4
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,...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
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 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.