Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 10th, 2006, 05:57 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default Change a Datagrid cell background

Hello all
I'm trying to change a cell of a datagrid background when a condition becomes true.let me explain more:
I have a datagrid with different columns.one of these columns is a string that contains "0"s and "1"s.i want to check this cell.for example if the first character was "1" then the first cell should have a different background column and so on.
I wrote my codes like this:
1-a datagrid that has OnDataBinding(it calls a sub)
2-my sub is like this:
sub Changebg(s As Object,e As System.EventArgs)
for each myItem As DataGridItem in DataGrid1.Items
if first char="1" then
change the first cell background
if second char="1" then
change the second cell background
and so on ......
but it doesn't change any cell background
and this is the code for accessing the string field:
c=myItems.cells(12).text
and for changin the background i used:
myItem.cells(1).BackColor=skyblue
would you please help me.I'm not familiar with .net and i think i didn't use these codes correctly
i would be very happ if some one help me
thank you

 
Old September 12th, 2006, 07:56 AM
Registered User
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have the sme problem,so if you were answered please send me.

 
Old September 12th, 2006, 11:23 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

Isn't there any one can help me please






Similar Threads
Thread Thread Starter Forum Replies Last Post
change color of background meena88 C# 2005 3 December 1st, 2009 04:48 AM
Setting background image for gridvew cell anup_daware .NET Framework 2.0 0 September 17th, 2007 05:18 AM
Change a Datagrid cell background hastikeyvan ASP.NET 2.0 Professional 2 October 7th, 2006 06:48 AM
change background color of cell based on value vurtman ASP.NET 1.0 and 1.1 Basics 4 February 26th, 2004 03:52 PM
change background Frank1111 ASP.NET 1.0 and 1.1 Basics 5 October 16th, 2003 06:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.