473,379 Members | 1,544 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,379 software developers and data experts.

Help with Custom Datagrid Paging Links

I need some advice on how to acheive the desired result of my custom
page link generation. The datagrid 'built-in' page navigation only
allows either the 'Prev/Next' or the page numbers. (Prev/Next on top
and pg numbers on bottom is not an option) Therefore I am attempting
to create my own custom navigation where I am very close except for
the rendering of the page number links after clicking on one of them.
In other words, Initial page loads and everything is as expected.
Click on page 5 link and the page will reload with page 5 data,
however, the page link rendering is incorrect. The page number 5
should now be just text, instead it shows page number 1 still as text.
It does however postback the correct page number. The order of events
is click page number link, which fires setGridPage, which calls
binddata. If I make a call to buildpglink after this, I get 2 sets of
'Page Number links', one of which is correct, but I can't figure out
how to prevent it. I'm sure it's related to the fact I'm dynamically
generating these, the postback of the controls and the order or where
I make the calls. I believe that I need my pagelink to postback and
fire the event and then have all the pagelinks destroyed so that they
can be regenereated. Can someone tell me where the simple step is
that I've missed?

My codebehind basically has the following:

pageload()
if ispostback = False then
binddata()
buildPgLinks()
end if

Private Sub SetGridPage( ByVal src As Object, ByVal e as
CommandEventArgs )
dg.CurrentPageIndex = cint(e.CommandArgument)
BindData()
'BuildPageLinks()
End Sub

buildPgLinks()
'based on properties of the datagrid dg.currentpageindex and
dg.pagesize
I generate dynamically linkbuttons for the set of 'Page' Numbers I
need to
display.
if i <> artgrid.CurrentPageIndex then
genLink.CommandName = "pgLink"
genLink.CommandArgument = i.toString()
genLink.text = i.toString()
genspace = new literal
genspace.text = "&nbsp;"
' pl is a placeholder on the webform to contain the page number
links
pl.Controls.Add(genspace)
pl.Controls.Add(genLink)
AddHandler genLink.Command, Addressof SetGridPage
else
curpage.text = "&nbsp;<strong>[" & cstr(i) & "]</strong>&nbsp;"
pl.Controls.Add(curpage)
end if
binddata()
'retrieves data from database and binds to the datagrid

Thanks in advance,
Mark
Jul 21 '05 #1
0 1175

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Raed Sawalha | last post by:
I have aspx page with user control , in the user control i have DataGrid with custom paging the grid is displaying contents of datatable as following schema <xs:element name="id"...
2
by: asad | last post by:
Hello friends, i am designing a ASP.NET page where i want to use custom paging bcoz data is too heavy so pls tell me how can i use custom paging in ASP.NET Thanks
2
by: Axel Dahmen | last post by:
Hi, I'm using a DataGrid control to show a table's content with paging. For navigation through the pages I'm using the DataGrid's intrinsic navigation section. My problem: The DataGrid...
1
by: thechaosengine | last post by:
Hi all, Can somebody tell me if the built in paging support for the datagrid works when using a custom collection and a custom business object as the data. I was well pleased when I found that...
0
by: Mark | last post by:
I need some advice on how to acheive the desired result of my custom page link generation. The datagrid 'built-in' page navigation only allows either the 'Prev/Next' or the page numbers. ...
0
by: richard | last post by:
OK, Im finished pulling my hair out and now I need help. I have created a VB class file for my custom paging, in it I create a table with 2 rows, in the rows I have linkbuttons for first page,...
0
by: settyv | last post by:
Hi, I am using built-in pagination in datagrid with asp.net 1.1 .Now i need to display 1-50,50-100,etc at the top and bottom on the datagrid control to display records.Please let me know how...
0
by: rn5a | last post by:
In a shopping cart app, a user purchases 5 items on 31st March 2007. This is his 1st order. He places a 2nd order on 13th April in which he buys 8 items. Next he places his 3rd order on 16th April...
7
by: =?Utf-8?B?SmVmZiBCZWVt?= | last post by:
The default paging behavior of the gridview doesn't work well with very large sets of data which means we have to implement some sort of custom paging. The examples I have seen (4guysfromrolla,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.