473,626 Members | 3,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to find which page does a record available in Grid

Hi All,
I've a grid with say 100 records with pagination of 10 records per
page. Given a record, how can I identify which page does this record
is available?
As the grid size can be much larger than 20K records, looping each
records would be a bad approach. Is there any other way so that I can
find the page number?
Thanks in Advance.
ArunDhaJ
Jul 31 '08 #1
3 1291
int pageNumber = topMostIndex / itemsPerPage;
Jul 31 '08 #2
I wont be having topMostIndex value.

I think u didnt get my query.

Say a grid contains following columns
Name, Age, Department

consider the following record is 12th record
Arun, 22, ComputerScience

through C# code I've to calculate which page does this record with
name "Arun" comes. i.e. Page 2.

I hope I've explained. If you need further clarifications please post
back.

Thanks
ArunDhaJ
Jul 31 '08 #3

"ArunDhaJ" <ar******@gmail .comwrote in message
news:ec******** *************** ***********@r15 g2000prd.google groups.com...
>I wont be having topMostIndex value.

I think u didnt get my query.

Say a grid contains following columns
Name, Age, Department

consider the following record is 12th record
Arun, 22, ComputerScience

through C# code I've to calculate which page does this record with
name "Arun" comes. i.e. Page 2.

I hope I've explained. If you need further clarifications please post
back.

Thanks
ArunDhaJ
int PageNum = (RecordNumber / RecordsPerPage) + 1;

Given your scenario: PageNum = (12 / 10) + 1
Record appears on Page 2
Aug 2 '08 #4

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

Similar topics

3
4834
by: Oliver Drobnik | last post by:
Hi, I have a datagrid bound to a datatable. Now if I sort the datagrid by clicking on one of the column heads I can no longer use the index in the datagrid to find the corresponding row in the datagrid. How can I find out the new (sorted) index if I know the row in the datatable? kind regards
0
5735
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is selected, it causes the ServerClick event to be called twice. Here's the code: You'll see that there are two grids on the page, and that the function SetupDataGrid populates data to the two grid. There are also
9
5051
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ******************************************************************************* <asp:DataGrid visible="False" border=1
5
1515
by: Peter Rilling | last post by:
I have an interesting issues that, although I not blocking me, is not very performance. Maybe someone can suggest a better way of doing this. 1) I have a page that displays a grid with command links such as Delete. Obviously if this link will delete the item of the current line. 2) The grid is initialized during the Init event so that the events can be bound. It is my understanding that events do not get fired unless the object...
4
2609
by: Aaron Smith | last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID ASC", DataViewRowState.CurrentRows) Dim iPos As Integer = dv.Find(dr.Item("ID")) Me.BindingContext(FacilitiesDS1, "Facilities").Position = iPos That is the code.. dr is DataRow. If dr.Item("ID") = 3, the find will return position 0, which it should have been 1, and if the ID = 2, it will return 1, which should have been 0.. The DA has a connection string that sorts it...
3
2098
by: NuB | last post by:
I have a C# web form that allows the user to perform a search if all the required fields are filled in, which works fine, my issue is if a user does a sucessfull search then enters in data and misses a field they get a message "field Name is missing" the result grid remains, how can I have the grid not shown from the prior successful search if the users gets a validation error for missing a required field or of no records are found?
1
2292
by: koren99 | last post by:
Hello, I have a gridview that is filled with a datasource & template fields dynamically. ( that has to be done because i ask the user for a datasource) anyway, i started out creating a static but empty grid. and added the template controls and datasource & activated grid.DataBind() in the page_load event. that gave me all the info when the page loaded on screen. now i have an edit and update buttons on each row and pressing the...
3
3888
by: Dave | last post by:
I have an GridView on one page that will open a popup for the selected record. I've been told that there is a way that when the popup record is updated the GridView can be refreshed or Databind. I've been looking for the answer with no luck. I'm probably just not asking the question correctly. Thanks for any assistance.
9
1572
by: viktore | last post by:
Hey guys, bad title i know:) Well my problem is as follows: I have a javascript user control, a grid, wich is on an .aspx page. On the grid I can scroll between records, up and down, and click them. Now I want to create an event in the grid that lets the page know if a different record is chosen, a record is changed and so on. I tried using event/delegates to solve this and I do get the information from the javascript to the page but...
0
8196
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
8701
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
8637
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
8364
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
7192
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...
1
6122
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2623
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
1
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.