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

  • Home
  • SEARCH
  • 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 7587679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:44:00+00:00 2026-05-30T19:44:00+00:00

I have in my grid a GridTemplateColumn which display INDEF or MA. When it’s

  • 0

I have in my grid a GridTemplateColumn which display “INDEF” or “MA”. When it’s “INDEF”, i would like my row to change of color:

this is my try:

protected void grid_ItemDataBound(object sender, GridItemEventArgs e)
{
 if (e.Item is GridDataItem)
 {
   GridDataItem item = (GridDataItem)e.Item;
   Label lbl = (Label)item.FindControl("test");
   if (lbl.Text == "INDEF")
   {
    lbl.ForeColor = System.Drawing.Color.Red;
   }
 }
}

with the code of the column in question:

              <telerik:GridTemplateColumn  HeaderText="Type de tickets"
    UniqueName="typedestickets">
    <ItemTemplate><asp:Label id="test" runat="server"></asp:Label></ItemTemplate>
</telerik:GridTemplateColumn>

But i noticed by adding a break point e.Item was not GridDataItem but GridPagerItem (i don’t know why)

So i tried this: ( not working either )

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridPagerItem)
    {
        GridPagerItem item = (GridPagerItem)e.Item;
        Label lbl = (Label)item.FindControl("test");



        if (lbl.Text == "INDEF")
        {
            lbl.ForeColor = System.Drawing.Color.Red;
            item.BackColor = System.Drawing.Color.Red;
            lbl.BackColor = System.Drawing.Color.Red;

        }
    }
}

Thanks in advance for your help

  • 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-05-30T19:44:01+00:00Added an answer on May 30, 2026 at 7:44 pm

    try this

    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        //Is it a GridDataItem
        if (e.Item is GridDataItem)
        {
            //Get the instance of the right type
            GridDataItem dataBoundItem = e.Item as GridDataItem;
    
            //Check the formatting condition
            if (int.Parse(dataBoundItem["typedestickets"].Text) =="INDEF")
            {
                dataBoundItem["typedestickets"].ForeColor = Color.Red;
                dataBoundItem["typedestickets"].Font.Bold = true;
                //Customize more...
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Grid inside a Canvas defined like this: <Canvas x:Name=outerCanvas> <Grid Grid.Row=1
Hai presently i have grid like this. <Grid Name=tGrid1 Grid.Row=0 Background=Black > </Grid> <Grid
I have grid like this. How to change index for each element, i.e. to
I would like to know - which WPF control can have grid as a
I have Grid with rowexpander. with this I am able to expand the row,
I have grid of thumbnail images on a form, and I would like for
I have grid view which contains five radio buttons per row. Out of these
I have a grid laid out like so; +---------+---------+ | Image | Details |
I have a grid in a XAML file in a WPF project. This MainGrid
I have a grid bound to a BindingSource which is bound to DataContext table,

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.