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

Can't modify properties of a RadGridView inherited from a base form

5 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Man Sai
Top achievements
Rank 1
Man Sai asked on 24 Sep 2015, 06:14 PM

Hi,

I have a base form with a RadPageView and one RadPageViewPage. I dropped two RadPanel and one RadGridView into the RadPageViewPage. I set the modifier property of all this five controls to public. And then I save this RadForm.

 I created a second RadForm and inherited this one from the previous one. In this second form I can see all the controls in the designer. I can modified the properties of the two RadPanels but I can't modified the properties of the RadGridView in the properties windows.

 What can I do in order to modified the properties of the RadGridView of the second form at design time ?

 

 

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 25 Sep 2015, 01:36 PM
Hi Man,

Thank you for writing.

This is a known issue of Windows Forms design-time in general. Some complex controls cannot be reliably edited and are therefore the visual inheritance is disabled. More information can be found in the following discussion: c# - DataGridView locked on an inherited UserControl.

I hope this will be useful.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Man Sai
Top achievements
Rank 1
answered on 25 Sep 2015, 04:07 PM

Hi Dimitar,

Thanks for the clarification.  I thought it was something regarding RadGridView because I coud modify RadPanel's properties but not RadGridView's but it's a known issue of the designer.

I followed your link and found a workaround by creating a usercontrol:

    [System.ComponentModel.Designer(typeof(System.Windows.Forms.Design.ControlDesigner))]
    public class ucRadGridView : Telerik.WinControls.UI.RadGridView { }

I tried this and it seems to work fine. I can modify ucRadGridView's properties in the subclass form.

I guess the Designer attribute is forcing the designer to unlock this control at design time but I don't know if there are other side effect.

Would you recommend this workaround ?

Do you know of any other side effects or problems when using this workaround ?

Thanks,

Man Sai.‚Äč

 

0
Accepted
Dimitar
Telerik team
answered on 29 Sep 2015, 08:17 AM
Hi Man,

Thank you for writing back.

I have tested this and it appears that there are no issues when this is used. However, I cannot guarantee that it will work in all cases. Please note that generally using a grid in parent form is not a common case and perhaps you should consider adding your grids to the child forms (this shouldn't slow down the development process because usually a single form does not contain many grids). Another approach would be to leave the grid in the parent form and change its properties in the code behind.

I hope this information helps.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Joshua
Top achievements
Rank 2
answered on 11 Apr 2018, 08:19 PM
I apologize for re-opening an older thread, but we are looking to replace Janus GridEx and I have been unable to get your workaround to work so far.  I have tried inheriting from the RadGridView but with no luck.  I am still unable to add columns to it through the designer.  I realize this is a corner case most people likely don't use, but our existing codebase uses it a ton so I was really hoping to be able to leverage existing code. (We have child forms that re-use the same shared columns but add their own)  Does anyone have a more complete example?
[Designer(typeof System.Windows.Forms.Design.ControlDesigner))]
public class InheritedRadGridView : RadGridView { }
0
Dimitar
Telerik team
answered on 12 Apr 2018, 07:29 AM
Hi Joshua,

Thank you for writing.

I have tested this and it appears to work on my side. I have attached sample project. I only needed to change the column names because they were duplicated.  

I hope this will be useful. 

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Man Sai
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Man Sai
Top achievements
Rank 1
Joshua
Top achievements
Rank 2
Share this question
or