Hi, I recently purchased the Ulimate Collection and have started working with the RadGrid as I'm developing a KPI for Sharepoint WSS (2007). I have come across, what I think is a bug in the control and I can replicate it easily now as I have played around with it for the last 3-4 days.
Keep in mind that I am creating this control entirely in a class that inherits from WebPart. This can be either Microsoft.SharePoint.WebPartPages.WebPart OR System.Web.UI.WebControls.WebParts.WebPart. They are both derived from the same parent so I don't think this is the issue. At least I HOPE not.
Issue #1
The following code does NOT render the Header Image OR Text at all! Nothing! So I can't sort on the column.
If I change the ShowSortIcon to = true, then I get the Image to display in the header. This leads to Issue #2 and then Issue #3 which is the killer.
Issue #2
So I have the above code with 2 other columns to the right of it. Just Grid Bound Columns with Text Headers, NOT Image ones.
Scenario.
1. I click the Column with the Image in the Header to sort it and it works nice. I get the Sort Icon too. All is good. The column is highlighted.
2. I click it again to sort it the other way and it works. The column is highlighted
3. I click it a 3rd time and it's now unsorted and the column is no longer sorted and hence NOT highlighted. Still all is good.
4. Now this is where it goes wonky. I click the same column a 4th time, note it is once again sorted and highlighted.
5. Now I click the column to the right BUT the focus jumps to the 3rd column!!
What I think is happening is that the SortIcon, along with the Header Image, is causing an offset in the number of controls in the header, which is forcing the focus to jump to the next column to the right. I hope there is a work around to this because it will confuse the users for sure.
Moreover, there is a more serious issue to this
Issue #3!! (die, die, die)
If I add columns to the left of the Image Header Column and start sorting those, within 2 clicks it blows up in my face with the following error.
It's not always the same id, but it ALWAYS blows up. If I remove the HeaderImageUrl attribute then all is fine and dandy and the sorting works 100%. But as soon as I re-introduce a column with an image in the header it blows up, or I get that strange offset to the right of the image header column.
The important thing to remember here is that the when I have, say 4 columns (1,2,3,4). If column 2 is the image header column then nothing blows up (just acts strange) UNTIL I click that column to the LEFT (number 1) of the Image column!
One more interesting thing to mention is that if EnableViewState is set to False for the Grid then the sorting on the Graphic header does not work, however it will work on the Text Headers, but ONLY on the Text headers to the right of the Graphic headers
This has been a long hard slog to get to this point, but I know (1000 million%) how to reproduce this Problem so I'm looking for some serious help here. Please and Thank You.
Best Regards
Dave Stuart
Keep in mind that I am creating this control entirely in a class that inherits from WebPart. This can be either Microsoft.SharePoint.WebPartPages.WebPart OR System.Web.UI.WebControls.WebParts.WebPart. They are both derived from the same parent so I don't think this is the issue. At least I HOPE not.
Issue #1
The following code does NOT render the Header Image OR Text at all! Nothing! So I can't sort on the column.
If I change the ShowSortIcon to = true, then I get the Image to display in the header. This leads to Issue #2 and then Issue #3 which is the killer.
_radGrid = new RadGrid
{
ID = "telerikInspections",
DataSource = _siteSpecificAreas,
AutoGenerateColumns = false,
AllowPaging = false,
EnableViewState = true,
AllowSorting = true,
ShowHeader = true,
ShowFooter = true,
ShowStatusBar = false,
GroupingEnabled = false,
ShowGroupPanel = false,
Skin = "Forest"
};
gbc = new GridBoundColumn
{
UniqueName = "CountPendingInspection",
DataField = "CountPendingInspection",
HeaderImageUrl = "/_layouts/images/custom.images/Purple-P-16.png",
ShowSortIcon = false,
HeaderText = "Pending Inspection",
Aggregate = GridAggregateFunction.Sum
};
_radGrid.Columns.Add(gbc);
Issue #2
So I have the above code with 2 other columns to the right of it. Just Grid Bound Columns with Text Headers, NOT Image ones.
Scenario.
1. I click the Column with the Image in the Header to sort it and it works nice. I get the Sort Icon too. All is good. The column is highlighted.
2. I click it again to sort it the other way and it works. The column is highlighted
3. I click it a 3rd time and it's now unsorted and the column is no longer sorted and hence NOT highlighted. Still all is good.
4. Now this is where it goes wonky. I click the same column a 4th time, note it is once again sorted and highlighted.
5. Now I click the column to the right BUT the focus jumps to the 3rd column!!
What I think is happening is that the SortIcon, along with the Header Image, is causing an offset in the number of controls in the header, which is forcing the focus to jump to the next column to the right. I hope there is a work around to this because it will confuse the users for sure.
Moreover, there is a more serious issue to this
Issue #3!! (die, die, die)
If I add columns to the left of the Image Header Column and start sorting those, within 2 clicks it blows up in my face with the following error.
An error has occurred because a control with id 'Inspections1$telerikInspections$ctl00$ctl02$ctl00$ctl05' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
It's not always the same id, but it ALWAYS blows up. If I remove the HeaderImageUrl attribute then all is fine and dandy and the sorting works 100%. But as soon as I re-introduce a column with an image in the header it blows up, or I get that strange offset to the right of the image header column.
The important thing to remember here is that the when I have, say 4 columns (1,2,3,4). If column 2 is the image header column then nothing blows up (just acts strange) UNTIL I click that column to the LEFT (number 1) of the Image column!
One more interesting thing to mention is that if EnableViewState is set to False for the Grid then the sorting on the Graphic header does not work, however it will work on the Text Headers, but ONLY on the Text headers to the right of the Graphic headers
This has been a long hard slog to get to this point, but I know (1000 million%) how to reproduce this Problem so I'm looking for some serious help here. Please and Thank You.
Best Regards
Dave Stuart