RE: Applying a style to a bound column

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Try using the ItemDataBound event instead. Your code might look like that:
Sub DataGrid1_Created(ByVal sender As Object, ByVal e As
DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
e.Item.CssClass = CType(e.Item.DataItem, DataRowView).Row("Selected")
End Sub

--
WEBSWAPP Development Inc.
http://www.webswapp.com


"UJ" wrote:

> How do you apply a css style to a bound column? I've tried the following
> code:
>
> <asp:BoundColumn DataField="CompanyName" SortExpression="CompanyName"
> HeaderText="Company" headerimageurl="../images/colcompany.gif" >
> <ItemStyle cssclass='<%# SelectCellStyle(Container.DataItem("Selected"))
> %>'></ItemStyle>
> </asp:BoundColumn>
>
>
> and get the error message BC30676: 'DataBinding' is not an event of
> 'System.Web.UI.WebControls.TableItemStyle'.
>
> So how do I apply the style to the bound column?
>
> TIA.
>
>
>
.


Quantcast