DataGrid Application Style File Defining Dynamic Style

zhaozj2021-02-16  68

DataGrid Application Style File Defining Dynamic Style

HBZXF (A Ho) http://www.cnblogs.com/hbzxf

During ASP.NET development, the frequency used by DataGrid is very high. For DataGrid style, you generally use custom different colors to apply to Header, Footer, EditItem, SelectItem, Item, Page, However, if each page is set one by one, the product is not known, and it is estimated that a few pages will be made one day, and one of the biggest bugs in vs.net is when we have defined DataGrid. When resetting the page layout, I found that all the events will be inexplicably lost. Perhaps sometimes we have to use VS.Net already available automatic set format template, but sometimes we must, and do not help us using the set of templates (such as customer requirements), let me explain the style files in DataGrid To define the dynamic style, this solves the time when the customer is not satisfied with a color matching scheme, it can take a few minutes to redefine a set, it is not a lot of efficiency. Taking nonsense, telling how the following CSS.CSS file is defined.

CSS.CSS file content:

.dg_header {font-weight: bold; background-color: # 990000; border-width: 2px; border-color: # cc9966; border-style: solId;

} .dg_alter {background-color: # ffe0c0; border-left-color: green; border-width: 2px; border-color: # cc9966; border-style: solId;}. DG_Item {color: # 330099; Background-Color : White; border-width: 2px; border-color: # cc9966; border-style: solid;}. DG_PAGE {Border-Width: 2px; border-color: # cc9966; border-style: solid;} Next work It is to apply this style file to the DataGrid of the page.

First insert the following statement between the page

href = "css.css" type = "text" rel = "stylesheet"> then select the DataGrid on the page, change CSSClass to apply the style properties value

For example: Click on the cross on the left of the Headerstyle property to open the option to the CSSClass application style DG_HEADER

Finally Bind DataGrid to see if the style has been applied, if there are two possibilities in the application

1, remove the system automatic set of style

2, check if the css.css file is defined correctly

Select, confirm, delete multiple line checkbox lists in DataGrid

Dynamically bind DROPDOWNLIST using DataGrid

Generate a blank record in DataGrid

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

New Post(0)