DataGrid Application Style File Defining Dynamic Style

xiaoxiao2021-03-06  95

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;}

The next job is to apply this style file to the DataGrid of the page.

First insert the following statement between page

Then select the DataGrid on the page, change CSSClass that needs 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

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

New Post(0)