|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataGrid Conditional FormattingFormatting. I have figured out how to do this, insofar as the proper DataGrid tags are concerned: .... OnItemDataBound="ItemDataBoundEventHandler">, along with the EventHandler: Sub ItemDataBoundEventHandler(sender as Object, e as DataGridItemEventArgs) Dim cqi as Integer cqi = (DataBinder.Eval(e.Item.DataItem, "Score")) If cqi < 80 then e.Item.CssClass = "cqi" Else e.Item.CssClass = "passing" End If End Sub I have linked my page to an external CSS Sheet, in which I have: body { font-weight: bold; color: #FFFFCC; font-family: Arial; background-color: black; } TD { font-weight: bold; color: #FFFFCC; font-family: Verdana; font-size: 10pt; background-color: black; } ..cqi { font-weight: bold; font-size: 10pt; color: red; font-family: Verdana; background-color: black; } ..passing { font-weight: bold; font-size: 10pt; color: #FFFFCC; font-family: Verdana; background-color: black; } This only works, however, when I remove the TD Style, in the above CSS Sheet. The result, when I remove the TD Style, is that the DataGrid column headings, along with Scores that are less than 80, are highlighted in Red, which is what I want. However, when I put the "TD" sytle tags back into my CSS Sheet, it does not work. I want to keep my "TD" Sytle tags. What should I do? Change your selectors syntax from ".cqi" and ".passing" to "tr.cqi td" and
"tr.passing td" respectively, e.g. tr.cqi td { font-weight: bold; font-size: 10pt; color: red; font-family: Verdana; background-color: black; } tr.passing td { font-weight: bold; font-size: 10pt; color: #FFFFCC; font-family: Verdana; background-color: black; } Show quoteHide quote "Juan G." wrote: > I have an ASP.NET DataGrid, in which I would like to implement Conditional > Formatting. I have figured out how to do this, insofar as the proper DataGrid > tags are concerned: > ... OnItemDataBound="ItemDataBoundEventHandler">, along with the > EventHandler: > > Sub ItemDataBoundEventHandler(sender as Object, e as DataGridItemEventArgs) > > Dim cqi as Integer > cqi = (DataBinder.Eval(e.Item.DataItem, "Score")) > > If cqi < 80 then > e.Item.CssClass = "cqi" > Else > e.Item.CssClass = "passing" > End If > > End Sub > > I have linked my page to an external CSS Sheet, in which I have: > body > { > font-weight: bold; > color: #FFFFCC; > font-family: Arial; > background-color: black; > } > TD > { > font-weight: bold; > color: #FFFFCC; > font-family: Verdana; > font-size: 10pt; > background-color: black; > } > .cqi > { > font-weight: bold; > font-size: 10pt; > color: red; > font-family: Verdana; > background-color: black; > } > .passing > { > font-weight: bold; > font-size: 10pt; > color: #FFFFCC; > font-family: Verdana; > background-color: black; > } > This only works, however, when I remove the TD Style, in the above CSS > Sheet. The result, when I remove the TD Style, is that the DataGrid column > headings, along with Scores that are less than 80, are highlighted in Red, > which is what I want. However, when I put the "TD" sytle tags back into my > CSS Sheet, it does not work. I want to keep my "TD" Sytle tags. What should I > do? > > This worked. Thank you, Mr. Williams.
Show quoteHide quote "Phillip Williams" wrote: > Change your selectors syntax from ".cqi" and ".passing" to "tr.cqi td" and > "tr.passing td" respectively, e.g. > > tr.cqi td > { > font-weight: bold; > font-size: 10pt; > color: red; > font-family: Verdana; > background-color: black; > } > tr.passing td > { > font-weight: bold; > font-size: 10pt; > color: #FFFFCC; > font-family: Verdana; > background-color: black; > } > > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "Juan G." wrote: > > > I have an ASP.NET DataGrid, in which I would like to implement Conditional > > Formatting. I have figured out how to do this, insofar as the proper DataGrid > > tags are concerned: > > ... OnItemDataBound="ItemDataBoundEventHandler">, along with the > > EventHandler: > > > > Sub ItemDataBoundEventHandler(sender as Object, e as DataGridItemEventArgs) > > > > Dim cqi as Integer > > cqi = (DataBinder.Eval(e.Item.DataItem, "Score")) > > > > If cqi < 80 then > > e.Item.CssClass = "cqi" > > Else > > e.Item.CssClass = "passing" > > End If > > > > End Sub > > > > I have linked my page to an external CSS Sheet, in which I have: > > body > > { > > font-weight: bold; > > color: #FFFFCC; > > font-family: Arial; > > background-color: black; > > } > > TD > > { > > font-weight: bold; > > color: #FFFFCC; > > font-family: Verdana; > > font-size: 10pt; > > background-color: black; > > } > > .cqi > > { > > font-weight: bold; > > font-size: 10pt; > > color: red; > > font-family: Verdana; > > background-color: black; > > } > > .passing > > { > > font-weight: bold; > > font-size: 10pt; > > color: #FFFFCC; > > font-family: Verdana; > > background-color: black; > > } > > This only works, however, when I remove the TD Style, in the above CSS > > Sheet. The result, when I remove the TD Style, is that the DataGrid column > > headings, along with Scores that are less than 80, are highlighted in Red, > > which is what I want. However, when I put the "TD" sytle tags back into my > > CSS Sheet, it does not work. I want to keep my "TD" Sytle tags. What should I > > do? > > > > You are welcome.
Show quoteHide quote "Juan G." wrote: > This worked. Thank you, Mr. Williams. > > "Phillip Williams" wrote: > > > Change your selectors syntax from ".cqi" and ".passing" to "tr.cqi td" and > > "tr.passing td" respectively, e.g. > > > > tr.cqi td > > { > > font-weight: bold; > > font-size: 10pt; > > color: red; > > font-family: Verdana; > > background-color: black; > > } > > tr.passing td > > { > > font-weight: bold; > > font-size: 10pt; > > color: #FFFFCC; > > font-family: Verdana; > > background-color: black; > > } > > > > -- > > HTH, > > Phillip Williams > > http://www.societopia.net > > http://www.webswapp.com > > > > > > "Juan G." wrote: > > > > > I have an ASP.NET DataGrid, in which I would like to implement Conditional > > > Formatting. I have figured out how to do this, insofar as the proper DataGrid > > > tags are concerned: > > > ... OnItemDataBound="ItemDataBoundEventHandler">, along with the > > > EventHandler: > > > > > > Sub ItemDataBoundEventHandler(sender as Object, e as DataGridItemEventArgs) > > > > > > Dim cqi as Integer > > > cqi = (DataBinder.Eval(e.Item.DataItem, "Score")) > > > > > > If cqi < 80 then > > > e.Item.CssClass = "cqi" > > > Else > > > e.Item.CssClass = "passing" > > > End If > > > > > > End Sub > > > > > > I have linked my page to an external CSS Sheet, in which I have: > > > body > > > { > > > font-weight: bold; > > > color: #FFFFCC; > > > font-family: Arial; > > > background-color: black; > > > } > > > TD > > > { > > > font-weight: bold; > > > color: #FFFFCC; > > > font-family: Verdana; > > > font-size: 10pt; > > > background-color: black; > > > } > > > .cqi > > > { > > > font-weight: bold; > > > font-size: 10pt; > > > color: red; > > > font-family: Verdana; > > > background-color: black; > > > } > > > .passing > > > { > > > font-weight: bold; > > > font-size: 10pt; > > > color: #FFFFCC; > > > font-family: Verdana; > > > background-color: black; > > > } > > > This only works, however, when I remove the TD Style, in the above CSS > > > Sheet. The result, when I remove the TD Style, is that the DataGrid column > > > headings, along with Scores that are less than 80, are highlighted in Red, > > > which is what I want. However, when I put the "TD" sytle tags back into my > > > CSS Sheet, it does not work. I want to keep my "TD" Sytle tags. What should I > > > do? > > > > > >
CustomValidator is not firing
Checkbox in datagrid.... How to read value of a dynamically created radiobuttonlist control? DataGrid Functionality Questions Checkbox state after postback add a list item to a bound control Best way to have multiple pages show up as same selection on menu Simple String Conversion? Dynamic checkbox loses checked state cancel toolbar buttonclick from client-side javascript |
|||||||||||||||||||||||