473,734 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid paging without javascript?

Simple question:

How to make datagrid paging work without javascript? I have a simple
datagrid, which gets populated by a dataview, it works perfectly, paging
works too, but, as I said, it does only with javascript. I know how to set
the index of the grid etc. My Idea would be using my own links (with
query-parameters attached on them, the parameter would transport the position
of the targeted page in the grid) I just need basicaly a method with what I
can change the links the grid does create on the on the back and forwards
buttons.

The grid uses links like those as back and forward links:

<a href="javascrip t:__doPostBack( 'ctl00$DataGrid 1$ctl14$ctl01', '')"
style="color:#0 00066;">2</a>

How can I overwrite them?

May 25 '06 #1
1 2392

"the friendly display name"
<th************ ********@discus sions.microsoft .com> wrote in message
news:4C******** *************** ***********@mic rosoft.com...
Simple question:

How to make datagrid paging work without javascript? I have a simple
datagrid, which gets populated by a dataview, it works perfectly, paging
works too, but, as I said, it does only with javascript. I know how to set
the index of the grid etc. My Idea would be using my own links (with
query-parameters attached on them, the parameter would transport the position of the targeted page in the grid) I just need basicaly a method with what I can change the links the grid does create on the on the back and forwards
buttons.

The grid uses links like those as back and forward links:

<a href="javascrip t:__doPostBack( 'ctl00$DataGrid 1$ctl14$ctl01', '')"
style="color:#0 00066;">2</a>

How can I overwrite them?

Well there may be other ways but I build a control with a hyperlink with the
necessary parameters to process the request on the server as follows (snip)

mgPager.control s.clear 'mgPager is a asp:placeholder
if intTotalPages > 1 then
dim strPage as string = "page "
dim sb as new stringbuilder(1 00)
....build href string here including querystring parameters (without
page number)
... you will need all the information necessary to get the next page
of data from database
dim strQuery as string = sb.tostring()
for i = 0 to intTotalPages + 2
dim ctl as new htmlanchor
select case i
case = 0
ctl.InnerHtml = HttpUtility.Htm lEncode("<<back ")
ctl.title = "Go back one page."
if intPage - 1 = 0 then
ctl.href = ""
ctl.disabled = true
else
ctl.href = strQuery & "&_PageNum= " & (intPage - 1).tostring()
end if
Case = intTotalPages + 2
ctl.InnerHtml = HttpUtility.Htm lEncode(" next>>")
ctl.title = "Go forward one page."
if intPage + 1 > inttotalPages then
ctl.href = ""
ctl.disabled = true
else
ctl.href = strQuery & "&_PageNum= " & (intPage + 1).tostring()
end if
Case = intTotalPages + 1
ctl.InnerHtml = HttpUtility.Htm lEncode(" view all")
ctl.title = "View all on same page."
ctl.href = strQuery & "&_PageNum= 0"

Case = intPage
ctl.InnerHtml = strPage & i.tostring()
ctl.href = ""
ctl.disabled = true

Case else
ctl.InnerHtml = strPage & i.tostring()
ctl.title = "Go to page " & i.tostring() & "."
ctl.href = strQuery & "&_PageNum= " & i.tostring()
End Select
ctl.attributes( "class") = "pager"
ctl.target = "_self"
ctl.id = "p" & i.tostring()
mgPager.control s.add(ctl)
if i < intTotalPages + 2 then
mgPager.control s.add(New literalcontrol( ", "))
end if
next i
end if
May 25 '06 #2

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

Similar topics

1
2352
by: Jeremy | last post by:
I want my gird to sort only the items on the current page when I click on a column header. I wrote a little test app, but when I sort it pulls in items from other pages and places them on the current page. i.e. If I have: IntegerValue StringValue CurrencyValue 0 Item 0 0 1 Item 1 1.23
2
1379
by: George Durzi | last post by:
Is there a way to implement datagrid paging without using javascript on the client-side?
6
1452
by: Dee | last post by:
Hi The paging numbers of my DataGrid dont actually page. What can be the cause? Everyting else seems to work. Thanks Dee
2
1863
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 navigation links use JavaScript to jump between pages. I want them to use standard hyperlinks providing the page number in some URL parameter so that I can copy the hyperlink elsewhere.
1
1257
by: Jon Turner | last post by:
is there anyway to trap the client side paging event of the DataGrid in JavaScript ? If the user makes a change to a row, I want to warn them they will lose changes before they page. Many Thanks
1
2132
by: Ed Chiu | last post by:
Hi, I copied the following codes from Internet to export datagrid to Excel, it works with datagrid not supporting sorting or paging. Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" Response.AddHeader("Content-Disposition", "attachment;filename=Statement.xls") Me.EnableViewState = False
0
1821
by: Ray | last post by:
I am trying to add a "Next >" and "<Prev" button to the pager of my datagrid. I have been able to add the hyperlinks to the pager. I am now trying to determine the correct postback script to emulate so that these hyperlinks force the postback of the appropriate linkbuttons in the pager. Let's take a pager with pager: 1 2 3 4 5 It consists of: linkbutton linkbutton label linkbutton linkbutton I want it to be: < Prev 1 2 3 4 5 Next > It...
1
1821
by: DC | last post by:
Hi, I know this has been asked a number of times... but maybe a new trick was found by now? I need to offer paging options for a datagrid Google style: << previous Page 1 2 3 4 5...(of 23) next >> Is this possible without reinventing the datagrid control; e.g. can I replace the paging control with a custom control?
0
922
by: JimSnotes | last post by:
Hello, Does anybody know if you can use the PagedDataSource class in conjunction with a DataGrid in an ASP.NET 1.1 VB web page? I know that the DataGrid already has built in paging functionality, but it would be useful to be able to replace the javascript paging with search engine friendly query strings for the paging as described in this article: http://www.sitepoint.com/article/asp-nets-pageddatasource/ I have tried setting the...
0
8776
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
9449
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...
0
9310
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
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,...
0
8186
agi2029
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...
0
6031
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();...
1
3261
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
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
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.