Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is the best Method to change styles of any control in Asp.net Page Life Cycle?


In interview they asked above question.... I don't know how should i understand this question plz help me if any one know...
Posted
Updated 15-Dec-13 22:19pm
v2

I suppose, It is Pre-Render Method where we change the styling of the controls.

You can go through this link
http://www.techrepublic.com/blog/software-engineer/aspnet-basics-the-page-life-cycle/[^]
 
Share this answer
 
ApplyStyle method for webcontrol is a best method Copies any nonblank elements of the specified style to the Web control, overwriting any existing style elements of the control. This method is primarily used by control developers.

system.web.ui.webcontrols.webcontrol.applystyle(v=vs.100).aspx[^]
 
Share this answer
 
Solution

The answer is HtmlTextWriter.AddStyleAttribute Method[^].
Quote:

Adds a markup style attribute to the opening tag of the element that the HtmlTextWriter object creates with a subsequent call to the RenderBeginTag method.


Examples

1. HtmlTextWriter and Controls[^]
2. Use of the HtmlTextWriter Class to Render Custom Controls in VB.NET[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900