473,508 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Need Expert] Big design time problem

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 ; }
}
}
}
Nov 17 '05 #1
3 1107
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!
Nov 17 '05 #2
No it doesn't work .... there is another error ;-(

Can you help me ?

Loïc

"Natty Gur" <na***@dao2com.com> a écrit dans le message de
news:us**************@TK2MSFTNGP12.phx.gbl...
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!

Nov 17 '05 #3
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!
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

55
3875
by: Alex | last post by:
Hello people, The following is not a troll but a serious request. I found myself in a position where I have to present a Pro/Con list to management and architects in our company with regard to...
9
2912
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
3
1610
by: Wendell III | last post by:
Meetroduction (Meetro) is looking for a full-time JavaScript expert. Chicago-based startup seeks an experienced, dedicated and energetic JavaScript programmer to develop components of a robust,...
4
1489
by: suzy | last post by:
it seems like a simple enough problem, but i need some help...... i have a table of messages (like newsgroup messages) in sql server. my application will allow people to read threads/messages...
3
10606
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
162
14706
by: techievasant | last post by:
hello everyone, Iam vasant from India.. I have a test+interview on C /C++ in the coming month so plz help me by giving some resources of FAQS, interview questions, tracky questions, multiple...
5
1825
by: Kevin Carne | last post by:
First, Merry Christmas. I have been doing intensive Java programming for two years in school (no choice on the language), but now I need to return to C++ because my resume is filled with it both in...
2
1328
by: Viken Karaguesian | last post by:
Hello all, I don't mean to exclude the rest of the world here, but I think this will be more applicable for me. What's the going rate for freelance web designing in the USA? I know it...
4
1762
by: tahirahmed | last post by:
Hello, Before i start programming my application in C# I want ask a few things about directX capture class. My application scenario I want to design an application which is able to detect...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.