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

RadGrid Q3 2010 HeaderImageUrl Sort Issue

3 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 09 Feb 2011, 06:56 AM
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.

_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

3 Answers, 1 is accepted

Sort by
0
Dave
Top achievements
Rank 1
answered on 10 Feb 2011, 05:39 AM
This is a link to a site that shows the errors for Issues 2 & 3 that I explained in my initial post yesterday: http://teleriktest.dafran.net

You can download my code here: http://teleriktest.dafran.net/MarexKPIOutsideSharePoint.zip

I appreciate everyone's time and I really hope that someone can help me out as this is a pretty crucial problem.

I did submit a Support Ticket but there has not been a response as yet. Figures crossed for that to happen soon.

Best Regards
Dave Stuart
0
Tsvetoslav
Telerik team
answered on 10 Feb 2011, 04:56 PM
Hi Dave,

I have provided an answer to the formal support ticket. Please, leave the discussion to it. Thanks for that.

Greetings,
Tsvetoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Dave
Top achievements
Rank 1
answered on 11 Feb 2011, 04:05 PM
For all those interested in this issue, it has been resolved, for the most part. I made the mistake of calling DataBind() in the CreateChildControls() method of the control. Simply adding the DataSource property when the RadGrid object was instantiated was enough. DataBind() is not to be called in CreateChildControl(). It should be either not called at all or on the Page Load. Since this is a Web Part and no data was changed on the Grid, then excluding the DataBind() method fixed the problem. One last Important piece of information,. EnableViewState MUST be set to True because you will get some stange happenings,like the graphical header columns will NOT sort and clicking on the Sort Icon in the Header causes another error which I have not had time to investigate.

Anyway, the short of it is that I can now deploy my WebPart!

Thanks
Dave Stuart
Tags
Grid
Asked by
Dave
Top achievements
Rank 1
Answers by
Dave
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or