troubleshooting Question

ASP.NET Datagrid Paging - Setting the Virtual Item Count (virtualitemcount) Property

Avatar of swtiley
swtiley asked on
Adobe DreamweaverASP.NET
5 Comments1 Solution2434 ViewsLast Modified:
Hi I am stuck on an issue whilst using Dreamweaver and asp.net (both of which I am very new to). Basically the example query below returns around 20 records, I want to page the datagrid with 5 records per page. To do this though I need to set the virtualitemcount property. But I do not know how to do this at run time.

I have bound my datagrid in the following way (and am therefore not using a dataset)

--------------
Dim DBconn_1 as New SqlConnection("Data Source=Crystal;Initial Catalog=OPAPPSLIVE;User Id=xxxxx;Password=xxxxx;")
Dim DBsql_1 as String = "select distinct appt_date, Start_time, Staff_Name from appt_appointment"
Dim DBcmd_1 as New SqlCommand(DBsql_1, DBconn_1)
DBconn_1.Open()
dgAppts.DataSource = DBcmd_1.ExecuteReader(CommandBehavior.CloseConnection)
dgAppts.DataBind()    
--------------

then later on the datagrid definition

--------------
<asp:datagrid id="dgAppts" runat="server"
  AllowPaging="true"
  AllowCustomPaging="true"
  AllowSorting="False"
  AutoGenerateColumns="false"
  CellPadding="3"
  CellSpacing="0"
  PagerStyle-Mode="NumericPages"
  PageSize="5"
  ShowFooter="false"
  ShowHeader="true"
  OnPageIndexChanged="Historic_Page_Changer"
  virtualitemcount="WHAT DO I PUT IN HERE PLEASE"
----------------

Anyhelp would be very much appreciated...
...Thanks Steve
ASKER CERTIFIED SOLUTION
lorelogic

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros