RadGrid row headers?

6 posts, 0 answers
  1. Gordon Doherty
    Gordon Doherty avatar
    6 posts
    Member since:
    Jan 2010

    Posted 04 Jun 2010 Link to this post

    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




  2. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 10 Jun 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Daniel avatar
    13 posts
    Member since:
    May 2013

    Posted 09 Jan 2014 Link to this post

    I've read the links, but can't find any way to get row headers.

    Edit:

    I'm trying to get something like this:
  5. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 14 Jan 2014 Link to this post

    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.
  6. Daniel
    Daniel avatar
    13 posts
    Member since:
    May 2013

    Posted 14 Jan 2014 Link to this post

    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);
            }

  7. Lax
    Lax avatar
    15 posts
    Member since:
    Mar 2015

    Posted 03 Mar 2015 in reply to Daniel Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017