This is a migrated thread and some comments may be shown as answers.

[Solved] Changing the RadGrid Expand Image conditionally

2 Answers 228 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 09 Sep 2010, 03:44 AM
I want to change the expand and collapse arrows from black to red only on certain rows that meat a specific criteria.  What's the best way to go about doing this? 

Thanks

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Sep 2010, 08:20 AM
Hello Jay,

One suggestion is to use ImageButton inside Itemtemplate of GridTemplateColumn with CommandName as 'ExpandCollapse' instead of using default ExpandCollapseColumn. Then hide the default ExpandCollapseColumn which is demonstrated in this forum link.

In ItemDataBound event, set the ImageUrl of ImageButton based on the condition to simulate ExpandCollapse column.


Hope this information helps,
Princy.
0
Ashwini
Top achievements
Rank 1
answered on 30 May 2013, 09:27 AM
I have implemented a similar scenario. I wanted to disable the expand/collapse button for certain records. Below is the code -


public void radGrid_ItemDataBound(object sender, GridItemEventArgs e)

{
            if (e.Item is GridDataItem)
            {
                     //The condition when I wanted the expand/collapse button to be disabled
                      if(<condition>)
                      {
                               //disable the expand/collapse button
                               (e.Item as GridDataItem)["ExpandColumn"].Enabled = false;
                       }
            }
}


Tough this is an old post, I am replying, hoping this would help someone.

-
AV

Tags
Grid
Asked by
Jay
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ashwini
Top achievements
Rank 1
Share this question
or