We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Runtime Attributes for BaseElement using the html style tag (css)

Thread ID:





34496 Sep 9,2005 08:11 PM UTC Sep 13,2005 05:02 AM UTC WinForms 2
Tags: HTMLUIControl
Brian Schlatter
Asked On September 9, 2005 08:11 PM UTC

Hi, I''m trying to do some runtime attribute changes to my BaseElements as they are selected. In particular, the "style" attribute for any html input tag (ie select, input, textarea). For example... this._htmlUIControl.Document.BeginUpdate(); textareaElement.Attributes["style"].Value = "background-color:yellow;" this._htmlUIControl.Document.EndUpdate(); *NOTE: Every element does have the style attribute within the attributes collection. However, I see no effect. I noticed that the style attribute has a IsRuntimeAttribute of false and I figure this is my problem. Is there any way around this such that I can place a background color to my input tags using the html style tag? Thanks, Brian

Nandakumar R [Syncfusion]
Replied On September 13, 2005 04:54 AM UTC

Hi Brian, I was able to reproduce your problem. I have placed a feature request for the BeginUpdate() not showing the effect. Regarding adding styles at run time to the HTML elements, this can be done using two methods: 1) We can assign the styles directly by changing the value of the style attribute as shown below: textareaElement.Attributes["style"].Value = "background-color:yellow;" if you don''t have a style attribute, you can add the attribute with the help of the Add method as shown below: if(elem.Attributes.Contains("style") == false) elem.Attributes.Add("style"); I have attached a sample for this method. Please let me know if it helps. 34496_changestyle_style.zip 2) With the help of style tags, we can change the styles by changing the value of the class attribute as shown below: textareaElement.Attributes["class"].Value = "newStyle"; A sample that uses this method to add styles is attchaed below: 34496_changestyle_class.zip Hope it meets your requirements. We appreciate your patience. Thank you for your interest in the Syncfusion products. Regards, Nanda.

Nandakumar R [Syncfusion]
Replied On September 13, 2005 05:02 AM UTC

Hi Brian, The link in the previous sample was broken. Please try this link, 34496_changestyle_class.zip Regards, Nanda.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon