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

RadGrid Expand column appearing when it shouldn't

5 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 27 Jul 2012, 04:18 PM
I have a project when one of the pages has several separate RadGrids.  Each grid is bound to a generis list of custom objects, has AutoGeneratedColumns set to false, and uses GridBoundColumns to show the data.

This worked great... until we upgraded from Telerik ASP.NET 2011.1 to 2012.1.

Now this page is showing the Expand column on all grids on the page (the Expand arrows don't do anything), and for the life of me I cannot get these columns to go away.  I've seen some hacks, attaching to events to remove the column or using CSS to hide the column... but the question is, why is RadGrid creating this column at all?

We've looked for properties on the RadGrid to force this off and there doesn't appear to be any.  (AutoGenerateHierarchy=false doesn't do anything to help either!)

Note that there are other pages on the same site that have similar setup... multiple separate RadGrids, same settings, and so forth, and they don't exhibit the problem.  I've tried to see what the difference is, and am having no luck.

Can anybody please shed some light on this question: What triggers the RadGrid to show the Expand column?

Any help is appreciated.

5 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 31 Jul 2012, 03:36 PM
Hi David,

This could happen in a scenario where you create the control dynamically when using simple data-binding. In the aforementioned case if you invoke DataBind method before adding RadGrid to the Controls collection the expand column will be displayed. Could you please let us know whether your scenario is similar to this one? If it is not, you can post your code here so that we can investigate the problem?

Regards,
Daniel
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.
0
David
Top achievements
Rank 1
answered on 31 Jul 2012, 04:50 PM
Hello,

Thank you for your response.

These grids are on an ascx control (6 RadGrid controls in total on this ascx).  Within the ascx control, the grids are hidden and shown depending on whether they have data available.  They are all bound to either generic List<> or IEnumerable<> collections, for example:
var currentCharges = (from c in unit.Charges where c.InEffect select c);
this.grdCurrentCharges.DataSource = currentCharges;
this.grdCurrentCharges.DataBind();

In the above example, this is an IEnumerable<> collection of custom objects... and the class for these objects has nothing other than 11 properties getters of various types (basic types "bool and string" and nullable types "decimal? and DateTime?")... no interfaces, no inheritance, and no method definitions.

The ascx is created dynamically (using Page.LoadControl) and added to a RadPageView that is on the base aspx page.  The ascx is added to the RadPageView well before the above DataBind is called.  We have many other ascx controls that follow the same code path and they strangely do not have the same problem.

And again, this all used to work perfectly fine... we're not certain what is causing the changed behaviour (other than the upgrade to a newer Telerik version).  We also still cannot see what is causing an issue on this ascx control in particular (it does have the most RadGrid controls of all the ascx files, there are 6 RadGrid controls on this ascx).  More frustrating to us though is that there doesn't appear to be any way on the grid to actually control this rendering behaviour.

We've used the workaround that's been suggested in other forums for people experiencing similar frustration: attaching to the ColumnCreated event and hiding the offending column.  While obviously not the cleanest solution, it does work very well and has fixed our problem:
protected void Grid_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
    if (e.Column.UniqueName == "ExpandColumn")
    {
        e.Column.Visible = false;
    }
}

Understanding what the RadGrid control does internally to determine whether or not to generate this "ExpandColumn" (presuming this logic can be easily described) would be very helpful.

Thanks for your help,
Dave
0
Daniel
Telerik team
answered on 03 Aug 2012, 02:28 PM
Hello David,

I appreciate your taking the time to provide a comprehensive explanation. I'm afraid there is little I could do without a runnable project. Please submit a support ticket with a reference to this thread and I will send you a custom built dll for testing purposes. Either way, a runnable demo will definitely speed the things up.
Thanks for your understanding.

Best regards,
Daniel
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.
0
Mark
Top achievements
Rank 1
answered on 30 Aug 2012, 06:26 PM
We are experiencing the same issue and I would appreciate knowing how it was resolved.

Thanks
0
Daniel
Telerik team
answered on 04 Sep 2012, 02:41 PM
Hi Mark,

Please show us your code. I will try to make a runnable demo provided that your scenario is not too complex. Our developers will have look into the problem if I can give them something they can run locally and debug.

Regards,
Daniel
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
David
Top achievements
Rank 1
Answers by
Daniel
Telerik team
David
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Share this question
or