J
Jon Stranger
I am trying to build a custom web control based on DataGrid using VS.NET
Standard Edition and have a problem referencing the Columns collection.
The control has been built in a separate VS.NET solution/project called
MyControls. The following is a cut down version:
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace Grids
<ParseChildren(True)> Public Class DefaultGrid
Inherits DataGrid
Public Sub New()
PagerStyle.Mode = PagerMode.NumericPages
..
..
End Sub
End Class
End Namespace
In my test project, I have added the control into the toolbox and dragged it
onto a Web form called testDefaultGrid which is as follows:
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="testDefaultGrid.aspx.vb" Inherits="test2.WebForm2"%>
<%@ Register TagPrefix="cc1" Namespace="MyControls.Grids"
Assembly="MyControls" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Testing DefaultGrid</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie6">
</HEAD>
<BODY bgColor="ivory">
<h2>Testing the DefaultGrid Control</h2>
<form id="Form1" method="post" runat="server">
<cc1efaultGrid id="DefaultGrid1" AllowPaging="true"
OnPageIndexChanged="PageChanged" AllowSorting="True"
OnSortCommand="SortByColumn" runat="server"></cc1efaultGrid>
</form>
</BODY>
</HTML>
I handle the paging and sorting events in a code behind and all this works
fine. However, if I try to insert <Columns> (and tags like
<asp:BoundColumn>) inside the <cc1efault Grid>, in the same way as I can
with the standard DataGrid, VS.NET says that the active schema does not
support the element 'Columns'.
I suspect that there is some bit of referencing that is not provided
automatically in VS.NET Standard but is in the control library support in
other editions. Can anyone give me a clue here on what I need to do to fix
this (other than upgrading)?
Jon Stranger
Standard Edition and have a problem referencing the Columns collection.
The control has been built in a separate VS.NET solution/project called
MyControls. The following is a cut down version:
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace Grids
<ParseChildren(True)> Public Class DefaultGrid
Inherits DataGrid
Public Sub New()
PagerStyle.Mode = PagerMode.NumericPages
..
..
End Sub
End Class
End Namespace
In my test project, I have added the control into the toolbox and dragged it
onto a Web form called testDefaultGrid which is as follows:
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="testDefaultGrid.aspx.vb" Inherits="test2.WebForm2"%>
<%@ Register TagPrefix="cc1" Namespace="MyControls.Grids"
Assembly="MyControls" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Testing DefaultGrid</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie6">
</HEAD>
<BODY bgColor="ivory">
<h2>Testing the DefaultGrid Control</h2>
<form id="Form1" method="post" runat="server">
<cc1efaultGrid id="DefaultGrid1" AllowPaging="true"
OnPageIndexChanged="PageChanged" AllowSorting="True"
OnSortCommand="SortByColumn" runat="server"></cc1efaultGrid>
</form>
</BODY>
</HTML>
I handle the paging and sorting events in a code behind and all this works
fine. However, if I try to insert <Columns> (and tags like
<asp:BoundColumn>) inside the <cc1efault Grid>, in the same way as I can
with the standard DataGrid, VS.NET says that the active schema does not
support the element 'Columns'.
I suspect that there is some bit of referencing that is not provided
automatically in VS.NET Standard but is in the control library support in
other editions. Can anyone give me a clue here on what I need to do to fix
this (other than upgrading)?
Jon Stranger