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

2 dimensionnal grid ?

7 Answers 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aurélien Dubosson
Top achievements
Rank 1
Aurélien Dubosson asked on 01 Apr 2010, 06:00 PM
Hi ,

I need to use a two dimensional grid seems like that : 


source\destination          192.168.1.1             192.168.1.5

192.168.1.1     N/A                             4.8


192.168.1.5                         4.3                              N/A

Is it possible to configure Rad Grid View for that or I need to use an other control ?

Best regards.

Aurélien

7 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 02 Apr 2010, 02:03 PM
Hi Aurélien Dubosson,

RadGridView displays data. It is now aware of the semantic meaning of the data it is displaying.

If you prepare your data to be in the format that you have described -- RadGridView will show it just like this.

For example:

public class Row
{
public string SourceDestination{get; set;}
public string IP1 {get; set;}
public string IP2 {get; set;}
}

List<Row> data = new List<Row>();
data.Add(new Row(){SourceDestination="192.168.1.1", IP1="N/A", IP2="4.8"});
data.Add(new Row(){SourceDestination="192.168.1.5", IP1="4.3", IP2="N/A"});

grid.ItemsSource = data;

Then you can use the Header property of each column if you want to change the header text that is displayed.

In other words you can easily transform your original data into a suitable .NET list and the simply feed to the grid. It will display it in the way that you have prepared it.

I hope this helps. Let us know if you have any other questions.

Best wishes,
Ross
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
vnd
Top achievements
Rank 1
answered on 02 Apr 2010, 03:19 PM
This approach will work when we have fixed number of elements in columns dimension, but what to do when we should dynamically configure the number of columns?
0
Aurélien Dubosson
Top achievements
Rank 1
answered on 02 Apr 2010, 03:37 PM
I try your example but I would like the column 1 seems like the header line is it possible ?
0
Rossen Hristov
Telerik team
answered on 05 Apr 2010, 01:07 PM
Hello Aurélien Dubosson,

You can use my colleague Vladimir Enchev's Lightweight DataTable for Silverlight.

You can create and configure the data table at run-time. Add any columns that you want. Give them any names that you want. Then fill the DataTable with the correct data. Finally, bind RadGridView to this DataTable.

I hope this helps.

Sincerely yours,
Ross
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Aurélien Dubosson
Top achievements
Rank 1
answered on 05 Apr 2010, 06:28 PM
It's more the design of the headers I'm looking for . Like if the headers were in the first line and first column, same background .
0
Aurélien Dubosson
Top achievements
Rank 1
answered on 12 Apr 2010, 09:11 PM
Hello Telerik,

I tried to use the class DataTable suggested by you with the following code : 

   DataTable table = new DataTable();
            table.Columns.Add(new DataColumn() { ColumnName = "Src/Dest", DataType = typeof(string) });
            table.Columns.Add(new DataColumn() { ColumnName = "192.168.1.1", DataType = typeof(string) });
            table.Columns.Add(new DataColumn() { ColumnName = "192.168.1.5", DataType = typeof(string) });

            DataRow row1 = new DataRow();
            DataRow row2 = new DataRow();

            row1["Src/Dest"] = "192.168.1.1";
            row1["192.168.1.1"] = "N/A";
            row1["192.168.1.5"] = "5,1";

            row2["Src/Dest"] = "192.168.1.5";
            row2["192.168.1.1"] = "4,8";
            row2["192.168.1.5"] = "N/A";

            table.Rows.Add(row1);
            table.Rows.Add(row2);

            Grid.ItemsSource = table;

The Grid is a GridView but when I execute this code I don't see my two rows created before 

What's the problem ?

0
Rossen Hristov
Telerik team
answered on 13 Apr 2010, 08:13 AM
Hello Aurélien Dubosson,

Please, open a support ticket and send us your sample project. We will take a look at it.

Greetings,
Ross
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Aurélien Dubosson
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
vnd
Top achievements
Rank 1
Aurélien Dubosson
Top achievements
Rank 1
Share this question
or