Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Subclassing a DataGrid control

Reply
Thread Tools

Subclassing a DataGrid control

 
 
Jeronimo Bertran
Guest
Posts: n/a
 
      05-03-2005
Hi,

What is the correct way to sbuclass a datagrid that we want to use in the
designer that includes default columns?

I am trying to create a control that inherits from DataGrid and performs
some standard manipulation (such as creating default columns)....



public class MyGrid : System.Windows.Forms.DataGrid



I add columns either with the designer or on the constructor:


//
// dataGridTableStyle
//
this.dataGridTableStyle.DataGrid = this;
this.dataGridTableStyle.GridColumnStyles.AddRange( new
System.Windows.Forms.DataGridColumnStyle[] {this.dataGridNameColumn});
this.dataGridTableStyle.MappingName = "ArrayList";
//
// dataGridNameColumn
//
this.dataGridNameColumn.HeaderText = "Name";
this.dataGridNameColumn.MappingName = "Name";


Now, if I add my grid to the ToolBox and add it to a form, a new instance
of the GridTableSytle and and GridColumnStyle is created in the form. I
get an error because I now have 2 TableStyles with the same MappingName.
If I delete the TableStyle collection from the designer then it then works
ok and only the instance created on the class is used.

Thanks,

Jeronimo Bertran



 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-04-2005
Hi Jeronimo,

Welcome to ASPNET newsgroup.
Regarding on the problem you mentioned, it seems related to winform
control's Design-time developing. Based on my understanding , ASP.NET's
datagrid control is much different from the winform datagrid, they have
different underlying mechanism and design-time support. So if convenient ,I
suggest you repost the quesiton in

public.dotnet.framework.windowsforms newsgroup or its sub groups.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
 
Jeronimo Bertran
Guest
Posts: n/a
 
      05-09-2005
Yes, it has to do with the WinForms control... I didn't notice the aspnet
part on the newsgroup name.

Thanks,
 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-10-2005
Nevermind Jeronimo,

If you have any question on webform developing, please feel free to post in
ASPNET group. We'll be glad to
assist you. :--)

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subclassing a user control containing UI elements Charlie@CBFC ASP .Net 1 04-26-2005 01:57 PM
Subclassing int for a revolving control number Chris Cioffi Python 13 07-20-2004 06:33 PM
Subclassing DataGrid David Rainsford ASP .Net Datagrid Control 1 04-01-2004 05:23 PM
Subclassing DataGrid Dan ASP .Net Web Controls 0 02-28-2004 01:01 AM
Subclassing UserControl makes the Visual Studio designer does not work S Guiboud ASP .Net 1 07-18-2003 03:55 PM



Advertisments