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

group header not maintaining style/Alignment on collapse/expand

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
N
Top achievements
Rank 1
N asked on 08 Mar 2011, 03:39 AM
Hi,

Grouping is a great feature with rad grid! thank you!
But alignment and customizing is not very versatile.Atleast I'm finding it little round about,probly I am still a little new here.
OK,
I've used group expressions for groping data in rad grid and achieved styling and alignment to my satisfaction using itemdatabound and prerender event handler where I set the visibility of groupheader datacell to false and add the cells with required data for each column aligning the column and group header data.

So far so good,ut my problem is when I hit expand/collapse the group header datacell is blown off and my custon cell are not rendered,so I hav a blank row with expand and collapse,so I need to rebind the grid to get back the group header.

Now my thinking is if I know what event is fired when the expand/collapse is hit then I can render the group header(unfortunately when I tried the prerender event handler,I think I missed something or its the wrong event-please advise) .Please can you through some light,it feels like I'm close yet not that close-kind of stuck need this done soon-client pressure.

Thank you.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Mar 2011, 01:12 PM
Hello,

I am not able to replicate the issue on my side. Here is the code that I tried in my application. And it persisting the style even after expand/collapse group header.

ASPX:
<telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" .  .  .>
       <MasterTableView CommandItemDisplay="Top">
           <GroupByExpressions>
               <telerik:GridGroupByExpression>
                   <SelectFields>
                       <telerik:GridGroupByField FieldName="Total" HeaderText="Total" />
                   </SelectFields>
                   <GroupByFields>
                       <telerik:GridGroupByField FieldName="Total" />
                   </GroupByFields>
               </telerik:GridGroupByExpression>
           </GroupByExpressions>
         .    .   .   .         .    .   .   .
   </telerik:RadGrid>

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
   {
       foreach (GridGroupHeaderItem grpHeader in RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader))
       {
           grpHeader.DataCell.Text = "new text";
           grpHeader.DataCell.Style["text-align"] = "right";
       }
   }

Can you please paste your code if it doesn't help.

Thanks,
Princy.
Tags
Grid
Asked by
N
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or