Solved

asp.net datagrid.databind() to xml result set?

Posted on 2010-08-20
4
536 Views
Last Modified: 2013-11-15
so i have a working application that calls a stored proc and binds to the data set that is returned.

i want to use select * from table for auto xml

or something that would return XML and want to have the data grid bind to that without me having to do things manually.

any advice on how to get this done?
0
Comment
Question by:realcoding
  • 3
4 Comments
 
LVL 22

Expert Comment

by:Om Prakash
ID: 33484477
0
 

Author Comment

by:realcoding
ID: 33484518
on the SQL side how do i get my stored proc to return XML in teh correct format for the .net side fo things to be able to use the xml data easily?

lets say now i have the following SQL

select empID, empName, empAge from Employee

and there are ten records in the table?
0
 

Author Comment

by:realcoding
ID: 33484636
below is the xml that is created when i add a "for xml auto" to my select.
the datagrid.databind() fails not being able to find fields (attributes of sub nodes. the one it fails on is MilestoneText)

<pm ProjectMilestoneId="100" ProjectId="2" MilestoneCID="18" StartDate="2010-08-18T00:00:00" EndDate="2010-08-19T00:00:00" RAGStatusCID="7" CompletionStatusCID="32" StatusText="something more wicked this way comes" Added="2010-08-16T00:00:00" LastUpdate="2010-08-18T14:06:26.510" UpdateBy="AMRS\ssalvati">
  <pm1sc MilestoneText="SAD/LLD Due                                       ">
    <pm2sc RAGStatusText="Red                                               ">
      <pm3sc CompletionStatusText="In-Progress                                       " />
    </pm2sc>
  </pm1sc>
</pm>
<pm ProjectMilestoneId="99" ProjectId="2" MilestoneCID="19" StartDate="1988-05-16T00:00:00" EndDate="2011-01-01T00:00:00" RAGStatusCID="7" CompletionStatusCID="35" StatusText="something really good is about to happen" ReportingPriority="1" Added="2010-08-10T00:00:00" LastUpdate="2010-08-18T11:04:09.660" UpdateBy="AMRS\ssalvati">
  <pm1sc MilestoneText="Hardware Required                                 ">
    <pm2sc RAGStatusText="Red                                               ">
      <pm3sc CompletionStatusText="Cancelled                                         " />
    </pm2sc>
  </pm1sc>
</pm>
<pm ProjectMilestoneId="991" ProjectId="2" MilestoneCID="1" StartDate="1933-05-16T00:00:00" EndDate="2033-01-01T00:00:00" RAGStatusCID="7" CompletionStatusCID="33" StatusText="testing text11111" Added="2010-08-10T00:00:00" LastUpdate="2010-08-17T18:44:31.813" UpdateBy="mshinder">
  <pm1sc MilestoneText="High                                              ">
    <pm2sc RAGStatusText="Red                                               ">
      <pm3sc CompletionStatusText="Delayed                                           " />
    </pm2sc>
  </pm1sc>
</pm>

Open in new window

0
 

Accepted Solution

by:
realcoding earned 0 total points
ID: 33504080
using xml raw does what i need, it gets all the fields in the select as attributes to a single node. the grid binds to this xml just fine.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question