Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Setting CssClass when rendering a property in edit mode

Vote:
 
Hi, I have tried to change css class of a custom property but it doesn't seem to work in edit mode. Any clues? public override void CreateEditControls() /* - Used when rendering the property in edit mode. */ { this.EditControl = new TextBox(); this.EditControl.TextMode = TextBoxMode.MultiLine; this.EditControl.Rows = 3; this.EditControl.Columns = 10; this.EditControl.Text = ToString(); this.EditControl.CssClass = "myclass"; this.ApplyControlAttributes(this.EditControl); this.Controls.Add(this.EditControl); this.SetupEditControls(); } Best Regards Anders
#15994
Feb 05, 2008 10:58
Vote:
 
Hi! I would try and switch places for these two rows as the call to ApplyControlAttributes might overwrite the css class: this.ApplyControlAttributes(this.EditControl); this.EditControl.CssClass = "myclass"; Linus Ekström EPiServer Development Team
#16768
Feb 05, 2008 11:55
Vote:
 
Hi Linus, I tried to do that but i doesn't work. Any more clues? Best Regards Anders
#16769
Feb 05, 2008 12:10
Vote:
 
Hi, I found the problem. You must set the cssclass after you add the control and before the SetupEditControls. Otherwise it will be overwritten. public override void CreateEditControls() /* - Used when rendering the property in edit mode. */ { this.EditControl = new TextBox(); this.EditControl.TextMode = TextBoxMode.MultiLine; this.EditControl.Rows = 3; this.EditControl.Columns = 10; this.EditControl.Text = ToString(); this.ApplyControlAttributes(this.EditControl); this.Controls.Add(this.EditControl); this.EditControl.CssClass = "myclass"; this.SetupEditControls(); } Best Regards Anders
#16770
Feb 05, 2008 12:51
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.