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

Custom GridGroupHeaderItem

1 Answer 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michel Laforce
Top achievements
Rank 1
Michel Laforce asked on 12 Oct 2011, 10:04 PM
Hi

View Image attached

In the ItemDataBount I do stuff to customize the GridGroupHeaderItem wich works fine.

When I click on the grid and come back to it, the formatting is lost (right side of the Image attached)

I use the RadAjaxManager and the grid is updated on the event but is not rebinded.

Is there a way not to loose this without rebinding.

here the code if it help

        protected void rdgMeals_ItemDataBound(object source, GridItemEventArgs e)
        {
            if (e.Item != null)
            {
                if (e.Item.ItemType == GridItemType.GroupHeader)
                {
                    GridGroupHeaderItem xGridGroupHeaderItem = (GridGroupHeaderItem)e.Item;
                    HtmlAnchor xHtmlAnchor = new HtmlAnchor();
                    String xDate = ((DateTime)DataBinder.Eval(xGridGroupHeaderItem.DataItem, "Date")).ToString("yyyy-MM-dd");

                    xHtmlAnchor.InnerHtml = "<img alt='Statistics' src='/Images/Statistics.png' height='12' width='12' style='border: none;' /> " + xDate;
                    xHtmlAnchor.HRef = "javascript:void(0);";
                    xHtmlAnchor.Attributes.Add("onclick", "OpenFoodStatisticsMeals('0', '" + this.CurrentUserId + "', '" + xDate + "', '" + xDate + "');");
                    xHtmlAnchor.Style.Add("color", "#000000");
                    xHtmlAnchor.Style.Add("border", "none");
                    xHtmlAnchor.Style.Add("text-decoration", "none");

                    xGridGroupHeaderItem.DataCell.Controls.Add(xHtmlAnchor);
                }
     }
 }



Thanks

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 17 Oct 2011, 04:08 AM
Hello Michel,

I suggest that you wait for the Q3 2011 release where we will introduce the new GridGroupHeaderTemplate and GridGroupFooterTemplate. Then you will be able to define the grid group header and group footer as desired. 

Best wishes,
Iana Tsolova
the Telerik team
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 their blog feed now
Tags
Grid
Asked by
Michel Laforce
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or