Custom control code serialization to class file

D

Dale

I have a custom control that includes a custom collection. In the collection
editor, I add a new item to the collection and that item gets persisted as
desired to the aspx page that contains the control but it does not persist to
the aspx.cs page.

As I have tested different combinations of methods, overrides, custom
collectioneditors, custom type converters, etc. at some times, and
intermittently, I have had collection items persist as fields in the page
class but I have not been able to pin it down or reproduce the behavior in
any consistent fashion.

The attributes I have on the collection property within my custom control
class are:

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Editor(typeof(MyCollectionEditor), typeof(UITypeEditor))
NotifyParentProperty(true),PersistenceMode(PersistenceMode.InnerDefaultProperty),
Category("Data")]

Is there an attribute that I am missing that controls declaring the control
as a field in the page class? Any other suggestions?

Thanks,
 
S

Steven Cheng[MSFT]

Hi Dale,

Welcome to ASPNET newsgroup.
From your description, you're developing a custom web server control which
has a collection propety which is of custom collection type. And you're
wondering how to make the control's this propety be persisted in it's
container page's class field?

As you mentioned that
=========
I have had collection items persist as fields in the page
class but I have not been able to pin it down or reproduce the behavior in
any consistent fashion
=========

I'm not quite sure on this, do you mean your custom control's collection
property will be stored in it's contianer page's field/property? Based on
my understanding, currently for ASP.NET custom server control, the
design-time feature only allow us to persist the properties in the inline
HTML (inside control tag). Also, if we can make control's property become a
direct field of it's host page's field, that may occur field conflicting
there're multi such controls in a single page. Anyway, it would be much
helpful if you can provide a certain demo so that we can perform some test
on our side.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)







--------------------
| Thread-Topic: Custom control code serialization to class file
| thread-index: AcWPjE3jWtQF7EuRRw2+ThV5AJyGOA==
| X-WBNR-Posting-Host: 63.235.249.11
| From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| Subject: Custom control code serialization to class file
| Date: Sat, 23 Jul 2005 06:42:01 -0700
| Lines: 28
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.buildingcontrols:3908
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
|
| I have a custom control that includes a custom collection. In the
collection
| editor, I add a new item to the collection and that item gets persisted
as
| desired to the aspx page that contains the control but it does not
persist to
| the aspx.cs page.
|
| As I have tested different combinations of methods, overrides, custom
| collectioneditors, custom type converters, etc. at some times, and
| intermittently, I have had collection items persist as fields in the page
| class but I have not been able to pin it down or reproduce the behavior
in
| any consistent fashion.
|
| The attributes I have on the collection property within my custom control
| class are:
|
| [DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
| Editor(typeof(MyCollectionEditor), typeof(UITypeEditor)),
NotifyParentProperty(true),PersistenceMode(PersistenceMode.InnerDefaultPrope
rty),
| Category("Data")]
|
| Is there an attribute that I am missing that controls declaring the
control
| as a field in the page class? Any other suggestions?
|
| Thanks,
|
| --
| Dale Preston
| MCAD C#
| MCSE, MCDBA
|
 
D

Dale

I have sent the sample to you directly in a zip file to avoid posting
attachments to the group but it is really pretty simple to describe. I
apologize if my first post wasn't more clear.

My control, ClientScripts has a collection of ClientScript objects. The
collection items do get persisted properly to the ASPX page's HTML. What I
am trying to get is for them to be declared as fields in the page's class
file. I have not been able to pin this behavior down. For instance, I want
them to be added to the class as:

protected ClientScript clientScript1;
protected ClientScript clientScript2;

and so on.

Thanks,
--
Dale Preston
MCAD C#
MCSE, MCDBA


Steven Cheng said:
Hi Dale,

Welcome to ASPNET newsgroup.
From your description, you're developing a custom web server control which
has a collection propety which is of custom collection type. And you're
wondering how to make the control's this propety be persisted in it's
container page's class field?

As you mentioned that
=========
I have had collection items persist as fields in the page
class but I have not been able to pin it down or reproduce the behavior in
any consistent fashion
=========

I'm not quite sure on this, do you mean your custom control's collection
property will be stored in it's contianer page's field/property? Based on
my understanding, currently for ASP.NET custom server control, the
design-time feature only allow us to persist the properties in the inline
HTML (inside control tag). Also, if we can make control's property become a
direct field of it's host page's field, that may occur field conflicting
there're multi such controls in a single page. Anyway, it would be much
helpful if you can provide a certain demo so that we can perform some test
on our side.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)







--------------------
| Thread-Topic: Custom control code serialization to class file
| thread-index: AcWPjE3jWtQF7EuRRw2+ThV5AJyGOA==
| X-WBNR-Posting-Host: 63.235.249.11
| From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| Subject: Custom control code serialization to class file
| Date: Sat, 23 Jul 2005 06:42:01 -0700
| Lines: 28
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.buildingcontrols:3908
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
|
| I have a custom control that includes a custom collection. In the
collection
| editor, I add a new item to the collection and that item gets persisted
as
| desired to the aspx page that contains the control but it does not
persist to
| the aspx.cs page.
|
| As I have tested different combinations of methods, overrides, custom
| collectioneditors, custom type converters, etc. at some times, and
| intermittently, I have had collection items persist as fields in the page
| class but I have not been able to pin it down or reproduce the behavior
in
| any consistent fashion.
|
| The attributes I have on the collection property within my custom control
| class are:
|
| [DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
| Editor(typeof(MyCollectionEditor), typeof(UITypeEditor)),
NotifyParentProperty(true),PersistenceMode(PersistenceMode.InnerDefaultPrope
rty),
| Category("Data")]
|
| Is there an attribute that I am missing that controls declaring the
control
| as a field in the page class? Any other suggestions?
|
| Thanks,
|
| --
| Dale Preston
| MCAD C#
| MCSE, MCDBA
|
 
D

Dale

Well, surprise, surprise. The email on your post doesn't work. I guess I
should have expected that, mine doesn't either. Anyway, you won't get the
zip file so here's a link to the project on my blog:

http://www.dalepreston.com/Blog/2005/07/visually-add-client-scripts-to-your.html

It works pretty well like it is, but I just want to find that one last
answer about having the designer add the field declaration to the page class.

Thanks,
--
Dale Preston
MCAD C#
MCSE, MCDBA


Steven Cheng said:
Hi Dale,

Welcome to ASPNET newsgroup.
From your description, you're developing a custom web server control which
has a collection propety which is of custom collection type. And you're
wondering how to make the control's this propety be persisted in it's
container page's class field?

As you mentioned that
=========
I have had collection items persist as fields in the page
class but I have not been able to pin it down or reproduce the behavior in
any consistent fashion
=========

I'm not quite sure on this, do you mean your custom control's collection
property will be stored in it's contianer page's field/property? Based on
my understanding, currently for ASP.NET custom server control, the
design-time feature only allow us to persist the properties in the inline
HTML (inside control tag). Also, if we can make control's property become a
direct field of it's host page's field, that may occur field conflicting
there're multi such controls in a single page. Anyway, it would be much
helpful if you can provide a certain demo so that we can perform some test
on our side.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)







--------------------
| Thread-Topic: Custom control code serialization to class file
| thread-index: AcWPjE3jWtQF7EuRRw2+ThV5AJyGOA==
| X-WBNR-Posting-Host: 63.235.249.11
| From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| Subject: Custom control code serialization to class file
| Date: Sat, 23 Jul 2005 06:42:01 -0700
| Lines: 28
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.buildingcontrols:3908
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
|
| I have a custom control that includes a custom collection. In the
collection
| editor, I add a new item to the collection and that item gets persisted
as
| desired to the aspx page that contains the control but it does not
persist to
| the aspx.cs page.
|
| As I have tested different combinations of methods, overrides, custom
| collectioneditors, custom type converters, etc. at some times, and
| intermittently, I have had collection items persist as fields in the page
| class but I have not been able to pin it down or reproduce the behavior
in
| any consistent fashion.
|
| The attributes I have on the collection property within my custom control
| class are:
|
| [DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
| Editor(typeof(MyCollectionEditor), typeof(UITypeEditor)),
NotifyParentProperty(true),PersistenceMode(PersistenceMode.InnerDefaultPrope
rty),
| Category("Data")]
|
| Is there an attribute that I am missing that controls declaring the
control
| as a field in the page class? Any other suggestions?
|
| Thanks,
|
| --
| Dale Preston
| MCAD C#
| MCSE, MCDBA
|
 
S

Steven Cheng[MSFT]

Thanks for your response Dale,

Is the link you mentioned the "ClientScripts" project on your blog? If so,
I''ve found it and will have a look.
I'll update you if I got any new info. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Custom control code serialization to class file
| thread-index: AcWReboZabUXoXYHSUmjI5dU11WP0g==
| X-WBNR-Posting-Host: 24.116.7.58
| From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: Custom control code serialization to class file
| Date: Mon, 25 Jul 2005 17:34:04 -0700
| Lines: 120
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.buildingcontrols:3911
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
|
| Well, surprise, surprise. The email on your post doesn't work. I guess
I
| should have expected that, mine doesn't either. Anyway, you won't get
the
| zip file so here's a link to the project on my blog:
|
http://www.dalepreston.com/Blog/2005/07/visually-add-client-scripts-to-your.
html
|
| It works pretty well like it is, but I just want to find that one last
| answer about having the designer add the field declaration to the page
class.
|
| Thanks,
| --
| Dale Preston
| MCAD C#
| MCSE, MCDBA
|
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi Dale,
| >
| > Welcome to ASPNET newsgroup.
| > From your description, you're developing a custom web server control
which
| > has a collection propety which is of custom collection type. And you're
| > wondering how to make the control's this propety be persisted in it's
| > container page's class field?
| >
| > As you mentioned that
| > =========
| > I have had collection items persist as fields in the page
| > class but I have not been able to pin it down or reproduce the behavior
in
| > any consistent fashion
| > =========
| >
| > I'm not quite sure on this, do you mean your custom control's
collection
| > property will be stored in it's contianer page's field/property? Based
on
| > my understanding, currently for ASP.NET custom server control, the
| > design-time feature only allow us to persist the properties in the
inline
| > HTML (inside control tag). Also, if we can make control's property
become a
| > direct field of it's host page's field, that may occur field
conflicting
| > there're multi such controls in a single page. Anyway, it would be much
| > helpful if you can provide a certain demo so that we can perform some
test
| > on our side.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| >
| >
| > --------------------
| > | Thread-Topic: Custom control code serialization to class file
| > | thread-index: AcWPjE3jWtQF7EuRRw2+ThV5AJyGOA==
| > | X-WBNR-Posting-Host: 63.235.249.11
| > | From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| > | Subject: Custom control code serialization to class file
| > | Date: Sat, 23 Jul 2005 06:42:01 -0700
| > | Lines: 28
| > | Message-ID: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.buildingcontrols:3908
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > |
| > | I have a custom control that includes a custom collection. In the
| > collection
| > | editor, I add a new item to the collection and that item gets
persisted
| > as
| > | desired to the aspx page that contains the control but it does not
| > persist to
| > | the aspx.cs page.
| > |
| > | As I have tested different combinations of methods, overrides, custom
| > | collectioneditors, custom type converters, etc. at some times, and
| > | intermittently, I have had collection items persist as fields in the
page
| > | class but I have not been able to pin it down or reproduce the
behavior
| > in
| > | any consistent fashion.
| > |
| > | The attributes I have on the collection property within my custom
control
| > | class are:
| > |
| > |
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
| > | Editor(typeof(MyCollectionEditor), typeof(UITypeEditor)),
| >
NotifyParentProperty(true),PersistenceMode(PersistenceMode.InnerDefaultPrope
| > rty),
| > | Category("Data")]
| > |
| > | Is there an attribute that I am missing that controls declaring the
| > control
| > | as a field in the page class? Any other suggestions?
| > |
| > | Thanks,
| > |
| > | --
| > | Dale Preston
| > | MCAD C#
| > | MCSE, MCDBA
| > |
| >
| >
|
 
D

Dale

Yes, that's the project.

Thank you.
--
Dale Preston
MCAD C#
MCSE, MCDBA


Steven Cheng said:
Thanks for your response Dale,

Is the link you mentioned the "ClientScripts" project on your blog? If so,
I''ve found it and will have a look.
I'll update you if I got any new info. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Custom control code serialization to class file
| thread-index: AcWReboZabUXoXYHSUmjI5dU11WP0g==
| X-WBNR-Posting-Host: 24.116.7.58
| From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: Custom control code serialization to class file
| Date: Mon, 25 Jul 2005 17:34:04 -0700
| Lines: 120
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.buildingcontrols:3911
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
|
| Well, surprise, surprise. The email on your post doesn't work. I guess
I
| should have expected that, mine doesn't either. Anyway, you won't get
the
| zip file so here's a link to the project on my blog:
|
http://www.dalepreston.com/Blog/2005/07/visually-add-client-scripts-to-your.
html
|
| It works pretty well like it is, but I just want to find that one last
| answer about having the designer add the field declaration to the page
class.
|
| Thanks,
| --
| Dale Preston
| MCAD C#
| MCSE, MCDBA
|
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi Dale,
| >
| > Welcome to ASPNET newsgroup.
| > From your description, you're developing a custom web server control
which
| > has a collection propety which is of custom collection type. And you're
| > wondering how to make the control's this propety be persisted in it's
| > container page's class field?
| >
| > As you mentioned that
| > =========
| > I have had collection items persist as fields in the page
| > class but I have not been able to pin it down or reproduce the behavior
in
| > any consistent fashion
| > =========
| >
| > I'm not quite sure on this, do you mean your custom control's
collection
| > property will be stored in it's contianer page's field/property? Based
on
| > my understanding, currently for ASP.NET custom server control, the
| > design-time feature only allow us to persist the properties in the
inline
| > HTML (inside control tag). Also, if we can make control's property
become a
| > direct field of it's host page's field, that may occur field
conflicting
| > there're multi such controls in a single page. Anyway, it would be much
| > helpful if you can provide a certain demo so that we can perform some
test
| > on our side.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| >
| >
| > --------------------
| > | Thread-Topic: Custom control code serialization to class file
| > | thread-index: AcWPjE3jWtQF7EuRRw2+ThV5AJyGOA==
| > | X-WBNR-Posting-Host: 63.235.249.11
| > | From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| > | Subject: Custom control code serialization to class file
| > | Date: Sat, 23 Jul 2005 06:42:01 -0700
| > | Lines: 28
| > | Message-ID: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.buildingcontrols:3908
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > |
| > | I have a custom control that includes a custom collection. In the
| > collection
| > | editor, I add a new item to the collection and that item gets
persisted
| > as
| > | desired to the aspx page that contains the control but it does not
| > persist to
| > | the aspx.cs page.
| > |
| > | As I have tested different combinations of methods, overrides, custom
| > | collectioneditors, custom type converters, etc. at some times, and
| > | intermittently, I have had collection items persist as fields in the
page
| > | class but I have not been able to pin it down or reproduce the
behavior
| > in
| > | any consistent fashion.
| > |
| > | The attributes I have on the collection property within my custom
control
| > | class are:
| > |
| > |
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
| > | Editor(typeof(MyCollectionEditor), typeof(UITypeEditor)),
| >
NotifyParentProperty(true),PersistenceMode(PersistenceMode.InnerDefaultPrope
| > rty),
| > | Category("Data")]
| > |
| > | Is there an attribute that I am missing that controls declaring the
| > control
| > | as a field in the page class? Any other suggestions?
| > |
| > | Thanks,
| > |
| > | --
| > | Dale Preston
| > | MCAD C#
| > | MCSE, MCDBA
| > |
| >
| >
|
 
S

Steven Cheng[MSFT]

Hi Dale,

I've had a look at your project on my side. First I should say you've done
a good job:). For the field decalaration for the ClientScript Collection
under the ClientScripts control, I think the current behavior of your
control is the correct and reasonable one. Since you use the
[ParseChildren(true, "Scripts")] for your ClientScripts control, so all
it's inner HTML will be parsed as the content of the "ScriptCollection"
member property, so of course they won't become member field of the page
class.

As for the behavior that becoming member field of page class, I'm thinking
whether you've ever made your ClientScripts control as a pure Container
control(not NamingContainer), just like the
System.Web.UI.WebControls.Panel, all the sub controls in the Panel's tag
will be declared as a top level member field of the page. But don't think
this mode is appropriate for your script control.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Custom control code serialization to class file
| thread-index: AcWTG48ZqeTHw3DOQ6KePPOEyMy5HA==
| X-WBNR-Posting-Host: 24.116.7.58
| From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: RE: Custom control code serialization to class file
| Date: Wed, 27 Jul 2005 19:25:02 -0700
| Lines: 191
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.buildingcontrols:3938
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
|
| Yes, that's the project.
|
| Thank you.
| --
| Dale Preston
| MCAD C#
| MCSE, MCDBA
|
|
| "Steven Cheng[MSFT]" wrote:
|
| > Thanks for your response Dale,
| >
| > Is the link you mentioned the "ClientScripts" project on your blog? If
so,
| > I''ve found it and will have a look.
| > I'll update you if I got any new info. Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | Thread-Topic: Custom control code serialization to class file
| > | thread-index: AcWReboZabUXoXYHSUmjI5dU11WP0g==
| > | X-WBNR-Posting-Host: 24.116.7.58
| > | From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > | Subject: RE: Custom control code serialization to class file
| > | Date: Mon, 25 Jul 2005 17:34:04 -0700
| > | Lines: 120
| > | Message-ID: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.buildingcontrols:3911
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > |
| > | Well, surprise, surprise. The email on your post doesn't work. I
guess
| > I
| > | should have expected that, mine doesn't either. Anyway, you won't
get
| > the
| > | zip file so here's a link to the project on my blog:
| > |
| >
http://www.dalepreston.com/Blog/2005/07/visually-add-client-scripts-to-your.
| > html
| > |
| > | It works pretty well like it is, but I just want to find that one
last
| > | answer about having the designer add the field declaration to the
page
| > class.
| > |
| > | Thanks,
| > | --
| > | Dale Preston
| > | MCAD C#
| > | MCSE, MCDBA
| > |
| > |
| > | "Steven Cheng[MSFT]" wrote:
| > |
| > | > Hi Dale,
| > | >
| > | > Welcome to ASPNET newsgroup.
| > | > From your description, you're developing a custom web server
control
| > which
| > | > has a collection propety which is of custom collection type. And
you're
| > | > wondering how to make the control's this propety be persisted in
it's
| > | > container page's class field?
| > | >
| > | > As you mentioned that
| > | > =========
| > | > I have had collection items persist as fields in the page
| > | > class but I have not been able to pin it down or reproduce the
behavior
| > in
| > | > any consistent fashion
| > | > =========
| > | >
| > | > I'm not quite sure on this, do you mean your custom control's
| > collection
| > | > property will be stored in it's contianer page's field/property?
Based
| > on
| > | > my understanding, currently for ASP.NET custom server control, the
| > | > design-time feature only allow us to persist the properties in the
| > inline
| > | > HTML (inside control tag). Also, if we can make control's property
| > become a
| > | > direct field of it's host page's field, that may occur field
| > conflicting
| > | > there're multi such controls in a single page. Anyway, it would be
much
| > | > helpful if you can provide a certain demo so that we can perform
some
| > test
| > | > on our side.
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | Thread-Topic: Custom control code serialization to class file
| > | > | thread-index: AcWPjE3jWtQF7EuRRw2+ThV5AJyGOA==
| > | > | X-WBNR-Posting-Host: 63.235.249.11
| > | > | From: "=?Utf-8?B?RGFsZQ==?=" <[email protected]>
| > | > | Subject: Custom control code serialization to class file
| > | > | Date: Sat, 23 Jul 2005 06:42:01 -0700
| > | > | Lines: 28
| > | > | Message-ID: <[email protected]>
| > | > | MIME-Version: 1.0
| > | > | Content-Type: text/plain;
| > | > | charset="Utf-8"
| > | > | Content-Transfer-Encoding: 7bit
| > | > | X-Newsreader: Microsoft CDO for Windows 2000
| > | > | Content-Class: urn:content-classes:message
| > | > | Importance: normal
| > | > | Priority: normal
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | > | Newsgroups:
microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > | > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet.buildingcontrols:3908
| > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.aspnet.buildingcontrols
| > | > |
| > | > | I have a custom control that includes a custom collection. In
the
| > | > collection
| > | > | editor, I add a new item to the collection and that item gets
| > persisted
| > | > as
| > | > | desired to the aspx page that contains the control but it does
not
| > | > persist to
| > | > | the aspx.cs page.
| > | > |
| > | > | As I have tested different combinations of methods, overrides,
custom
| > | > | collectioneditors, custom type converters, etc. at some times,
and
| > | > | intermittently, I have had collection items persist as fields in
the
| > page
| > | > | class but I have not been able to pin it down or reproduce the
| > behavior
| > | > in
| > | > | any consistent fashion.
| > | > |
| > | > | The attributes I have on the collection property within my custom
| > control
| > | > | class are:
| > | > |
| > | > |
| >
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
| > | > | Editor(typeof(MyCollectionEditor), typeof(UITypeEditor)),
| > | >
| >
NotifyParentProperty(true),PersistenceMode(PersistenceMode.InnerDefaultPrope
| > | > rty),
| > | > | Category("Data")]
| > | > |
| > | > | Is there an attribute that I am missing that controls declaring
the
| > | > control
| > | > | as a field in the page class? Any other suggestions?
| > | > |
| > | > | Thanks,
| > | > |
| > | > | --
| > | > | Dale Preston
| > | > | MCAD C#
| > | > | MCSE, MCDBA
| > | > |
| > | >
| > | >
| > |
| >
| >
|
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top