473,387 Members | 1,779 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.

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="javascript:__doPostBack('ctl00$DataGrid1$ctl 14$ctl01','')"
style="color:#000066;">2</a>

How can I overwrite them?

May 25 '06 #1
1 2372

"the friendly display name"
<th********************@discussions.microsoft.co m> wrote in message
news:4C**********************************@microsof t.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="javascript:__doPostBack('ctl00$DataGrid1$ctl 14$ctl01','')"
style="color:#000066;">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.controls.clear 'mgPager is a asp:placeholder
if intTotalPages > 1 then
dim strPage as string = "page "
dim sb as new stringbuilder(100)
....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.HtmlEncode("<<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.HtmlEncode(" 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.HtmlEncode(" 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.controls.add(ctl)
if i < intTotalPages + 2 then
mgPager.controls.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
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...
2
by: George Durzi | last post by:
Is there a way to implement datagrid paging without using javascript on the client-side?
6
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
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: 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...
1
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"...
0
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...
1
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...
0
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...
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: 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
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?
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
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,...
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,...

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.