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

Populate RadGridView with XML

5 Answers 360 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Diogo Colucci
Top achievements
Rank 1
Diogo Colucci asked on 19 Dec 2007, 11:48 PM
Hi, we are testing this package in VB.NET, how can i populate a RadGridView with a XML file?

I get this XML from a PHP (NuSOAP) webservice, i need to add this XML to an Array or can i populate direct to the Grid control?

thank's


5 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 20 Dec 2007, 10:36 AM
Hi Diogo Colucci,

Thank you for this question.

Yes, you can use an XML file in order to populate RadGridView with data. You can do this using the ReadXml method of the DataSet class. Refer to the code snippet below:

string data = "<?xml version=\"1.0\" standalone=\"yes\"?><DataSet><Employee><ID>8</ID><Name>Joe</Name></Employee></DataSet>"
 
DataSet dataSet = new DataSet(); 
dataSet.ReadXml(new StringReader(data)); 
this.radGridView1.DataSource = dataSet.Tables["Employee"]; 

In case you need further assistance, we will be glad to help you.

All the best,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Diogo Colucci
Top achievements
Rank 1
answered on 20 Dec 2007, 03:30 PM
Hi, thank's for the great support, 5 stars from me :)

I converted the sample into VB and works great thank's.

Now, we have other question:

How can i pupulate the RadGridView manually?
Adding coulumn headers and rows?

Why? because we need to add custom info in the grid. (please see the red circle in the picture)
Really we need some like the ASP.NET RadGrid Example, and the results in the picture.

Please check the picture:
http://img225.imageshack.us/img225/2/samplegu2.gif

Can you give me an orientation?

Can Q3 version support paginate? like ASP version?

Thank's

Diogo.
0
Jack
Telerik team
answered on 21 Dec 2007, 02:15 PM
Hi Diogo Colucci,

The RadGridView does not Currently support unbound mode or excel-like behavior. These are features that we plan to implement in our future versions. Nevertheless, you can add unbound columns, or create all grid columns manually. You can also add rows programmatically through code.

In order to add an unbound column, just add a column of a certain type and do not assign a DataField. To control the cell's visual appearance use the CellFormatting event.

The sample below demonstrates this behavior:

 
this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting); 
this.radGridView1.Columns.Add(new GridViewTextBoxColumn()); 
 
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) 
    GridDataCellElement cell = e.CellElement as GridDataCellElement; 
    if (cell != null && string.IsNullOrEmpty(((GridViewDataColumn)cell.ColumnInfo).DataField)) 
    { 
        cell.Text = "Some text"
    } 
 

To disable the automatic generation of columns set the AutoGenerateColumns property of MasterGridViewTemplate to false.

To add a row through code use the following code:

this.radGridView1.Rows.Add("Row 2" , 4.5, "John Smith"); 

Important: RadGridView does not support unbound mode, so you should always set the DataSource property with a valid data source.

We decided to not implement paging in RadGridView. This functionality can be realized easily as an external control and is not commonly used in the windows forms applications.

Don't hesitate to contact us if you have other questions.

Greetings,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Diogo Colucci
Top achievements
Rank 1
answered on 22 Dec 2007, 06:06 PM
Thank's for your help.

A last question:

We have an ecommerce website and we need to do a .NET app, like "eBay Desktop" and we are thinking in use your suite for this project.

We need to do a list and show items in both modes,

1)Normal list 2)thumbnail view

Just like the Microsoft MediaCenter when you see pictures or video,

What controls its better to do this? with Normal and Thumb view?

Pictures here:

http://www.permanence.com/MCE/images/ss_search_vista_thumb.jpg

and

http://www.team-mediaportal.com/gallery/mce12.jpg

thank's
0
Kiril
Telerik team
answered on 27 Dec 2007, 03:57 PM
Hi Diogo Colucci,

Thank you for writing, and for describing the scenario of your application.

We think the functionality you are describing can be generalized to that provided by a ListView, which shows items in different modes (including normal and thumbnail views). We are considering adding such a control to our product in future releases. However, we cannot commit to any specific timeframe when it will be made available.

If you have any additional questions, please contact us.

Regards,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Diogo Colucci
Top achievements
Rank 1
Answers by
Jack
Telerik team
Diogo Colucci
Top achievements
Rank 1
Kiril
Telerik team
Share this question
or