By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,536 Members | 1,504 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,536 IT Pros & Developers. It's quick & easy.

How to color the corner of the datagridcell

P: 51
hey can ne1 tell me how to color the corner of a cell in the datagridview
Nov 25 '08 #1
Share this Question
Share on Google+
13 Replies


kenobewan
Expert 2.5K+
P: 4,871
Sounds like a job for CSS?
Nov 25 '08 #2

Curtis Rutland
Expert 2.5K+
P: 3,256
@kenobewan
Well, a DataGridView is a Forms control, not a web control, so I don't think CSS will work...
Nov 25 '08 #3

Plater
Expert 5K+
P: 7,872
It sounds like something for OwnerDraw, which can get nasty with an object that complex I would think
Nov 25 '08 #4

kenobewan
Expert 2.5K+
P: 4,871
@insertAlias
Ok you caught me bluffing, I was thinking of using a gridview template with CSS applied to it:
ASP.NET Gridview and CSS
Nov 27 '08 #5

Expert 100+
P: 750
PRR
@Smish
DataGrid.OnItemDataBound Method (System.Web.UI.WebControls)
Check this ... you could change the cell[index] color in this ...
Sample Gridview function
Expand|Select|Wrap|Line Numbers
  1.  protected void g1_RowDataBound(object sender, GridViewRowEventArgs e)
  2.     {
  3.         if (e.Row.RowType == DataControlRowType.DataRow)
  4.         {
  5.  
  6.             if (e.Row.Cells[1].Text == "DDD")
  7.             {
  8.                 e.Row.Cells[1].BackColor = System.Drawing.Color.Black;
  9.                 e.Row.Cells[1].Enabled = false;
  10.             }
  11.  
  12.         }
  13.     }
  14.  
corner ? well i guess i got it wrong here.. Moderator please delete my post as its irrelevant..
Nov 27 '08 #6

kenobewan
Expert 2.5K+
P: 4,871
Correct me if I am wrong, but the OP talked about coloring the corner of a cell and not the whole cell. One way to do this would be to apply a background image through CSS. Perhaps we need the amount/ shape of the coloring defined to be sure.
Nov 29 '08 #7

Plater
Expert 5K+
P: 7,872
Did we forget we are talking about a windows form control, not a web control again?
At any rate we might until the OP actually gets back to us.
Dec 1 '08 #8

kenobewan
Expert 2.5K+
P: 4,871
@Plater
Not sure how you ascertained that it was a windows form control from OP, although InsertAlias implied it was.

Smish - please reply to your post urgently, your experts need you!
Dec 2 '08 #9

Plater
Expert 5K+
P: 7,872
@kenobewan
The DataGridView object is a windows forms only object.
The DataGrid was in .net1.x and was used in both windows form and web application (but was a very poor object)
The GridView object is for web applications
Dec 2 '08 #10

P: 51
Hey guys ...
sorry for the delay in replying....and thanx for the response..

I want it for Windows object datagridview control.if i get to know how do we color the corner of a cell.Like suppose i want to show there are two or more indication to be given to the cell.so i was thinking ill start from lower right corner.for 1st indication ill color red,the next line ill color blue and so on..

hope its clear now..thanx
Jan 1 '09 #11

kenobewan
Expert 2.5K+
P: 4,871
Thanks for clearing that up. Now all you need to do is follow the advice of those who correctly assumed you were using a windows datagridview :).
Jan 1 '09 #12

P: 51
But i dont want an css to be aplied it would be cumbersome..is ther any way to paint the points in the cell by specifyign a region??
Jan 1 '09 #13

kenobewan
Expert 2.5K+
P: 4,871
And those above who agreed that CSS was not the solution were correct...
Jan 2 '09 #14

Post your reply

Sign in to post your reply or Sign up for a free account.