473,836 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ExtendedDatagri d and TableStyles

Hi there,

Long-time lurker, first-time poster:

I'm working with the ExtendedDatagri d
(http://dotnet.leadit.be/extendeddatagrid/) control to display a grid
representing an array of objects I've created.

In the form below the datagrid is displayed with the correct columns,
and the correct data (as added at the bottom of the code with my
partial-datarow). However, this is displayed using the default style,
and not the custom-controls i specified in my styles.

If i uncomment the line that adds my tablestyle to the datagrid,
things appear to break. All that is shown is an empty datagrid.

This has been making me tear my hair out for the last two days. If you
can put me out my misery, or can point out a better way to approach my
problem i'm all ears!

Thanks!

Andrew

code:
-----

DataTable dt = new DataTable("Cust omersMatrix");
dt.Columns.Add( "Customers" );
ft.Columns.Add( "SalesMargins") ;

foreach (string p in Products)
{
dt.Columns.Add( p);
}

// Create datagrid table style
ExtendedDataGri dTableStyle ts = new ExtendedDataGri dTableStyle();
ts.MappingName = "Customers[]";

// create datagrid column styles for first two columns
ExtendedDataGri dControlColumn colCustomerName = new
ExtendedDataGri dControlColumn( );
colCustomerName .MappingName = "Name";
colCustomerName .HeaderText = "Customers" ;
colCustomerName .Control = typeof(Customer LabelColumnCont rol);

DataGridTextBox Column colSalesMarginL abel = new
DataGridTextBox Column();
colSalesMarginL abel.MappingNam e = colSalesMarginL abel.HeaderText =
"SalesMargi n";
//colCustomerName .Control = typeof(Customer LabelColumnCont rol);

// for each product in the db, create a column style
ArrayList productColumnSt yles = new ArrayList();
ExtendedDataGri dControlColumn[] productColumnSt ylesArray;

foreach (string product in Products)
{
ExtendedDataGri dControlColumn colProduct = new
ExtendedDataGri dControlColumn( );
//colProduct.Mapp ingName = "Products";
colProduct.Head erText = product;
colProduct.Cont rol = typeof(ProductS alesMarginColum nControl);
productColumnSt yles.Add(colPro duct);
}

productColumnSt ylesArray =
(ExtendedDataGr idControlColumn[])productColumnS tyles.ToArray(t ypeof(ExtendedD ataGridControlC olumn));

// add all column styles to our tablestyle
ts.GridColumnSt yles.Add(colCus tomerName);
ts.GridColumnSt yles.Add(colSal esMarginLabel);
ts.GridColumnSt yles.AddRange(p roductColumnSty lesArray);

// add our tablestyle to the datagrid
//extendedDataGri d.TableStyles.A dd(ts);

DataRow dr = dt.NewRow();
dr["Customers"] = "Carrefour" ;
dr["SalesMargi ns"] = "Sales\nMargins ";
dr["Television s"] = new CustomerProduct Matrix.SalesMar gin(100,0.5m);
dt.Rows.Add(dr) ;

extendedDataGri d.DataSource = dt;
Nov 16 '05 #1
2 2983
Change

ts.MappingName = "Customers[];

to

ts.MappingName = "CustomersMatri x";

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Andrew Donaldson wrote:
Hi there,

Long-time lurker, first-time poster:

I'm working with the ExtendedDatagri d
(http://dotnet.leadit.be/extendeddatagrid/) control to display a grid
representing an array of objects I've created.

In the form below the datagrid is displayed with the correct columns,
and the correct data (as added at the bottom of the code with my
partial-datarow). However, this is displayed using the default style,
and not the custom-controls i specified in my styles.

If i uncomment the line that adds my tablestyle to the datagrid,
things appear to break. All that is shown is an empty datagrid.

This has been making me tear my hair out for the last two days. If you
can put me out my misery, or can point out a better way to approach my
problem i'm all ears!

Thanks!

Andrew

code:
-----

DataTable dt = new DataTable("Cust omersMatrix");
dt.Columns.Add( "Customers" );
ft.Columns.Add( "SalesMargins") ;

foreach (string p in Products)
{
dt.Columns.Add( p);
}

// Create datagrid table style
ExtendedDataGri dTableStyle ts = new ExtendedDataGri dTableStyle();
ts.MappingName = "Customers[]";

// create datagrid column styles for first two columns
ExtendedDataGri dControlColumn colCustomerName = new
ExtendedDataGri dControlColumn( );
colCustomerName .MappingName = "Name";
colCustomerName .HeaderText = "Customers" ;
colCustomerName .Control = typeof(Customer LabelColumnCont rol);

DataGridTextBox Column colSalesMarginL abel = new
DataGridTextBox Column();
colSalesMarginL abel.MappingNam e = colSalesMarginL abel.HeaderText =
"SalesMargi n";
//colCustomerName .Control = typeof(Customer LabelColumnCont rol);

// for each product in the db, create a column style
ArrayList productColumnSt yles = new ArrayList();
ExtendedDataGri dControlColumn[] productColumnSt ylesArray;

foreach (string product in Products)
{
ExtendedDataGri dControlColumn colProduct = new
ExtendedDataGri dControlColumn( );
//colProduct.Mapp ingName = "Products";
colProduct.Head erText = product;
colProduct.Cont rol = typeof(ProductS alesMarginColum nControl);
productColumnSt yles.Add(colPro duct);
}

productColumnSt ylesArray =
(ExtendedDataGr idControlColumn[])productColumnS tyles.ToArray(t ypeof(ExtendedD ataGridControlC olumn));

// add all column styles to our tablestyle
ts.GridColumnSt yles.Add(colCus tomerName);
ts.GridColumnSt yles.Add(colSal esMarginLabel);
ts.GridColumnSt yles.AddRange(p roductColumnSty lesArray);

// add our tablestyle to the datagrid
//extendedDataGri d.TableStyles.A dd(ts);

DataRow dr = dt.NewRow();
dr["Customers"] = "Carrefour" ;
dr["SalesMargi ns"] = "Sales\nMargins ";
dr["Television s"] = new CustomerProduct Matrix.SalesMar gin(100,0.5m);
dt.Rows.Add(dr) ;

extendedDataGri d.DataSource = dt;

Nov 16 '05 #2
Change

ts.MappingName = "Customers[];

to

ts.MappingName = "CustomersMatri x";

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Andrew Donaldson wrote:
Hi there,

Long-time lurker, first-time poster:

I'm working with the ExtendedDatagri d
(http://dotnet.leadit.be/extendeddatagrid/) control to display a grid
representing an array of objects I've created.

In the form below the datagrid is displayed with the correct columns,
and the correct data (as added at the bottom of the code with my
partial-datarow). However, this is displayed using the default style,
and not the custom-controls i specified in my styles.

If i uncomment the line that adds my tablestyle to the datagrid,
things appear to break. All that is shown is an empty datagrid.

This has been making me tear my hair out for the last two days. If you
can put me out my misery, or can point out a better way to approach my
problem i'm all ears!

Thanks!

Andrew

code:
-----

DataTable dt = new DataTable("Cust omersMatrix");
dt.Columns.Add( "Customers" );
ft.Columns.Add( "SalesMargins") ;

foreach (string p in Products)
{
dt.Columns.Add( p);
}

// Create datagrid table style
ExtendedDataGri dTableStyle ts = new ExtendedDataGri dTableStyle();
ts.MappingName = "Customers[]";

// create datagrid column styles for first two columns
ExtendedDataGri dControlColumn colCustomerName = new
ExtendedDataGri dControlColumn( );
colCustomerName .MappingName = "Name";
colCustomerName .HeaderText = "Customers" ;
colCustomerName .Control = typeof(Customer LabelColumnCont rol);

DataGridTextBox Column colSalesMarginL abel = new
DataGridTextBox Column();
colSalesMarginL abel.MappingNam e = colSalesMarginL abel.HeaderText =
"SalesMargi n";
//colCustomerName .Control = typeof(Customer LabelColumnCont rol);

// for each product in the db, create a column style
ArrayList productColumnSt yles = new ArrayList();
ExtendedDataGri dControlColumn[] productColumnSt ylesArray;

foreach (string product in Products)
{
ExtendedDataGri dControlColumn colProduct = new
ExtendedDataGri dControlColumn( );
//colProduct.Mapp ingName = "Products";
colProduct.Head erText = product;
colProduct.Cont rol = typeof(ProductS alesMarginColum nControl);
productColumnSt yles.Add(colPro duct);
}

productColumnSt ylesArray =
(ExtendedDataGr idControlColumn[])productColumnS tyles.ToArray(t ypeof(ExtendedD ataGridControlC olumn));

// add all column styles to our tablestyle
ts.GridColumnSt yles.Add(colCus tomerName);
ts.GridColumnSt yles.Add(colSal esMarginLabel);
ts.GridColumnSt yles.AddRange(p roductColumnSty lesArray);

// add our tablestyle to the datagrid
//extendedDataGri d.TableStyles.A dd(ts);

DataRow dr = dt.NewRow();
dr["Customers"] = "Carrefour" ;
dr["SalesMargi ns"] = "Sales\nMargins ";
dr["Television s"] = new CustomerProduct Matrix.SalesMar gin(100,0.5m);
dt.Rows.Add(dr) ;

extendedDataGri d.DataSource = dt;


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1261
by: nick | last post by:
Anyone know if I can find components similar to extendeddatagrid for VS *2002*?
2
1909
by: Ralf | last post by:
Hi NG, if there a way to Clear a DataGrid dataGrid1.TableStyles.Clear(); or dataGrid1.TableStyles.Remove(tblStyle); or dataGrid1.TableStyles.RemoveAt(intDG); or not work!? dataGrid1.TableStyles.GridColumnStyles.RemoveAt(0);
7
1651
by: CJ Taylor | last post by:
Has anyone had problems getting custom controls to work in Jan's Extended Data Grid? I'm just tryin to amke a simple button column extension and keep getting an exception on the paint. Tried everything... anyone have some experience with this? Thanks, cJ
2
1705
by: Adam Nowotny | last post by:
http://dotnet.leadit.be/extendeddatagrid/ -- Adam Nowotny JID: daft@chrome.pl
0
929
by: Brett Sinclair | last post by:
Hello everybody do you know where I could find some sample code to use the ExtendedDatagrid from http://dotnet.leadit.be/extendeddatagrid/CategoryView.aspx?category=Latest%20News in vb.net ? Thank you
3
1184
by: Agnes | last post by:
I got one datagrid to show the master-detail relation data. I know how to set the Tablestyles for one datagrid, However, As the user 'expand' the record, I don't know how to set its child columnstyles. Does anyone know ?? Thanks in advance
3
2581
by: Jerry Spence1 | last post by:
I have created some definitions at design time for a Datagrid. How do I actually switch one of the definition on - ie make it active? I've tried Datagrid1.TableStyles.Add - but that just adds it to the collection. I feel I need something like: Datagrid1.TableStyles(0).active = True Also, having created a style and given it a name (Style1) how do I refer to it?
1
1031
by: JeremyGrand | last post by:
I'd just like to confirm that one really can't use the ide to configure tablestyles & columnstyles in a datagrid. I've tried it and can't make it "take". The examples I find all show this done in code. In the help, I see that tablestyles actually take effect at the time they are applied to the grid, which of course is a catch22 -- you can't define columnstyles in the gui until _after_ you've assigned the tablestyles collection. Am I...
1
1164
by: Brett Romero | last post by:
I have one DataTable used in a datagrid. I have multiple TableStyles to defining various views of the data. The table contains 20 unique columns. I have four TableStyles, each with containing five columns. I'd like to switch out these four views on button clicks. One view will display at a time. Rather than create four datatables, I feel the tablestyles and switching them is quicker. Comments? For some reason, it isn't working. I...
0
9810
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9656
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10526
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10567
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10237
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7771
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6972
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5641
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5811
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.