Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Applying a style to a bound column

Reply
Thread Tools

Applying a style to a bound column

 
 
UJ
Guest
Posts: n/a
 
      05-19-2005
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.


 
Reply With Quote
 
 
 
 
Phillip Williams
Guest
Posts: n/a
 
      05-19-2005
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.
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lower bound & Upper bound sunil panda Java 9 10-07-2008 08:32 PM
GridView - how do i modify bound data column by column? TS ASP .Net Web Controls 3 08-16-2007 05:02 AM
Move bound column to right of dynamic column in datagrid? John E. ASP .Net Datagrid Control 3 03-28-2005 01:29 PM
Move bound column to right of dynamic column in datagrid? John E. ASP .Net 3 03-25-2005 09:19 PM
Bound Column or Template Column (w dAdapater?) in DataGrid Ravichandran Mahalingam ASP .Net Datagrid Control 0 01-09-2004 03:30 PM



Advertisments