Persisting Design-time generated value

J

J.Marsch

I want to add a property to a control that will contain a GUID.

This GUID. Should be generated at design time, when the control is dropped
onto a WebForm. After the control has been dropped, the GUID should always
be of the same value. The problem is, that I cannot seem to get this GUID
value to be saved to the WebForm HTML.

I was able to accomplish this very easily with winforms:
public string ControlId
{
get
{
if(this._ControlId == null)
this._ControlId = System.Guid.NewGuid().ToString("N");
return this._ControlId;
}
set
{
this._ControlId = value;
}
}

That was all it took, because the Winform Designer would add code in
InitializeControl that re-set the ControlId to it's original value (for a
moment, it will have a new value, and then is reset to the original)

This doesn't seem to work with the WebForms designer. If I use this same
code, the value that is generated at design time is never persisted
(although it does appear in the Properties Window).

If I manually set the property at design time (with the Property Window),
whatever I typed in _is_ persisted as an Attribute in the HTML. How can I
guarantee that this automatically generated?
 
M

Mike Clay

Hi Jeremy,

My name is Mike with the ASP.NET Developer Support team.
I will be looking into this issue for you.
I will post a reply as soon as I find out something.

Mike Clay, MCSD
ASP.NET Support


This posting is provided "AS IS" with no warranties, and confers no rights.
© 2002 Microsoft Corporation. All rights reserved.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top