More On. My DataGrid Paging Problem
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngdatagridrepeaterdatalist' list.


Dennis West
The code below works (no errors) on my localhost using Visual Studio. The Project/Solution files show parent child relations (file with + signs) for code behind files

When I paste over the 3 files for Contacts .ascx/.ascx.vb/and the .resx to my host I do not see the + sign relationsship. but all files are there. cause I can view and edit the code for all files. The code is the same so the transfer of code from one application to another worked (and even if I coded with out copying it..its is the same) the only difference is that Visual Studio does not show the + sign for the file relations for codebehind files on my host server

I get this error when compiling off the host..

What I need is to be able to implement this code in both configuration

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% >
Line 8:         <asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next" PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page" OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px" AlternatingItemStyle-Font-Size="10px">
Line 9:         <Columns>
Line 10:         <asp:TemplateColumn>

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

This All my Working code Html and .vb code behind from the localhost application

<%@ 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% >
<asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next" PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page" OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px" AlternatingItemStyle-Font-Size="10px">
<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>
<asp:TemplateColumn HeaderText="Role">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Role") %>' ID="Label2" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Email">
<ItemTemplate>
<A href=mailto:<%# DataBinder.Eval(Container.DataItem, "Email") %>><Font size=2><%# DataBinder.Eval(Container.DataItem, "Email") %></Font></a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Contact 1">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Contact1") %>' ID="Label4" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Conatact 2">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Contact2") %>' ID="Label5" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>
</td>
<td width="6" background="images/module_body_right.jpg"></td>
</tr>
<tr>
<td><img src="images/module_footer_left.jpg"></td>
<td background="images/module_footer_bg.jpg"><img src="images/spacer.gif" width="100%" height="1"></td>
<td><img src="images/module_footer_right.jpg"></td>
</tr>
</table>

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.
'
'*******************************************************'

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
myDataGrid.PagerStyle.Mode = PagerMode.NextPrev

Dim contacts As New ASPNetPortal.ContactsDB()

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

End Sub

Protected Sub myDataGrid_OnItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)

' Create Instance of Connection and Command Object
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim myCommand As New SqlDataAdapter("GetContactAliasNames", myConnection)

' Mark the Command as a SPROC
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
Dim parameterModuleId As New SqlParameter("@ModuleId", SqlDbType.Int, 4)
parameterModuleId.Value = ModuleId
myCommand.SelectCommand.Parameters.Add(parameterModuleId)

' Create and Fill the DataSet
Dim myDataSet As New DataSet()
myCommand.Fill(myDataSet)

'We only want the header
If e.Item.ItemType = ListItemType.Header Then
'Where 0 is the column index containing the header we wish to manipulate
'If there were two ther columns before our pub_name column then we would change
'the line to something like this
'
Dim dtAliasNames As DataTable

Dim drowItem As DataRow

Dim dcolColumn As DataColumn
Dim dcolShow As DataColumn

dtAliasNames = myDataSet.Tables(0)

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

For Each drowItem In dtAliasNames.Rows
Dim i = i + 1
If drowItem(dcolShow) = "true" Then
e.Item.Cells(i).Text = drowItem(dcolColumn) 'Title
Else
e.Item.Cells(i).Text = "" 'Title
End If
myDataGrid.Columns(i).Visible = drowItem(dcolShow) 'Show

Next

End If
End Sub

Public Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
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...
 
    
Meor Zaharin Meor Ibrahim
forgive my ignorance, since you are copying the file from VS .NET project. I think if you compile the code behind and copy it to the /bin directory, maybe it will work.

Just my 2 cents

-----Original Message-----
From: Dennis West [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 6:23 AM
To: aspngDataGridRepeaterDatalist
Subject: [aspngdatagridrepeaterdatalist] More On. My DataGrid Paging Problem

<%@ Control language="vb" Inherits="ASPNetPortal.Contacts" CodeBehind="Contacts.ascx.vb" AutoEventWireup="false" %>The code below works (no errors) on my localhost using Visual Studio. The Project/Solution files show parent child relations (file with + signs) for code behind files

When I paste over the 3 files for Contacts .ascx/.ascx.vb/and the .resx to my host I do not see the + sign relationsship. but all files are there. cause I can view and edit the code for all files. The code is the same so the transfer of code from one application to another worked (and even if I coded with out copying it..its is the same) the only difference is that Visual Studio does not show the + sign for the file relations for codebehind files on my host server

I get this error when compiling off the host..

What I need is to be able to implement this code in both configuration

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% >

Line 8:         <asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next" PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page" OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px" AlternatingItemStyle-Font-Size="10px">

Line 9:         <Columns>

Line 10:         <asp:TemplateColumn>

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

This All my Working code Html and .vb code behind from the localhost application

<%@ 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% >
<asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next" PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page" OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px" AlternatingItemStyle-Font-Size="10px">
<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>
<asp:TemplateColumn HeaderText="Role">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Role") %>' ID="Label2" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Email">
<ItemTemplate>
<A href=mailto:<%# DataBinder.Eval(Container.DataItem, "Email") %>><Font size=2><%# DataBinder.Eval(Container.DataItem, "Email") %></Font></a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Contact 1">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Contact1") %>' ID="Label4" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Conatact 2">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Contact2") %>' ID="Label5" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>
</td>
<td width="6" background="images/module_body_right.jpg"></td>
</tr>
<tr>
<td><img src="images/module_footer_left.jpg"></td>
<td background="images/module_footer_bg.jpg"><img src="images/spacer.gif" width="100%" height="1"></td>
<td><img src="images/module_footer_right.jpg"></td>
</tr>
</table>

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.
'
'*******************************************************'

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
myDataGrid.PagerStyle.Mode = PagerMode.NextPrev

Dim contacts As New ASPNetPortal.ContactsDB()

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

End Sub

Protected Sub myDataGrid_OnItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)

' Create Instance of Connection and Command Object
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim myCommand As New SqlDataAdapter("GetContactAliasNames", myConnection)

' Mark the Command as a SPROC
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
Dim parameterModuleId As New SqlParameter("@ModuleId", SqlDbType.Int, 4)
parameterModuleId.Value = ModuleId
myCommand.SelectCommand.Parameters.Add(parameterModuleId)

' Create and Fill the DataSet
Dim myDataSet As New DataSet()
myCommand.Fill(myDataSet)

'We only want the header
If e.Item.ItemType = ListItemType.Header Then
'Where 0 is the column index containing the header we wish to manipulate
'If there were two ther columns before our pub_name column then we would change
'the line to something like this
'
Dim dtAliasNames As DataTable

Dim drowItem As DataRow

Dim dcolColumn As DataColumn
Dim dcolShow As DataColumn

dtAliasNames = myDataSet.Tables(0)

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

For Each drowItem In dtAliasNames.Rows
Dim i = i + 1
If drowItem(dcolShow) = "true" Then
e.Item.Cells(i).Text = drowItem(dcolColumn) 'Title
Else
e.Item.Cells(i).Text = "" 'Title
End If
myDataGrid.Columns(i).Visible = drowItem(dcolShow) 'Show

Next

End If
End Sub

Public Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
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<%@ Register TagPrefix="Portal" TagName="Title" Src="~/DesktopModuleTitle.ascx"%>
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...
 
    
Yannick Smits
Try changing this line:
<%@ Control language="vb" Inherits="ASPNetPortal.Contacts"
CodeBehind="Contacts.ascx.vb" AutoEventWireup="false" %>
into:
<%@ Control language="vb" Inherits="ASPNetPortal.Contacts"
src="Contacts.ascx.vb" AutoEventWireup="false" %>

If it start working there is something wrong with your compilation. Then you
should tell VS.NET more clearly that these two files belong to each other.
Sometimes just excluding and re-including the files in the VS.NET project
helps.

hth
Yannick Smits

==================================
"Dennis West" <Click here to reveal e-mail address> wrote in message
news:698182@aspngdatagridrepeaterdatalist...
The code below works (no errors) on my localhost using Visual Studio. The
Project/Solution files show parent child relations (file with + signs) for
code behind files

When I paste over the 3 files for Contacts .ascx/.ascx.vb/and the .resx to
my host I do not see the + sign relationsship. but all files are there.
cause I can view and edit the code for all files. The code is the same so
the transfer of code from one application to another worked (and even if I
coded with out copying it..its is the same) the only difference is that
Visual Studio does not show the + sign for the file relations for codebehind
files on my host server

I get this error when compiling off the host..

What I need is to be able to implement this code in both configuration

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% >
Line 8: <asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal"
HeaderStyle-Cssclass="NormalBold" Border="0" width="100%"
AutoGenerateColumns="false" EnableViewState="false" runat="server"
AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages"
PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next"
PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page"
OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px"
AlternatingItemStyle-Font-Size="10px">
Line 9: <Columns>
Line 10: <asp:TemplateColumn>

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

This All my Working code Html and .vb code behind from the localhost
application

<%@ 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% >
<asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal"
HeaderStyle-Cssclass="NormalBold" Border="0" width="100%"
AutoGenerateColumns="false" EnableViewState="false" runat="server"
AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages"
PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next"
PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page"
OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px"
AlternatingItemStyle-Font-Size="10px">
<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>
<asp:TemplateColumn HeaderText="Role">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem,
"Role") %>' ID="Label2" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Email">
<ItemTemplate>
<A href=mailto:<%# DataBinder.Eval(Container.DataItem, "Email") %>><Font
size=2><%# DataBinder.Eval(Container.DataItem, "Email") %></Font></a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Contact 1">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem,
"Contact1") %>' ID="Label4" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Conatact 2">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem,
"Contact2") %>' ID="Label5" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>
</td>
<td width="6" background="images/module_body_right.jpg"></td>
</tr>
<tr>
<td><img src="images/module_footer_left.jpg"></td>
<td background="images/module_footer_bg.jpg"><img src="images/spacer.gif"
width="100%" height="1"></td>
<td><img src="images/module_footer_right.jpg"></td>
</tr>
</table>

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.
'
'*******************************************************'

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
myDataGrid.PagerStyle.Mode = PagerMode.NextPrev

Dim contacts As New ASPNetPortal.ContactsDB()

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

End Sub

Protected Sub myDataGrid_OnItemDataBound(ByVal sender As
System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)

' Create Instance of Connection and Command Object
Dim myConnection As New
SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim myCommand As New SqlDataAdapter("GetContactAliasNames",
myConnection)

' Mark the Command as a SPROC
myCommand.SelectCommand.CommandType =
CommandType.StoredProcedure

' Add Parameters to SPROC
Dim parameterModuleId As New SqlParameter("@ModuleId",
SqlDbType.Int, 4)
parameterModuleId.Value = ModuleId
myCommand.SelectCommand.Parameters.Add(parameterModuleId)

' Create and Fill the DataSet
Dim myDataSet As New DataSet()
myCommand.Fill(myDataSet)

'We only want the header
If e.Item.ItemType = ListItemType.Header Then
'Where 0 is the column index containing the header we wish
to manipulate
'If there were two ther columns before our pub_name column
then we would change
'the line to something like this
'
Dim dtAliasNames As DataTable

Dim drowItem As DataRow

Dim dcolColumn As DataColumn
Dim dcolShow As DataColumn

dtAliasNames = myDataSet.Tables(0)

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

For Each drowItem In dtAliasNames.Rows
Dim i = i + 1
If drowItem(dcolShow) = "true" Then
e.Item.Cells(i).Text = drowItem(dcolColumn) 'Title
Else
e.Item.Cells(i).Text = "" 'Title
End If
myDataGrid.Columns(i).Visible = drowItem(dcolShow) 'Show

Next

End If
End Sub

Public Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
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
that is not what I what to do. like I stated I don't belive it is a copy problem since i can just add the paging code (OnPageIndexChanged="MyDataGrid_Page" ) to a working .ascx control that already includes a working OnItemDataBound="myDataGrid_OnItemDataBound"

Why does trying to run it from the remote host fail vs running it from localhost. What could be wrong with my project on the remote host that won't let it complie?

----- Original Message -----
From: Meor Zaharin Meor Ibrahim
To: aspngDataGridRepeaterDatalist
Sent: Wednesday, August 14, 2002 11:21 PM
Subject: [aspngdatagridrepeaterdatalist] RE: More On. My DataGrid Paging Problem

forgive my ignorance, since you are copying the file from VS .NET project. I think if you compile the code behind and copy it to the /bin directory, maybe it will work.

Just my 2 cents
-----Original Message-----
From: Dennis West [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 6:23 AM
To: aspngDataGridRepeaterDatalist
Subject: [aspngdatagridrepeaterdatalist] More On. My DataGrid Paging Problem

The code below works (no errors) on my localhost using Visual Studio. The Project/Solution files show parent child relations (file with + signs) for code behind files

When I paste over the 3 files for Contacts .ascx/.ascx.vb/and the .resx to my host I do not see the + sign relationsship. but all files are there. cause I can view and edit the code for all files. The code is the same so the transfer of code from one application to another worked (and even if I coded with out copying it..its is the same) the only difference is that Visual Studio does not show the + sign for the file relations for codebehind files on my host server

I get this error when compiling off the host..

What I need is to be able to implement this code in both configuration

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% >
Line 8:         <asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next" PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page" OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px" AlternatingItemStyle-Font-Size="10px">
Line 9:         <Columns>
Line 10:         <asp:TemplateColumn>

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

This All my Working code Html and .vb code behind from the localhost application

<%@ 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% >
<asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next" PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page" OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px" AlternatingItemStyle-Font-Size="10px">
<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>
<asp:TemplateColumn HeaderText="Role">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Role") %>' ID="Label2" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Email">
<ItemTemplate>
<A href=mailto:<%# DataBinder.Eval(Container.DataItem, "Email") %>><Font size=2><%# DataBinder.Eval(Container.DataItem, "Email") %></Font></a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Contact 1">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Contact1") %>' ID="Label4" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Conatact 2">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Contact2") %>' ID="Label5" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>
</td>
<td width="6" background="images/module_body_right.jpg"></td>
</tr>
<tr>
<td><img src="images/module_footer_left.jpg"></td>
<td background="images/module_footer_bg.jpg"><img src="images/spacer.gif" width="100%" height="1"></td>
<td><img src="images/module_footer_right.jpg"></td>
</tr>
</table>

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.
'
'*******************************************************'

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
myDataGrid.PagerStyle.Mode = PagerMode.NextPrev

Dim contacts As New ASPNetPortal.ContactsDB()

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

End Sub

Protected Sub myDataGrid_OnItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)

' Create Instance of Connection and Command Object
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim myCommand As New SqlDataAdapter("GetContactAliasNames", myConnection)

' Mark the Command as a SPROC
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
Dim parameterModuleId As New SqlParameter("@ModuleId", SqlDbType.Int, 4)
parameterModuleId.Value = ModuleId
myCommand.SelectCommand.Parameters.Add(parameterModuleId)

' Create and Fill the DataSet
Dim myDataSet As New DataSet()
myCommand.Fill(myDataSet)

'We only want the header
If e.Item.ItemType = ListItemType.Header Then
'Where 0 is the column index containing the header we wish to manipulate
'If there were two ther columns before our pub_name column then we would change
'the line to something like this
'
Dim dtAliasNames As DataTable

Dim drowItem As DataRow

Dim dcolColumn As DataColumn
Dim dcolShow As DataColumn

dtAliasNames = myDataSet.Tables(0)

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

For Each drowItem In dtAliasNames.Rows
Dim i = i + 1
If drowItem(dcolShow) = "true" Then
e.Item.Cells(i).Text = drowItem(dcolColumn) 'Title
Else
e.Item.Cells(i).Text = "" 'Title
End If
myDataGrid.Columns(i).Visible = drowItem(dcolShow) 'Show

Next

End If
End Sub

Public Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
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
| [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
BC30456: 'MyDataGrid_Page' is not a member of 'ASP.contacts_ascx'

Maybe your host is using different namespace. I notice you wrote the namespace as ASPNetPortal but the error shown ASP. It could be the namespace problem. It happened to me when including files from another project in VS .NET

-----Original Message-----
From: Dennis West [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 7:11 PM
To: aspngDataGridRepeaterDatalist
Subject: [aspngdatagridrepeaterdatalist] RE: More On. My DataGrid Paging Problem

that is not what I what to do. like I stated I don't belive it is a copy problem since i can just add the paging code (OnPageIndexChanged="MyDataGrid_Page" ) to a working .ascx control that already includes a working OnItemDataBound="myDataGrid_OnItemDataBound"

Why does trying to run it from the remote host fail vs running it from localhost. What could be wrong with my project on the remote host that won't let it complie?

----- Original Message -----

From: Meor Zaharin Meor Ibrahim <mailto:Click here to reveal e-mail address>
To: aspngDataGridRepeaterDatalist <mailto:Click here to reveal e-mail address>
Sent: Wednesday, August 14, 2002 11:21 PM
Subject: [aspngdatagridrepeaterdatalist] RE: More On. My DataGrid Paging Problem

forgive my ignorance, since you are copying the file from VS .NET project. I think if you compile the code behind and copy it to the /bin directory, maybe it will work.

Just my 2 cents

-----Original Message-----
From: Dennis West [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 6:23 AM
To: aspngDataGridRepeaterDatalist
Subject: [aspngdatagridrepeaterdatalist] More On. My DataGrid Paging Problem

<%@ Control language="vb" Inherits="ASPNetPortal.Contacts" CodeBehind="Contacts.ascx.vb" AutoEventWireup="false" %>The code below works (no errors) on my localhost using Visual Studio. The Project/Solution files show parent child relations (file with + signs) for code behind files

When I paste over the 3 files for Contacts .ascx/.ascx.vb/and the .resx to my host I do not see the + sign relationsship. but all files are there. cause I can view and edit the code for all files. The code is the same so the transfer of code from one application to another worked (and even if I coded with out copying it..its is the same) the only difference is that Visual Studio does not show the + sign for the file relations for codebehind files on my host server

I get this error when compiling off the host..

What I need is to be able to implement this code in both configuration

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% >

Line 8:         <asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next" PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page" OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px" AlternatingItemStyle-Font-Size="10px">

Line 9:         <Columns>

Line 10:         <asp:TemplateColumn>

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

This All my Working code Html and .vb code behind from the localhost application

<%@ 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% >
<asp:datagrid id="myDataGrid" ItemStyle-CssClass="Normal" HeaderStyle-Cssclass="NormalBold" Border="0" width="100%" AutoGenerateColumns="false" EnableViewState="false" runat="server" AllowPaging="True" PageSize="5" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right" PagerStyle-NextPageText="Next" PagerStyle-PrevPageText="Prev" OnPageIndexChanged="MyDataGrid_Page" OnItemDataBound="myDataGrid_OnItemDataBound" PagerStyle-Font-Size="10px" AlternatingItemStyle-Font-Size="10px">
<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>
<asp:TemplateColumn HeaderText="Role">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Role") %>' ID="Label2" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Email">
<ItemTemplate>
<A href=mailto:<%# DataBinder.Eval(Container.DataItem, "Email") %>><Font size=2><%# DataBinder.Eval(Container.DataItem, "Email") %></Font></a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Contact 1">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Contact1") %>' ID="Label4" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Conatact 2">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Contact2") %>' ID="Label5" />
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:datagrid>
</td>
<td width="6" background="images/module_body_right.jpg"></td>
</tr>
<tr>
<td><img src="images/module_footer_left.jpg"></td>
<td background="images/module_footer_bg.jpg"><img src="images/spacer.gif" width="100%" height="1"></td>
<td><img src="images/module_footer_right.jpg"></td>
</tr>
</table>

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.
'
'*******************************************************'

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
myDataGrid.PagerStyle.Mode = PagerMode.NextPrev

Dim contacts As New ASPNetPortal.ContactsDB()

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

End Sub

Protected Sub myDataGrid_OnItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)

' Create Instance of Connection and Command Object
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim myCommand As New SqlDataAdapter("GetContactAliasNames", myConnection)

' Mark the Command as a SPROC
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
Dim parameterModuleId As New SqlParameter("@ModuleId", SqlDbType.Int, 4)
parameterModuleId.Value = ModuleId
myCommand.SelectCommand.Parameters.Add(parameterModuleId)

' Create and Fill the DataSet
Dim myDataSet As New DataSet()
myCommand.Fill(myDataSet)

'We only want the header
If e.Item.ItemType = ListItemType.Header Then
'Where 0 is the column index containing the header we wish to manipulate
'If there were two ther columns before our pub_name column then we would change
'the line to something like this
'
Dim dtAliasNames As DataTable

Dim drowItem As DataRow

Dim dcolColumn As DataColumn
Dim dcolShow As DataColumn

dtAliasNames = myDataSet.Tables(0)

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

dcolColumn = dtAliasNames.Columns("AliasName")
dcolShow = dtAliasNames.Columns("Show")

For Each drowItem In dtAliasNames.Rows
Dim i = i + 1
If drowItem(dcolShow) = "true" Then
e.Item.Cells(i).Text = drowItem(dcolColumn) 'Title
Else
e.Item.Cells(i).Text = "" 'Title
End If
myDataGrid.Columns(i).Visible = drowItem(dcolShow) 'Show

Next

End If
End Sub

Public Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
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<%@ Register TagPrefix="Portal" TagName="Title" Src="~/DesktopModuleTitle.ascx"%>
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

| [aspngdatagridrepeaterdatalist] member Click here to reveal e-mail address = YOUR ID | http://www.aspfriends.com/aspfriends/aspngdatagridrepeaterdatalist.asp = JOIN/QUIT

| [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.Configuration.ConfigurationSettings
System.Data.CommandType
System.Data.DataColumn
System.Data.DataRow
System.Data.DataSet
System.Data.DataTable
System.Data.SqlClient.SqlConnection
System.Data.SqlClient.SqlDataAdapter
System.Data.SqlClient.SqlParameter
System.Data.SqlDbType
System.EventArgs
System.Object
System.Web.UI.DataBinder
System.Web.UI.MobileControls.PagerStyle
System.Web.UI.WebControls.DataGrid
System.Web.UI.WebControls.DataGridItemEventArgs
System.Web.UI.WebControls.DataGridPageChangedEventArgs
System.Web.UI.WebControls.HorizontalAlign
System.Web.UI.WebControls.HyperLink
System.Web.UI.WebControls.ListItemType
System.Web.UI.WebControls.PagerMode
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