Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > [Need Expert] Big design time problem

Reply
Thread Tools

[Need Expert] Big design time problem

 
 
Loïc
Guest
Posts: n/a
 
      11-05-2003
Hello,

I have created a simple webcontrol named MyControl tahat contains one single
property. The property name is Columns , his type is ColumnCollection (
inherits from CollectionBase). this property contains an elements list and
the type of these elements is Column.

On a WebForm (in design mode), i insert my MyControl webcontrol . Je fill
in his Columns property ( it inherits from CollectionBase type so the
collection editor is opened ). Then i switch to Html mode to see the
generated Xml code :

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="Xes_Web_Controls.WebForm1" %>
<%@ Register TagPrefix="cc1" Namespace="Controls" Assembly="Controls" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<cc1:mycontrol id="MyControl9" style="Z-INDEX: 101; LEFT: 336px;
POSITION: absolute; TOP: 168px" runat="server" Width="464px">
<Columns>
<cc1:Column Type="string" Name="prenom"></cc1:Column>
<cc1:Column Type="string" Name="nom"></cc1:Column>
</Columns>
</cc1:mycontrol>
</form>
</body>
</HTML>

At this step there is no problem. Buyt then i close the file which contains
my webform, then i re-open the file. I switch to design mode and there is an
error on my control ('' could not be set on property 'Columns' ).
I do not understand this error and do no know resolve this error.

Does anybody help me

Thanks

Loïc

PS : at bottom, we can find my sources
[MyControl.cs]
using System;
using System.ComponentModel ;
using System.Web.UI ;
using System.Web.UI.WebControls ;

namespace Controls
{
public class MyControl : WebControl
{

private ColumnCollection m_columns ;
public MyControl()
{
m_columns = new ColumnCollection() ;
}
[
PersistenceMode(PersistenceMode.InnerProperty),
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content),
NotifyParentProperty(true)
]
public ColumnCollection Columns
{
get { return m_columns ; }
set { m_columns = value ; }
}
}
}

[ColumnCollection.cs]
namespace Controls
{
using System;
using System.Collections ;
using System.ComponentModel ;
using System.Web.UI ;

public class ColumnCollection : CollectionBase
{
public ColumnCollection() : base( )
{

}
public void AddColumn( Column _col )
{
List.Add( _col ) ;
}
[NotifyParentProperty(true)]
public Column this[int index]
{
get { return List[index] as Column ; }
set { List[index] = value ; }
}
}
}

[Column.cs]
namespace Controls
{
using System;
public class Column
{
private string m_name ;
private string m_type ;
public Column()
{

}
public string Name
{
get { return m_name ; }
set { m_name = value ; }
}
public string Type
{
set { m_type = value ; }
get { return m_type ; }
}
}
}


 
Reply With Quote
 
 
 
 
Natty Gur
Guest
Posts: n/a
 
      11-05-2003
I think you are missing inner default property persistence.
To enable inner default property persistence, you must mark your control
with the following variation of the ParseChildrenAttribute, where the
second argument of the attribute is the name of the inner default
property:

[
ParseChildren(true, "Columns")
]
public class MyControl : WebControl { ... }


Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Loïc
Guest
Posts: n/a
 
      11-06-2003
No it doesn't work .... there is another error ;-(

Can you help me ?

Loïc

"Natty Gur" <> a écrit dans le message de
news:...
> I think you are missing inner default property persistence.
> To enable inner default property persistence, you must mark your control
> with the following variation of the ParseChildrenAttribute, where the
> second argument of the attribute is the name of the inner default
> property:
>
> [
> ParseChildren(true, "Columns")
> ]
> public class MyControl : WebControl { ... }
>
>
> Natty Gur[MVP]
> Phone Numbers:
> Office: +972-(0)9-7740261
> Fax: +972-(0)9-7740261
> Mobile: +972-(0)58-888377
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Natty Gur
Guest
Posts: n/a
 
      11-06-2003
Hi,

I can try, what's the error.

if you can put your hand on that book [1], I think it will solve all of
your problems. what you're after isn't trivial task.

[1] Developing Microsoft ASP.NET Server Controls and Components
By Nikhil Kothari, Vandana Datje

Publisher : Microsoft Press
Pub Date : September 28, 2002
ISBN : 0-7356-1582-9


Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net 0 12-26-2008 09:29 AM
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net Web Controls 0 12-26-2008 06:11 AM
GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf Python 0 12-24-2008 07:35 AM
GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf Ruby 0 12-24-2008 05:07 AM
Is time.time() < time.time() always true? flamesrock Python 8 11-24-2006 06:51 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57