Custom Control and ID

P

Patrick Gahan

Hi,

I'm trying to build my own set of custom controls that have one property
which sets the id to a string + the property's text.

The result works fine, I can actually see the controls id change on the
properties window but it won't update on the HTML source.

My code:

[Category(""), DefaultValue(""),
Description("Label Label key")
,RefreshProperties(RefreshProperties.All)]
public string LabelKey
{
get
{
if (this._sRessourcesLabelKey != null)
return this._sRessourcesLabelKey;
else
return "";
}
set
{
this.ID = "objLabel" + value;
if(this.Site != null && this.Site.DesignMode)
{ System.ComponentModel.Design.IDesignerHost idesignHost =
(System.ComponentModel.Design.IDesignerHost)this.Site.GetService(typeof
System.ComponentModel.Design.IDesignerHost)); ControlDesigner ctrlDsg
= (ControlDesigner)idesignHost.GetDesigner(this);
ctrlDsg.IsDirty = true;
ctrlDsg.InitializeNonDefault();
ctrlDsg.UpdateDesignTimeHtml();

}
this._sRessourcesLabelKey = value;
}
}

Thanks in advance.
 

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,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top