Hi there,
I have a grouping grid and would like to insert something in the - I believe it would be the GridGroupSplitterColumn - of the individual items. I do not want to replace the Expand/Collapse images - I would like to use the space in the automatically created cell underneath the Expand/Collapse images (am I making sense here?)
Is this possible? Can someone point me in the right direction?
Thx in advance!
Rgds - Marcus.
I have a grouping grid and would like to insert something in the - I believe it would be the GridGroupSplitterColumn - of the individual items. I do not want to replace the Expand/Collapse images - I would like to use the space in the automatically created cell underneath the Expand/Collapse images (am I making sense here?)
Is this possible? Can someone point me in the right direction?
Thx in advance!
Rgds - Marcus.
4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 15 Mar 2010, 09:10 AM
Hello Marcus,
I tried following code in order to add insert text in the space in the created underneath the Expand/Collapse images when using grouping.
C#:
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item.OwnerTableView.IsItemInserted && e.Item is GridPagerItem) |
| { |
| GridPagerItem pagerItem = (GridPagerItem)e.Item; |
| pagerItem.Display = false; |
| } |
| if (e.Item is GridDataItem) |
| { |
| GridDataItem item = (GridDataItem)e.Item; |
| if (RadGrid1.MasterTableView.GroupByExpressions.Count > 0) |
| { |
| TableCell cell = (TableCell)item["column"]; |
| Label lbl = new Label(); |
| lbl.Text = "Hai"; |
| cell.Controls.Add(lbl); |
| } |
| } |
| } |
-Shinu.
0
Marcus
Top achievements
Rank 1
answered on 16 Mar 2010, 12:21 AM
Hi Shinu,
many thanks for your reply, but I'm afraid I don't quite understand your code. You have a named column "column" in there. What are you referencing there? As far as I know the SplitterColumn doesn't have a name - or does it?
Thx again!
Rgds - Marcus.
many thanks for your reply, but I'm afraid I don't quite understand your code. You have a named column "column" in there. What are you referencing there? As far as I know the SplitterColumn doesn't have a name - or does it?
Thx again!
Rgds - Marcus.
0
Shinu
Top achievements
Rank 2
answered on 16 Mar 2010, 07:51 AM
Hello Marcus,
I tried following code in ColumnCreated event to get the ColumnUniqueName of GridGroupSplitterColumn.
C#:
| public string un = ""; |
| protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) |
| { |
| if (e.Column is GridGroupSplitterColumn) |
| { |
| un = e.Column.UniqueName; |
| } |
| } |
And used the same UniqueName to access the GridGroupSplitterColumn in ItemDataBound event.
C#:
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| GridDataItem item = (GridDataItem)e.Item; |
| if (RadGrid1.MasterTableView.GroupByExpressions.Count > 0) // If grouping is enabled |
| { |
| TableCell cell = (TableCell)item[un]; |
| // Add custom controls here |
| } |
| } |
| } |
Feel free to share the comments, :)
Shinu.
0
Marcus
Top achievements
Rank 1
answered on 17 Mar 2010, 02:09 AM
Hi Shinu,
thx again for your reply. Unfortunately, the controls are not added when I try your code.
I set a couple of breakpoints, and the UniqueName returned is "column", just as you had in your code. I also set a breakpoint in the ItemDatabound handler - it gets executed, but the controls are not inserted.
My guess is (and I'm just guessing - new to the radcontrols) this is because I have the initial render of the control set to collapse all groups (meaning the cell isn't there). It seems there is a postback when the group is expanded and the itemdatabound event doesn't fire then (??).
Thx again!
thx again for your reply. Unfortunately, the controls are not added when I try your code.
I set a couple of breakpoints, and the UniqueName returned is "column", just as you had in your code. I also set a breakpoint in the ItemDatabound handler - it gets executed, but the controls are not inserted.
My guess is (and I'm just guessing - new to the radcontrols) this is because I have the initial render of the control set to collapse all groups (meaning the cell isn't there). It seems there is a postback when the group is expanded and the itemdatabound event doesn't fire then (??).
Thx again!