This is a migrated thread and some comments may be shown as answers.

Properties error

1 Answer 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stavros
Top achievements
Rank 1
Stavros asked on 04 Nov 2008, 09:16 AM
I am trying to set the BackColor property in the ItemStyle using this guide http://www.telerik.com/help/aspnet-ajax/grdgettingstarted.html
but I am getting the following error :

Properties :

Object reference not set to an instance of an object.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Nov 2008, 10:15 AM
You can try setting the BackColor for cells in a column either in the aspx or in the code behind as shown:
aspx:
  <telerik:GridBoundColumn DataField="FirstName" UniqueName="FirstName" HeaderText="FirstName">   
   <ItemStyle BackColor="Blue" />                  
 </telerik:GridBoundColumn> 

cs:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
   {      
       if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            item["FirstName"].BackColorSystem.Drawing.Color.Brown;           
         } 
   } 

Thanks
Princy
Tags
Grid
Asked by
Stavros
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or