I know that i am asking for this in .net 1.1 and datagrids, but unfortunately i have to work with a legacy system here instead of 2.0.
Now what i have created a CustomDataGrid class which Inherits System.Web.UI.Page. Within this class i am wanting it to deal with two things one bi-directional sorting and custom paging. The idea behind creating this class is that i can use my new CustomDataGrid and it will automatically have the given requirement and i don’t have to go around and include half a dozen additional controls to provide the additional functionality.
I have got the sorting working alright, but i am having a bit of trouble with the paging. I have spent a lot of time looking at different tutorials and stuff on the web but they all seem to miss the big picture.
- The pager needs to be in the following format (were 6 is the current page)
First Prev 4 5 6 7 8 Next Last of 45
- ALL of this items in the pager to link thought to the appropriate page (not
just the First/Prev/Next/Last links)
- I need this pager to be in the footer of the datagrid (again looking around
on the web, i couldn't find a datagrid that has a custom pager in the footer
of the datagrid)
- If the pager can be put into the footer i need it on the right and 'Record x -
y of z' on the right and the pager on the left (note i already can get all
of the information about what page i am on and how many records
there are in total and can derive the rest)
Now i tried to have a go at this but kept running into a few brick walls (i might be wrong though, i'm still working my way through .net so please help me out if i making a big mistake)
- because these pager items need to run events when they are clicked
i can't just build up the formatted HTML
- because i don’t want to include any additional controls on the each page
that i use this new class in, i have to dynamically build up the controls
and place them
- because i am dynamically building up the controls, i need to dynamically
bind events to these controls
- because they are dynamically added controls it makes it harder to add the
html formatting that i need to the pager (i.e. '<div class="navPagging">
<img src="image/buttonfirst.jpg" border="0"><img src="image/buttonprev.jpg"
border="0"><div> 3 4 <span class="selected">5</span> 6 7
</div><img src="image/buttonnext.jpg"><img src="image/buttonlast.jpg">
<div> of 34</div></div>', just pretend that it has the href tags were
they would need to go)
- because of the nested design of the pager and because of the dynamic creation
of each of the controls i would need to a few nested placeholders and the controls
being added at the relevant places
Thus, when looking at this method and the problems I was running into I thought that there must be an easer way of doing what i need to do. So i decided to ask some people smarter than me.