Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Need help from designer experts: templated control

Reply
Thread Tools

Need help from designer experts: templated control

 
 
AW
Guest
Posts: n/a
 
      11-05-2003
Hello guys, it's my turn to ask for help,

I'm fighting with Visual Studio.net 2003. I made a templated control and it
displays alright when I ask the page through my browser, but Visual Studio
can't display it. It displays the usual grey rectangle with an exclamation
mark saying " '' could not be set on property 'Columns'. "

I suspect that I missed a property, but can't manage to see which one. If
anybody could help me, that would be great.

Here is the simplified code for reference.

ASPX page that uses the control:
<%@ Register TagPrefix="cc1" Namespace="Controls" Assembly="Controls" %>
....
<cc1:MyControl id="MyControl12" runat="server">
<Columns>
<cc1:Column Name="Toto" Type="A" />
<cc1:Column Name="Titi" Type="B" />
</Columns>
</cc1:MyControl>

Control and its classes:
public class MyControl : WebControl
{
private ColumnCollection m_columns ;

public MyControl()
{
m_columns = new ColumnCollection() ;
}

[PersistenceMode(PersistenceMode.InnerProperty)]
public ColumnCollection Columns
{
get { return m_columns ; }
set { m_columns = value ; }
}

protected override void Render(HtmlTextWriter writer)
{
writer.Write("<b>Hello, the columns are:<b>");
writer.Write("<ul>");
foreach(Column c in Columns)
{
writer.Write("<li>");
writer.Write(c.Name);
}
writer.Write("</ul>");
}

}

public class ColumnCollection : CollectionBase, IList, ICollection
{
public ColumnCollection() : base( )
{

}

public void Add(Column _col)
{
List.Add(_col);
}

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

}
public class Column
{
private string m_name ;
private string m_type ;

[Category("Data"),
PersistenceMode(PersistenceMode.Attribute)]
public string Name
{
get { return m_name ; }
set { m_name = value ; }
}

[Category("Data"),
PersistenceMode(PersistenceMode.Attribute)]
public string Type
{
set { m_type = value ; }
get { return m_type ; }
}

public override string ToString()
{
return m_name + "/" + m_type;
}

}

--
To reply, remove a "l" before the @ sign.

Arnaud Weil - MCT, MCSD.Net, MCAD.Net


 
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
Calling templated member of templated object david@sunlightd.com C++ 1 06-22-2007 05:13 PM
templated function as parameter of another templated function Amadeus W. M. C++ 2 07-04-2006 09:59 PM
ASP.NET Templated User Controls - Limit child controls allowable within a templated control JohnyStyles@gmail.com ASP .Net 0 05-29-2006 06:00 PM
Subtypes of templated types (in templated functions) Marijn C++ 5 02-13-2004 09:50 AM
implementing a templated struct within a templated struct RA Scheltema C++ 3 01-06-2004 11:25 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