Proble trying to implement paging?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngdatagridrepeaterdatalist' list.


Dennis West
Proble trying to implement paging? in visual studio ,codebehind what an i missing this is right out of the book (am i not declaring the event??)

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30456: 'MyDataGrid_Page' is not a member of 'ASP.contacts_ascx'.

Source Error:

Line 6:         <td width="4" background="images/module_body_left.jpg"></td>
Line 7:         <td width="100% bgcolor="#C2C2C2">
Line 8: <asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >
Line 9:     <Columns>
Line 10:         <asp:TemplateColumn>

Source File: D:\Domains\aspalliance.com\dotnetsolutions\portalvs\DesktopModules\Contacts.ascx Line: 8

<%@ Control language="vb" Inherits="ASPNetPortal.Contacts" CodeBehind="Contacts.ascx.vb" AutoEventWireup="false" %>
<%@ Register TagPrefix="Portal" TagName="Title" Src="~/DesktopModuleTitle.ascx"%>
<portal:title EditText="Add New Contact" EditUrl="~/DesktopModules/EditContacts.aspx" runat="server" />
<table width="100%" cellspacing="0" cellpadding="0" runat="server" ID="Table1">
<tr valign="top">
<td width="4" background="images/module_body_left.jpg"></td>
<td width="100% bgcolor="#C2C2C2">
<asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:HyperLink ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/DesktopModules/EditContacts.aspx?ItemID=" & DataBinder.Eval(Container.DataItem,"ItemID") & "&mid=" & ModuleId %>' Visible="<%# IsEditable %>" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Name">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' ID="Label1" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>

Imports System
Imports System.Configuration
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.SqlClient
Namespace ASPNetPortal

Public MustInherit Class Contacts
Inherits ASPNetPortal.PortalModuleControl

Protected WithEvents myDataGrid As System.Web.UI.WebControls.DataGrid

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

'*******************************************************
'
' The Page_Load event handler on this User Control is used to
' obtain a DataReader of contact information from the Contacts
' table, and then databind the results to a DataGrid
' server control. It uses the ASPNetPortal.ContactsDB()
' data component to encapsulate all data functionality.
'
'*******************************************************'
Dim startIndex As Integer

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

' Obtain contact information from Contacts table
' and bind to the DataGrid Control

If Not IsPostBack Then
startIndex = 0
myDataGrid.VirtualItemCount = 200

Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()
End If

End Sub

Protected Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
startIndex = e.NewPageIndex * myDataGrid.PageSize
myDataGrid.CurrentPageIndex = e.NewPageIndex

' Obtain contact information from Contacts table
' and bind to the DataGrid Control
Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()

End Sub

End Class

End Namespace

http://aspalliance.com/dotnetsolutions/

Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address
Reply to this message...
 
    
DavidW
Have you looked in the codebehind to see if 'MyDataGrid_Page' is a valid sub where it's looking for it?

David Wier
"Dennis West" <Click here to reveal e-mail address> wrote in message news:698070@aspngdatagridrepeaterdatalist...
Proble trying to implement paging? in visual studio ,codebehind what an i missing this is right out of the book (am i not declaring the event??)

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30456: 'MyDataGrid_Page' is not a member of 'ASP.contacts_ascx'.

Source Error:

Line 6:         <td width="4" background="images/module_body_left.jpg"></td>
Line 7:         <td width="100% bgcolor="#C2C2C2">
Line 8: <asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >
Line 9:     <Columns>
Line 10:         <asp:TemplateColumn>

Source File: D:\Domains\aspalliance.com\dotnetsolutions\portalvs\DesktopModules\Contacts.ascx Line: 8

<%@ Control language="vb" Inherits="ASPNetPortal.Contacts" CodeBehind="Contacts.ascx.vb" AutoEventWireup="false" %>
<%@ Register TagPrefix="Portal" TagName="Title" Src="~/DesktopModuleTitle.ascx"%>
<portal:title EditText="Add New Contact" EditUrl="~/DesktopModules/EditContacts.aspx" runat="server" />
<table width="100%" cellspacing="0" cellpadding="0" runat="server" ID="Table1">
<tr valign="top">
<td width="4" background="images/module_body_left.jpg"></td>
<td width="100% bgcolor="#C2C2C2">
<asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:HyperLink ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/DesktopModules/EditContacts.aspx?ItemID=" & DataBinder.Eval(Container.DataItem,"ItemID") & "&mid=" & ModuleId %>' Visible="<%# IsEditable %>" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Name">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' ID="Label1" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>

Imports System
Imports System.Configuration
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.SqlClient
Namespace ASPNetPortal

Public MustInherit Class Contacts
Inherits ASPNetPortal.PortalModuleControl

Protected WithEvents myDataGrid As System.Web.UI.WebControls.DataGrid

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

'*******************************************************
'
' The Page_Load event handler on this User Control is used to
' obtain a DataReader of contact information from the Contacts
' table, and then databind the results to a DataGrid
' server control. It uses the ASPNetPortal.ContactsDB()
' data component to encapsulate all data functionality.
'
'*******************************************************'
Dim startIndex As Integer

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

' Obtain contact information from Contacts table
' and bind to the DataGrid Control

If Not IsPostBack Then
startIndex = 0
myDataGrid.VirtualItemCount = 200

Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()
End If

End Sub

Protected Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
startIndex = e.NewPageIndex * myDataGrid.PageSize
myDataGrid.CurrentPageIndex = e.NewPageIndex

' Obtain contact information from Contacts table
' and bind to the DataGrid Control
Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()

End Sub

End Class

End Namespace

http://aspalliance.com/dotnetsolutions/

Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address
Reply to this message...
 
    
Dennis West
at the bottom of the original post is my sub

here it is again

Protected Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
startIndex = e.NewPageIndex * myDataGrid.PageSize
myDataGrid.CurrentPageIndex = e.NewPageIndex

' Obtain contact information from Contacts table
' and bind to the DataGrid Control
Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()

End Sub

----- Original Message -----
From: DavidW
Newsgroups: aspngdatagridrepeaterdatalist
To: aspngDataGridRepeaterDatalist
Sent: Wednesday, August 14, 2002 2:58 PM
Subject: [aspngdatagridrepeaterdatalist] Re: Proble trying to implement paging?

Have you looked in the codebehind to see if 'MyDataGrid_Page' is a valid sub where it's looking for it?

David Wier
"Dennis West" <Click here to reveal e-mail address> wrote in message news:698070@aspngdatagridrepeaterdatalist...
Proble trying to implement paging? in visual studio ,codebehind what an i missing this is right out of the book (am i not declaring the event??)

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30456: 'MyDataGrid_Page' is not a member of 'ASP.contacts_ascx'.

Source Error:

Line 6:         <td width="4" background="images/module_body_left.jpg"></td>
Line 7:         <td width="100% bgcolor="#C2C2C2">
Line 8: <asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >
Line 9:     <Columns>
Line 10:         <asp:TemplateColumn>

Source File: D:\Domains\aspalliance.com\dotnetsolutions\portalvs\DesktopModules\Contacts.ascx Line: 8

<%@ Control language="vb" Inherits="ASPNetPortal.Contacts" CodeBehind="Contacts.ascx.vb" AutoEventWireup="false" %>
<%@ Register TagPrefix="Portal" TagName="Title" Src="~/DesktopModuleTitle.ascx"%>
<portal:title EditText="Add New Contact" EditUrl="~/DesktopModules/EditContacts.aspx" runat="server" />
<table width="100%" cellspacing="0" cellpadding="0" runat="server" ID="Table1">
<tr valign="top">
<td width="4" background="images/module_body_left.jpg"></td>
<td width="100% bgcolor="#C2C2C2">
<asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:HyperLink ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/DesktopModules/EditContacts.aspx?ItemID=" & DataBinder.Eval(Container.DataItem,"ItemID") & "&mid=" & ModuleId %>' Visible="<%# IsEditable %>" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Name">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' ID="Label1" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>

Imports System
Imports System.Configuration
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.SqlClient
Namespace ASPNetPortal

Public MustInherit Class Contacts
Inherits ASPNetPortal.PortalModuleControl

Protected WithEvents myDataGrid As System.Web.UI.WebControls.DataGrid

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

'*******************************************************
'
' The Page_Load event handler on this User Control is used to
' obtain a DataReader of contact information from the Contacts
' table, and then databind the results to a DataGrid
' server control. It uses the ASPNetPortal.ContactsDB()
' data component to encapsulate all data functionality.
'
'*******************************************************'
Dim startIndex As Integer

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

' Obtain contact information from Contacts table
' and bind to the DataGrid Control

If Not IsPostBack Then
startIndex = 0
myDataGrid.VirtualItemCount = 200

Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()
End If

End Sub

Protected Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
startIndex = e.NewPageIndex * myDataGrid.PageSize
myDataGrid.CurrentPageIndex = e.NewPageIndex

' Obtain contact information from Contacts table
' and bind to the DataGrid Control
Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()

End Sub

End Class

End Namespace

http://aspalliance.com/dotnetsolutions/

Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address

| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID | http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp = JOIN/QUIT
Reply to this message...
 
    
Meor Zaharin Meor Ibrahim
Dennis, I believe for VB .NET it should be:

Protected Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs) Handles
MyDataGrid_OnPageIndexChanged
startIndex = e.NewPageIndex * myDataGrid.PageSize
myDataGrid.CurrentPageIndex = e.NewPageIndex

' Obtain contact information from Contacts table
' and bind to the DataGrid Control
Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()

End Sub

HTH

-----Original Message-----
From: Dennis West [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 3:46 AM
To: aspngDataGridRepeaterDatalist
Subject: [aspngdatagridrepeaterdatalist] Proble trying to implement paging?

Proble trying to implement paging? in visual studio ,codebehind what an i missing this is right out of the book (am i not declaring the event??)

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30456: 'MyDataGrid_Page' is not a member of 'ASP.contacts_ascx'.

Source Error:



Line 6:         <td width="4" background="images/module_body_left.jpg"></td>

Line 7:         <td width="100% bgcolor="#C2C2C2">

Line 8: <asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >

Line 9:     <Columns>

Line 10:         <asp:TemplateColumn>

Source File: D:\Domains\aspalliance.com\dotnetsolutions\portalvs\DesktopModules\Contacts.ascx Line: 8
    ' Visible="<%# IsEditable %>">'>'>
<%@ Control language="vb" Inherits="ASPNetPortal.Contacts" CodeBehind="Contacts.ascx.vb" AutoEventWireup="false" %>
<%@ Register TagPrefix="Portal" TagName="Title" Src="~/DesktopModuleTitle.ascx"%>
<portal:title EditText="Add New Contact" EditUrl="~/DesktopModules/EditContacts.aspx" runat="server" />
<table width="100%" cellspacing="0" cellpadding="0" runat="server" ID="Table1">
<tr valign="top">
<td width="4" background="images/module_body_left.jpg"></td>
<td width="100% bgcolor="#C2C2C2">
<asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:HyperLink ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/DesktopModules/EditContacts.aspx?ItemID=" & DataBinder.Eval(Container.DataItem,"ItemID") & "&mid=" & ModuleId %>' Visible="<%# IsEditable %>" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Name">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' ID="Label1" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>

Imports System
Imports System.Configuration
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.SqlClient
Namespace ASPNetPortal

Public MustInherit Class Contacts
Inherits ASPNetPortal.PortalModuleControl

Protected WithEvents myDataGrid As System.Web.UI.WebControls.DataGrid

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

'*******************************************************
'
' The Page_Load event handler on this User Control is used to
' obtain a DataReader of contact information from the Contacts
' table, and then databind the results to a DataGrid
' server control. It uses the ASPNetPortal.ContactsDB()
' data component to encapsulate all data functionality.
'
'*******************************************************'
Dim startIndex As Integer

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

' Obtain contact information from Contacts table
' and bind to the DataGrid Control

If Not IsPostBack Then
startIndex = 0
myDataGrid.VirtualItemCount = 200

Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()
End If

End Sub

Protected Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
startIndex = e.NewPageIndex * myDataGrid.PageSize
myDataGrid.CurrentPageIndex = e.NewPageIndex

' Obtain contact information from Contacts table
' and bind to the DataGrid Control
Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()

End Sub

End Class

End Namespace

http://aspalliance.com/dotnetsolutions/

Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address

| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID | http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp = JOIN/QUIT
Reply to this message...
 
    
DavidW
Try just trimming it down to:

MyDataGrid.CurrentPageIndex = e.NewPageIndex

BindData

"Dennis West" <Click here to reveal e-mail address> wrote in message news:698085@aspngdatagridrepeaterdatalist...
at the bottom of the original post is my sub

here it is again

Protected Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
startIndex = e.NewPageIndex * myDataGrid.PageSize
myDataGrid.CurrentPageIndex = e.NewPageIndex

' Obtain contact information from Contacts table
' and bind to the DataGrid Control
Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()

End Sub

----- Original Message -----
From: DavidW
Newsgroups: aspngdatagridrepeaterdatalist
To: aspngDataGridRepeaterDatalist
Sent: Wednesday, August 14, 2002 2:58 PM
Subject: [aspngdatagridrepeaterdatalist] Re: Proble trying to implement paging?

Have you looked in the codebehind to see if 'MyDataGrid_Page' is a valid sub where it's looking for it?

David Wier
"Dennis West" <Click here to reveal e-mail address> wrote in message news:698070@aspngdatagridrepeaterdatalist...
Proble trying to implement paging? in visual studio ,codebehind what an i missing this is right out of the book (am i not declaring the event??)

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30456: 'MyDataGrid_Page' is not a member of 'ASP.contacts_ascx'.

Source Error:

Line 6:         <td width="4" background="images/module_body_left.jpg"></td>
Line 7:         <td width="100% bgcolor="#C2C2C2">
Line 8: <asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >
Line 9:     <Columns>
Line 10:         <asp:TemplateColumn>

Source File: D:\Domains\aspalliance.com\dotnetsolutions\portalvs\DesktopModules\Contacts.ascx Line: 8

<%@ Control language="vb" Inherits="ASPNetPortal.Contacts" CodeBehind="Contacts.ascx.vb" AutoEventWireup="false" %>
<%@ Register TagPrefix="Portal" TagName="Title" Src="~/DesktopModuleTitle.ascx"%>
<portal:title EditText="Add New Contact" EditUrl="~/DesktopModules/EditContacts.aspx" runat="server" />
<table width="100%" cellspacing="0" cellpadding="0" runat="server" ID="Table1">
<tr valign="top">
<td width="4" background="images/module_body_left.jpg"></td>
<td width="100% bgcolor="#C2C2C2">
<asp:datagrid id="myDataGrid" OnItemDataBound="myDataGrid_OnItemDataBound" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" AllowCustomPaging="True" PageSize="2" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="MyDataGrid_Page" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:HyperLink ImageUrl="~/images/edit.gif" NavigateUrl='<%# "~/DesktopModules/EditContacts.aspx?ItemID=" & DataBinder.Eval(Container.DataItem,"ItemID") & "&mid=" & ModuleId %>' Visible="<%# IsEditable %>" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Name">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' ID="Label1" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>

Imports System
Imports System.Configuration
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.SqlClient
Namespace ASPNetPortal

Public MustInherit Class Contacts
Inherits ASPNetPortal.PortalModuleControl

Protected WithEvents myDataGrid As System.Web.UI.WebControls.DataGrid

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

'*******************************************************
'
' The Page_Load event handler on this User Control is used to
' obtain a DataReader of contact information from the Contacts
' table, and then databind the results to a DataGrid
' server control. It uses the ASPNetPortal.ContactsDB()
' data component to encapsulate all data functionality.
'
'*******************************************************'
Dim startIndex As Integer

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

' Obtain contact information from Contacts table
' and bind to the DataGrid Control

If Not IsPostBack Then
startIndex = 0
myDataGrid.VirtualItemCount = 200

Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()
End If

End Sub

Protected Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
startIndex = e.NewPageIndex * myDataGrid.PageSize
myDataGrid.CurrentPageIndex = e.NewPageIndex

' Obtain contact information from Contacts table
' and bind to the DataGrid Control
Dim contacts As New ASPNetPortal.ContactsDB()

myDataGrid.DataSource = contacts.GetContacts(ModuleId)
myDataGrid.DataBind()

End Sub

End Class

End Namespace

http://aspalliance.com/dotnetsolutions/

Dennis West
West Design
MS .NET Developer
www. westontheweb.net
Click here to reveal e-mail address

| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID | http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp = JOIN/QUIT
Reply to this message...
 
 
System.ComponentModel.Container
System.EventArgs
System.Object
System.Web.UI.DataBinder
System.Web.UI.MobileControls.PagerStyle
System.Web.UI.WebControls.DataGrid
System.Web.UI.WebControls.DataGridPageChangedEventArgs
System.Web.UI.WebControls.HorizontalAlign
System.Web.UI.WebControls.HyperLink
System.Web.UI.WebControls.TemplateColumn
System.Windows.Forms.DataGrid




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com