custom control - reference to contained elements in inherited class

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">
<cc1:DefaultGrid id="DefaultGrid1" AllowPaging="true"
OnPageIndexChanged="PageChanged" AllowSorting="True"
OnSortCommand="SortByColumn" runat="server"></cc1:DefaultGrid>
</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 <cc1:Default 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
 
N

Natty Gur

Hi,

You got this error because your name space isn’t declared in asp.xsd
schema. Alter the schema (lot of work) or live with it. Beside this
error every thing supposes to work fine.

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top