Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 7th, 2009, 10:10 PM
Authorized User
Join Date: Jun 2003
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help With Better Databinding

I get an array of Document objects from a web service call. Each Document object has an array of Property objects. Each Property object has two properties, Name and Value. Such as

<Property Name="Title" Value="Test Title">
<Property Name="Category" Value="Test Subject">

My question is this, what is the best method for changing this array of Document objects into a bindable data source for a datagrid. In the past I've done the following, serialize the object to xml and run an xsl transformation on it to make the below xml and then read that xml into a datatable. I'm looking for a better way to make the Documents array bindable. Can I get some suggestions please?

<Title>Test Title</Title>
<Category>Test Subject</Category>

Last edited by AgentSmith; March 7th, 2009 at 10:11 PM.. Reason: Formatting
  #2 (permalink)  
Old March 8th, 2009, 04:05 PM
Friend of Wrox
Join Date: Dec 2008
Location: , , .
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts

Assume xml is a String that contains the xml document:
GridView1.DataSource = from p in XDocument.Parse(xml).Elements("Docs").Elements("Doc") select new { Title = p.Elements().ElementAt(0).Attribute("Value").Value, Category = p.Elements().ElementAt(1).Attribute("Value").Value };

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
databinding getdates moneymk109 ASP.NET 2.0 Basics 0 April 8th, 2006 12:56 AM
databinding in VB2005 Bhuvana ADO.NET 0 March 9th, 2006 02:14 AM
Databinding with an inner join Louisa VB.NET 2002/2003 Basics 2 December 12th, 2003 04:57 AM

All times are GMT -4. The time now is 03:27 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.