Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 19th, 2006, 04: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, 05:37 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 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, 02: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, 02:39 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 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, 03: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, 03: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, 03:18 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 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, 03: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, 03: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, 04: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

 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 04:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.