How to color the corner of the datagridcell

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Smish
    New Member
    • Jan 2007
    • 51

    How to color the corner of the datagridcell

    hey can ne1 tell me how to color the corner of a cell in the datagridview
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Sounds like a job for CSS?

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      Originally posted by kenobewan
      Sounds like a job for CSS?
      Well, a DataGridView is a Forms control, not a web control, so I don't think CSS will work...

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        It sounds like something for OwnerDraw, which can get nasty with an object that complex I would think

        Comment

        • kenobewan
          Recognized Expert Specialist
          • Dec 2006
          • 4871

          #5
          Originally posted by insertAlias
          Well, a DataGridView is a Forms control, not a web control, so I don't think CSS will work...
          Ok you caught me bluffing, I was thinking of using a gridview template with CSS applied to it:
          ASP.NET Gridview and CSS

          Comment

          • PRR
            Recognized Expert Contributor
            • Dec 2007
            • 750

            #6
            Originally posted by Smish
            hey can ne1 tell me how to color the corner of a cell in the datagridview
            DataGrid.OnItem DataBound Method (System.Web.UI. WebControls)
            Check this ... you could change the cell[index] color in this ...
            Sample Gridview function
            Code:
             protected void g1_RowDataBound(object sender, GridViewRowEventArgs e)
                {
                    if (e.Row.RowType == DataControlRowType.DataRow)
                    {
            
                        if (e.Row.Cells[1].Text == "DDD")
                        {
                            e.Row.Cells[1].BackColor = System.Drawing.Color.Black;
                            e.Row.Cells[1].Enabled = false;
                        }
            
                    }
                }
            corner ? well i guess i got it wrong here.. Moderator please delete my post as its irrelevant..

            Comment

            • kenobewan
              Recognized Expert Specialist
              • Dec 2006
              • 4871

              #7
              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.

              Comment

              • Plater
                Recognized Expert Expert
                • Apr 2007
                • 7872

                #8
                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.

                Comment

                • kenobewan
                  Recognized Expert Specialist
                  • Dec 2006
                  • 4871

                  #9
                  Originally posted by Plater
                  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.
                  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!

                  Comment

                  • Plater
                    Recognized Expert Expert
                    • Apr 2007
                    • 7872

                    #10
                    Originally posted by kenobewan
                    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!
                    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

                    Comment

                    • Smish
                      New Member
                      • Jan 2007
                      • 51

                      #11
                      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
                      Last edited by Smish; Jan 1 '09, 06:45 AM. Reason: Spell mistake

                      Comment

                      • kenobewan
                        Recognized Expert Specialist
                        • Dec 2006
                        • 4871

                        #12
                        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 :).

                        Comment

                        • Smish
                          New Member
                          • Jan 2007
                          • 51

                          #13
                          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??

                          Comment

                          • kenobewan
                            Recognized Expert Specialist
                            • Dec 2006
                            • 4871

                            #14
                            And those above who agreed that CSS was not the solution were correct...

                            Comment

                            Working...