Dynamically change the page style with C # code

xiaoxiao2021-03-06  122

Dynamically change the page style with C # code

During the development of Web system, the CSS enhancement and beautification page style has become a standard 'process'. Develop BS systems in the Visual Studio .NET environment, you can easily set and modify the style of the control by setting the CSSClass property of the web control. However, in the actual development process, let developers set the CSSClass attribute of the control one by one, not only cumbersome, but also easily errors, more headaches, may also cause trouble on maintenance. The following code segment demonstrates a solution to achieving good results in practical applications, hoping to play the effect of bricking jade. Based on this idea, I believe that everyone can develop more applications, such as achieving simple SKIN features. code show as below. The method of use is to call loadPageCSS () in each .ASPX page_load () method. public void LoadPageCSS (System.Web.UI.Page vPage) {if (vPage.IsPostBack!) {SetControlsCSS (vPage.Controls);}} private void SetControlsCSS (System.Web.UI.ControlCollection vControls) {for (int i = . 0; i 0) {setControlscss (vControl.Controls);}}} private void radiobuttonlist_css (radiobuttonlist vrdolist) {vrdiList.cssclass = "radiobuttonlist_show";

转载请注明原文地址:https://www.9cbs.com/read-126247.html

New Post(0)