473,977 Members | 50,957 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 2997
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
1269
by: nick | last post by:
Anyone know if I can find components similar to extendeddatagrid for VS *2002*?
2
1924
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
1664
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
1721
by: Adam Nowotny | last post by:
http://dotnet.leadit.be/extendeddatagrid/ -- Adam Nowotny JID: daft@chrome.pl
0
942
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
1191
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
2595
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
1044
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
1170
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
10356
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
10172
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
11409
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...
0
10914
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...
0
10085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8464
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
7610
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
6418
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...
2
4732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.