Solved

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

Posted on 2010-08-20
4
513 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
Comment Utility
0
 

Author Comment

by:realcoding
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now