Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9118125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:04:11+00:00 2026-06-17T05:04:11+00:00

I am using an ultragrid and inside i have values that i load into

  • 0

I am using an ultragrid and inside i have values that i load into a datatable from a database. In my grid i group the rows into groups with OutlookGroupBy code. My rows in the grid are in two categories. The Priority 1 and 0. I want when the data are loaded the rows that are in priority 1 to get color red, and the others in priority 0 to be in normal color.

I use the ultragrid pro grammatically so i didnt use any of its features in the editor.

here is how i initialize my grid and how i load from database from another class:

 Dim dt As DataTable = Nothing

        Timer1.Enabled = True
        UltraGrid1.DataSource = Nothing
        Generic.openOrders(dt)
        UltraGrid1.DataSource = dt

        Dim band As Infragistics.Win.UltraWinGrid.UltraGridBand = UltraGrid1.DisplayLayout.Bands(0)
        UltraGrid1.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy
        band.SortedColumns.Add(band.Columns("PRIORITY"), True, True)
        band.SortedColumns.Add(band.Columns("ORDERID"), False, True)
        band.SortedColumns.Add(band.Columns("ORDERTIME"), False, True)

anyone has any idea of how can i change the row color into the priority 1 subrows??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:04:11+00:00Added an answer on June 17, 2026 at 5:04 am

    You can try with this approach:

    First you need to subscribe the event InitializeRow, so add this by the designer or by code (eg. in Form_Load or before setting the DataSource of the grid)

    grd.InitializeRow += new InitializeRowEventHandler(grd_InitializeRow);
    

    then, in the event, write code like this

    private void grd_InitializeRow(object sender, InitializeRowEventArgs e)
    {
        if(e.Row.Band.Index == 1)
        {
             if(Convert.ToInt32(e.Row.Cells["PRIORITY"].Value) == 1)
                  e.Row.Appearance.BackColor = Color.LightGreen;
        }
    }
    

    Keep in mind that if you have set CellAppearance they will have precedence on RowAppearance and, if you have many rows it is better to initialize an Appearance object, store it in the grid.DisplayLayout.Appearances collection and reuse the same object for every row involved.

    Moreover, always with the aim of improving the performance, to get the cell value it is better to use the GetCellValue method of the row. This will avoid the creation of the a full Cell object just to retrieve its value. Things are a bit more complicated because you need an UltraGridColumn and not just the name of the column, but in the InitializeRow event, fired for each row, this is little price to pay.

    private void grd_InitializeRow(object sender, InitializeRowEventArgs e)
    {
        if(e.Row.Band.Index == 1)
        {
             UltraGridColumn priorityColumn = e.Row.Band.Columns["PRIORITY"];
             if(Convert.ToInt32(e.Row.GetCellValue(priorityColumn)) == 1)
                  e.Row.Appearance.BackColor = Color.LightGreen;
        }
    }
    

    EDIT: The same code in VB.NET

    ....
    AddHandler grd.InitializeRow, AddressOf Me.grd_InitializeRow
    ....
    
    
    Private Sub grd_InitializeRow(sender As System.Object, e As InitializeRowEventArgs)
        If e.Row.Band.Index = 1 Then
            Dim priorityCol As UltraGridColumn = e.Row.Band.Columns("PRIORITY")
            If Convert.ToInt32(e.Row.GetCellValue(priorityCol)) = 1 Then
                e.Row.Appearance.BackColor = Color.LightGreen
            End If
        End If
    End Sub
    

    Also, the use the UltraGridColumn class, you need to add at the start of file

    Imports Infragistics.Win.UltraWinGrid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WinDataGrid class that extends from an Infragistics UltraGrid . I have
I have a data table with data rows, which is coming from Ultra grid.
Using the Infragistics UltraGrid (e.g. myGrid ), I want to: Hook an event that
I'm using Infragistics Ultragrid 2008, I have a button used to check and uncheck
I am trying to show xml data in an Ultragrid. I have tried using
Using SSRS 2008 R2 I have a background process that dynamically generates RDL for
I am using UltraGrid for inserting data in table. The problem is that i
I need to create a winforms grid with 3 levels, using infragistics ultragrid. Level
Using CRM 4, I have an entity form that contains a tab with an
I'm using linq to pull back an object (i.e. customer) that might have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.