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

RadGrid row headers?

5 Answers 304 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gordon Doherty
Top achievements
Rank 1
Gordon Doherty asked on 04 Jun 2010, 03:31 PM
Hi,

For accessibility compliance, I need to ensure my rows have headers (just like the columns). So the first cell of each datarow is like:
<th scope="row" ...>

Currently, the grid outputs:
<td scope="row" ...>


...and I don't know which property/properties to modify to get the desired change?



Cheers in advance,
Gordopolis




5 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 10 Jun 2010, 08:55 AM
Hi Gordon,

Please go through the following help article and see whether it helps.
Customizing with GridTemplateColumn
Also for more custom and flexible layout of your RadGrid for ASP.NET AJAX, you may consider taking advantage of the global item template feature. Here are more details on this subject:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/GeneralFeatures/CardView/DefaultCS.aspx
http://www.telerik.com/help/aspnet-ajax/grdcardview.html

http://www.telerik.com/help/aspnet-ajax/grdwhatsnew.html

I hope this helps.

Kind regards,
Radoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Daniel
Top achievements
Rank 1
answered on 09 Jan 2014, 03:50 PM
I've read the links, but can't find any way to get row headers.

Edit:

I'm trying to get something like this:
0
Radoslav
Telerik team
answered on 14 Jan 2014, 07:40 AM
Hi Daniel,

If you want to turn columns into grid rows you need to use the approach described into the following documentation article:
Displaying pivot data

Please give it try and let me know if it helps you.

Regards,
Radoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Daniel
Top achievements
Rank 1
answered on 14 Jan 2014, 08:36 AM
That approach only works with DataTable and I'm using EntityFramework in the Data Layer so I have to work with Lists as DataSources.

The solution I've found is not that simple. I'm using a RadPivotGrid and handling the CellDataBound event to paint a Label into each cell so I can display non numeric strings. It's necesary to use a dictionary to translate the numeric values of the List used as DataSource into non numeric strings.

First, I need a class who encapsulates the original Matrix object and an int called "Key":

public class MatrixValue: OriginalMatrixValue
        {
            public int Key { get; set; }
        }

Then, into the Page_Load:
Dictionary<int, MatrixValue> dictionary = new Dictionary<int, ValorMatrizClave>();
            int i = 0;
            foreach (MatrixValue value in OriginalDataSourceList)
            {
                value.Key= i;
                dictionary.Add(value.Key, value);
                i++;
            }

Into the NeedDataSource:
List<MatrixValue> matrixValueList = OriginalDataSourceList.Select(m => new MatrixValue {
      Key= OriginalDataSourceList.IndexOf(m), Property1 = m.Property1, Property2 = m.Property2
}).ToList();
 
(sender as RadPivotGrid).DataSource = matrixValueList;

And the CellDataBound handler:
protected void RadPivotGrid1_CellDataBound(object sender, PivotGridCellDataBoundEventArgs e)
        {
     MatrixValue matrixValue = ((MatrixValue)dictionary[Convert.ToInt32(e.Cell.DataItem)]);
           Label lblCell= new Label();
lblCell.ID = e.Cell.ID + "_Label";
lblCell.Text = matrixValue.Property1; //The string property you want to show
e.Cell.Controls.Add(lblCell);
        }

0
Lax
Top achievements
Rank 1
answered on 03 Mar 2015, 08:11 PM
Hi Daniel,

Just wondering how to get this working for a wpf RadGrid? And get the same layout exported to an excel or pdf?

Any suggestions?

Thanks,
Lax
Tags
Grid
Asked by
Gordon Doherty
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Daniel
Top achievements
Rank 1
Lax
Top achievements
Rank 1
Share this question
or