Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 19th, 2006, 03:52 AM
Authorized User
 
Join Date: Jan 2006
Location: Pittsburgh, PA 15203
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom paging in Datagrid with datagrid page count

hai all

      I am working with the datagrids i had a requirement of showing the pager styel of the datagrid as first previous next and last. for this i have removed the pager style by making pagerstyle visible = false, now i have added allow custom paging = true and page size to 2, the probelm occurs when i try to get the datagrid.page count which shows me one always(1)though i have 5 records in the dataview and my page size is 2 and also allow custom paging = true.i dont get why i get page count as 1

thanks in advance

Madhu.....

__________________
Regards,
P.Madhusudhana Rao
  #2 (permalink)  
Old June 19th, 2006, 04:37 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Madhu,

When you use custom paging, only one page full of records is always returned to the Grid. This makes sense, as it's exactly what you're asking for. Not the grid, but the data source is responsible for paging.

To make the page bar behave nice, you need to set the grid's VirtualItemCount property: http://msdn.microsoft.com/library/de...counttopic.asp

This property should be set to the total number of records in the datasource; 5 in your case. How you set this property depends on your data access logic, but a common way is to create an output parameter on a stored procedure that returns the total number of records.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
  #3 (permalink)  
Old June 20th, 2006, 01:21 AM
Authorized User
 
Join Date: Jan 2006
Location: Pittsburgh, PA 15203
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hai

Thank you for the answer i have given the virtual count number to five but the thing is though the pages change it shows the same data.

this means that i use
dataview selectitemview = ds.table.count defult view
datagrid1.virtualitemcount = selectitemview.item.count
datagrid1.datasource = selectitemview
datagrid1.databind()

the problem it is moving tothe next page but it shows the same data.
ie it shows 1-2of5 for the first time
then when we click next it shows 3-4of5 for the second time
but here it shows the first click results only

  #4 (permalink)  
Old June 20th, 2006, 01:39 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Again, this is probably because you use custom paging. How does your code look like? Are you sure that you retrieve the correct page from the database by passing a start index and a page size to the database?

Are you aware of the differences between custom paging and normal paging?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
  #5 (permalink)  
Old June 20th, 2006, 02:10 AM
Authorized User
 
Join Date: Jan 2006
Location: Pittsburgh, PA 15203
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i am using custom paging my looks like this

listcommand list = new listcommand()
list.intialize(searchconditions)
valuecontext = list.excecute()
patientds = get from valuecontext()

dataview slectitemview = new dataview
datagrid1.datasource = selectitemview
this is my actual code



  #6 (permalink)  
Old June 20th, 2006, 02:13 AM
Authorized User
 
Join Date: Jan 2006
Location: Pittsburgh, PA 15203
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i dont know where to add that start index and paze size in my code.
because i use dataview as the datasource

thank you Imar for your support

  #7 (permalink)  
Old June 20th, 2006, 02:18 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Really?? Does this compile?
dataview slectitemview = new dataview
datagrid1.datasource = selectitemview

But more importantly, how does it display records in the first place? You declare a new instance of a DataView and then set it as a DataSource? What's inside the DataView at that point? Nothing.

Anyway, hard to help without actual code....

You may want to consider dropping custom paging, and let the Grid handle things....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
  #8 (permalink)  
Old June 20th, 2006, 02:46 AM
Authorized User
 
Join Date: Jan 2006
Location: Pittsburgh, PA 15203
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry
dataview selectitemview = productds.tblpatients.default view

think u can help me
thanks a lot

  #9 (permalink)  
Old June 20th, 2006, 02:59 AM
Authorized User
 
Join Date: Jan 2006
Location: Pittsburgh, PA 15203
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hai this is my code

CallContext callContext = CallService.GetCallContext();
ListCommand listCommand = new ListCommand();
listCommand.Initialize(searchConditions);
ValueContext valueContext = listCommand.Execute(callContext);
patientDS = (SearchPatientDS)GetFromValueContext(valueContext, typeof(SearchPatientDS));

DataView SelectPatientView = patientDS.VIEW_PATIENT_SCHEDULE.DefaultView;
SelectPatientView.Sort = SortCriteria+' '+SortDirection;
CurrentPageNumber = PatientsList.CurrentPageIndex ;
PatientsList.VirtualItemCount = SelectPatientView.Count;
PatientsList.DataSource=SelectPatientView;
PatientsList.DataBind();
RenderNav.Text = RenderPageNav(PatientsList.CurrentPageIndex,Patien tsList.PageSize,PatientsList.Items.Count,SelectPat ientView.Count );

this is my actual code for databind
  #10 (permalink)  
Old June 20th, 2006, 03:00 AM
Authorized User
 
Join Date: Jan 2006
Location: Pittsburgh, PA 15203
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

think so u can help me now





Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging in DataGrid vijay_83 ASP.NET 2.0 Basics 0 September 29th, 2006 02:06 PM
Paging in DataGrid vijay_83 ASP.NET 2.0 Professional 0 September 29th, 2006 02:02 PM
Paging in datagrid Renu ASP.NET 1.0 and 1.1 Basics 2 September 9th, 2004 01:11 PM
Datagrid Paging collie VB.NET 2002/2003 Basics 17 January 25th, 2004 07:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.