Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > how to persist my CustomControl's subcontrol

Reply
Thread Tools

how to persist my CustomControl's subcontrol

 
 
lao.pan
Guest
Posts: n/a
 
      11-29-2003
I create a custom control with subcontrol.but in design-
time, subcontrol contents are clear by VS when I change
any attribute of the control.
why?
thank!

the main code is:
[
ParseChildren(false),
ControlBuilderAttribute(typeof(MyControlBuilder)),
]
public class MyCS_CustomControl: System.Web.UI.Control,
INamingContainer
{
private CellCollection _Items=new
CellCollection();

[
Category("Data"),
DefaultValue(null),
MergableProperty(false),
PersistenceMode
(PersistenceMode.InnerDefaultProperty),
]
public virtual CellCollection Items
{
get { return _Items; }
}
}

CellCollection is inherit from CollectionBase,Item is a
sample class

the html tag is:
<custom:mycs_customcontrol id="csTableId" title="C#
Custom1 Control Table" runat="server" columns="2"
rows="2">
<CUSTEM:MYCELL Text="RED"
BackColor="red" CellID="r1c1"></CUSTEM:MYCELL>

</custom:mycs_customcontrol></form>

at run-time all ok, but mycell clear in designtime when
control-attr changed.


 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      12-02-2003
Denis Bauer has a control that recreates dynamic controls on subsequent
requests.

http://www.denisbauer.com/ASPNETCont...aceholder.aspx

"lao.pan" <(E-Mail Removed)> wrote in message
news:064801c3b64b$b0bf8610$(E-Mail Removed)...
> I create a custom control with subcontrol.but in design-
> time, subcontrol contents are clear by VS when I change
> any attribute of the control.
> why?
> thank!
>
> the main code is:
> [
> ParseChildren(false),
> ControlBuilderAttribute(typeof(MyControlBuilder)),
> ]
> public class MyCS_CustomControl: System.Web.UI.Control,
> INamingContainer
> {
> private CellCollection _Items=new
> CellCollection();
>
> [
> Category("Data"),
> DefaultValue(null),
> MergableProperty(false),
> PersistenceMode
> (PersistenceMode.InnerDefaultProperty),
> ]
> public virtual CellCollection Items
> {
> get { return _Items; }
> }
> }
>
> CellCollection is inherit from CollectionBase,Item is a
> sample class
>
> the html tag is:
> <custom:mycs_customcontrol id="csTableId" title="C#
> Custom1 Control Table" runat="server" columns="2"
> rows="2">
> <CUSTEM:MYCELL Text="RED"
> BackColor="red" CellID="r1c1"></CUSTEM:MYCELL>
>
> </custom:mycs_customcontrol></form>
>
> at run-time all ok, but mycell clear in designtime when
> control-attr changed.
>
>



 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Repeater SubControl Dropdownlist not saving SelectedValue Ben Dewey ASP .Net 3 11-01-2005 03:15 PM
setting focus to datagrid subcontrol Bonj ASP .Net 1 11-13-2004 09:47 PM
DataBinding to a subcontrol... Fred Hirschfeld ASP .Net Building Controls 0 09-18-2004 02:53 PM
Getting a subcontrol to work in a repeater James Geurts ASP .Net Building Controls 3 02-18-2004 06:04 AM



Advertisments