473,840 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question about throwing some xml into a grid view at runtime

Hello,

Before I begin, here's some background to the problem. I'm working on
a web app which deals with maps. Via a browser, the users can zoom in,
zoom out, and pan around a map of their geographic region. The users
can also click a button called "identify". When they do this the mouse
pointer changes to a crosshair and when they click on the map, the
polygon under the cursor is captured and passed in a query to the
database... what is returned is information about that "identified "
point

The results returned are in a XML format. Some 3rd party software I'm
using is the broker here and that product returns all queries as XML...
I cannot change it. If you're curious, here's a sample of what the
results look like:

<?xml version="1.0" encoding="UTF-8"?>
<ARCXML version="1.1">
<RESPONSE>
<FEATURES>
<FEATURE>
<ENVELOPE minx="-104.81267603365 8" miny="38.838947 0054157"
maxx="-104.81244896185 " maxy="38.839049 932579" />
<FIELDS>
<FIELD name="FID" value="152474" />
<FIELD name="SHAPE_ARE A" value="2008.734 375" />
<FIELD name="SHAPE_LEN " value="189.7145 70418" />
</FIELDS>
</FEATURE>
</FEATURES>
</RESPONSE>
</ARCXML>

For display, I was thinking of throwing these results into a
gridview... here's what I've written:

Sub showXML(ByVal s As String)
Dim ds As New DataSet
Dim gv As New GridView

Dim xr As System.Xml.XmlR eader =
System.Xml.XmlR eader.Create(Ne w System.IO.Strin gReader(s))

ds.ReadXml(xr)

gv.DataSource = ds
gv.DataBind()
Me.GridViewPlac eHolder.Control s.Add(gv)
End Sub

And at runtime, this is what the gridview looks like:

ARCXML_Id version
0 1.1

hmmmm... I was under the impression one could throw XML into a gridview
and the component knew how to handle it automatically.. . i.e., the tags
describing the data automatically became column headings and the values
automatically became rows??? Also, I don't have a tag "ARCXML_Id" ...
where did the "_Id" get appended to the ARCXML?

Why does only the first line of the results make it into the gridview?
How can I get all the XML into the gridview? Suggestions as to where
I'm going wrong with my implementation are greatly appreciated.

Thanks!

Sep 14 '06 #1
5 1629
No need for a grid view. Just use an XSLT transform.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.

"Adam Sandler" <co****@excite. comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Hello,

Before I begin, here's some background to the problem. I'm working on
a web app which deals with maps. Via a browser, the users can zoom in,
zoom out, and pan around a map of their geographic region. The users
can also click a button called "identify". When they do this the mouse
pointer changes to a crosshair and when they click on the map, the
polygon under the cursor is captured and passed in a query to the
database... what is returned is information about that "identified "
point

The results returned are in a XML format. Some 3rd party software I'm
using is the broker here and that product returns all queries as XML...
I cannot change it. If you're curious, here's a sample of what the
results look like:

<?xml version="1.0" encoding="UTF-8"?>
<ARCXML version="1.1">
<RESPONSE>
<FEATURES>
<FEATURE>
<ENVELOPE minx="-104.81267603365 8" miny="38.838947 0054157"
maxx="-104.81244896185 " maxy="38.839049 932579" />
<FIELDS>
<FIELD name="FID" value="152474" />
<FIELD name="SHAPE_ARE A" value="2008.734 375" />
<FIELD name="SHAPE_LEN " value="189.7145 70418" />
</FIELDS>
</FEATURE>
</FEATURES>
</RESPONSE>
</ARCXML>

For display, I was thinking of throwing these results into a
gridview... here's what I've written:

Sub showXML(ByVal s As String)
Dim ds As New DataSet
Dim gv As New GridView

Dim xr As System.Xml.XmlR eader =
System.Xml.XmlR eader.Create(Ne w System.IO.Strin gReader(s))

ds.ReadXml(xr)

gv.DataSource = ds
gv.DataBind()
Me.GridViewPlac eHolder.Control s.Add(gv)
End Sub

And at runtime, this is what the gridview looks like:

ARCXML_Id version
0 1.1

hmmmm... I was under the impression one could throw XML into a gridview
and the component knew how to handle it automatically.. . i.e., the tags
describing the data automatically became column headings and the values
automatically became rows??? Also, I don't have a tag "ARCXML_Id" ...
where did the "_Id" get appended to the ARCXML?

Why does only the first line of the results make it into the gridview?
How can I get all the XML into the gridview? Suggestions as to where
I'm going wrong with my implementation are greatly appreciated.

Thanks!

Sep 15 '06 #2
Kevin Spencer wrote:
No need for a grid view. Just use an XSLT transform.
Thanks for the reply... a gridview is very powerful don't you think?
There's a lot of things I can do with a gridview versus some xsl which
creates a clunky HTML table...

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:styles heet
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"><xsl :template
match="/">
<html>
<body>
<h2>Results</h2>
<table border="1">
<tr>
<th align="left">FI D</th>
<th align="left">SH APE_AREA</th>
<th align="left">SH APE_LEN</th>
</tr>
<xsl:for-each select="FEATURE/FIELDS">
<tr>
<td><xsl:valu e-of select="FID"/></td>
<td><xsl:valu e-of select="SHAPE_A REA"/></td>
<td><xsl:valu e-of select="SHAPE_L EN"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>

Are you saying a gridview cannot be used or is that just your personal
preference?

Sep 15 '06 #3
A GridView creates an HTML table as well. It all depends on what you want to
do with the data displayed. I assumed that since it is in an XML file that
it would not need to be changed by the user. Assuming that the data in the
XML file is read-only, there's nothing clunky about using an XSLT transform
to insert it into your page. In fact, ASP.Net includes Controls for doing
this. See the documentation for System.Web.UI.W ebControls.Xml:

http://msdn2.microsoft.com/en-us/lib...trols.xml.aspx.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.

"Adam Sandler" <co****@excite. comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Kevin Spencer wrote:
>No need for a grid view. Just use an XSLT transform.

Thanks for the reply... a gridview is very powerful don't you think?
There's a lot of things I can do with a gridview versus some xsl which
creates a clunky HTML table...

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:styles heet
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"><xsl :template
match="/">
<html>
<body>
<h2>Results</h2>
<table border="1">
<tr>
<th align="left">FI D</th>
<th align="left">SH APE_AREA</th>
<th align="left">SH APE_LEN</th>
</tr>
<xsl:for-each select="FEATURE/FIELDS">
<tr>
<td><xsl:valu e-of select="FID"/></td>
<td><xsl:valu e-of select="SHAPE_A REA"/></td>
<td><xsl:valu e-of select="SHAPE_L EN"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>

Are you saying a gridview cannot be used or is that just your personal
preference?

Sep 15 '06 #4
BTW, I should mention that an additional advantage of using XSLT with XML
instead of a GridView is that there is no limitation on how you format the
XML with the XSLT solution. In fact, you can format it any of many different
ways. We have a service that gets METAR weather data from Automated Weather
Observation Stations (AWOS) and sends it to the National Weather Service. It
creates log files by means of a Log class that is serializable as XML. I
created an ASPX page that displays the log simply by getting the log file
and performing an XSLT transform on it to embed it in the page. Here is an
example:

http://www.dynamicsystems.com/weathe...ionReport.aspx

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.

"Adam Sandler" <co****@excite. comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Kevin Spencer wrote:
>No need for a grid view. Just use an XSLT transform.

Thanks for the reply... a gridview is very powerful don't you think?
There's a lot of things I can do with a gridview versus some xsl which
creates a clunky HTML table...

<?xml version="1.0" encoding="ISO-8859-1"?><xsl:styles heet
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"><xsl :template
match="/">
<html>
<body>
<h2>Results</h2>
<table border="1">
<tr>
<th align="left">FI D</th>
<th align="left">SH APE_AREA</th>
<th align="left">SH APE_LEN</th>
</tr>
<xsl:for-each select="FEATURE/FIELDS">
<tr>
<td><xsl:valu e-of select="FID"/></td>
<td><xsl:valu e-of select="SHAPE_A REA"/></td>
<td><xsl:valu e-of select="SHAPE_L EN"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>

Are you saying a gridview cannot be used or is that just your personal
preference?

Sep 15 '06 #5

Kevin Spencer wrote:
A GridView creates an HTML table as well. It all depends on what you want to
Thanks again... I understand...
there's nothing clunky about using an XSLT transform
Let me explain further, I wasn't knocking the methodology per se. What
I was knocking is with the xml transform, I'm still writing HTML. With
things like visual environments and ASP, I frankly don't spend a lot of
time on markup that much anymore.

For my business needs, would I rather get caught up in <tr></trand
<td></tdmaintenance he|| or would I rather dump the data into an ASP
component and let the server run with it? Albeit, I'd only have to
write the table once -- but I vote for the latter. Especially when
faced with always changing customer requirements -- I'd prefer to spend
time on content rather than markup if a gridview can assemble a table
automatically from some XML in memory as I was led to believe.

Also, what I posted originally is a simplistic view of what I'm doing.
While all the XML is indeed read only, there could be a lot of data
returned. And depending on what feature the user selects on the map to
identify by, the XML could come back with different fields in it... so
in that case, I'll be writing <tr></trand <td></tdfor one type of
results, and I'll be doing it for the XML which parses out into 5
columns, and again for the XML which parses out into 10 columns, etc...
Thanks for all the help thus far!

Sep 15 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2380
by: sdbranum | last post by:
I have been using Visual C#.NET to code a large project having many data adapters, data sets, datagrids, multiple forms with tab pages, each containing various controls (mostly label, text boxes, check boxes, date pickers, combo boxes and datagrids). I have been coding alone on this project for about a year, and I have experienced many problems which have not been addressed by various SP's, including the recent SP1 to Framework.NET 1.1,...
26
425
by: Michael A. Covington | last post by:
Suppose class X has some public properties, and class Y inherits from X. Is there a way that some of the public properties of X can be private (hidden) in Y (but still usable by the methods inherited from X that use them)?
0
3976
by: Fernando Lopes | last post by:
Hi. I have a grid where i create its columns in runtime. I tried create a templatefield in this grid view. In true, i need to create a radiobutton column in my grid view. I didin't had sucess. How can i do that in code-behin? Something like: TemplateField tfield = new TemplateField(); tfiel.ItemTemplate = new RadioButton(); gridview.Columns.Add(tfield);
0
2081
by: ¿ Mahesh Kumar | last post by:
I have created a XML file as datasource which i 'm binding to a grid view control. During runtime I'm capturing items in XML file and displaying in a GRID VIEW control. but i want to remove or flush the XML file content on page load. I tried parentnode.removeall () but no use.. (1) how to clean/delete the XML file nodes on page load for using as DATA SOURCE which again i'm binding to Grid view..?? (2) and also on page refresh my gird...
1
946
by: Lou Civitella | last post by:
I have a asp page that has 3 list boxes on it and one combo box. When the user selects an item from each of the list boxes it automatically shows the data in a Grid View. I can select different items from each list box and the grid view will be filtered. I want to be able to have the combo box be used in the filtering of the grid view but I have a problem with it. The combo box list different types plus listed at the top it lists 'ALL' I...
6
1661
by: Ashok | last post by:
Hi, I am starting a new project to build a software product using APS.NET 2.0. In past I have used "frameset" and "frame" to build pages. My current requirements I have coded using frameset and frame like code below. My question is, because this is a new development is it good to use frameset and frame or I can use some thing better. I am looking for expert suggestions on my code below is this a good way to move or I should not use...
4
1154
by: Richard Carpenter | last post by:
Considering a typical scenario where the user is presented a list of customers and, upon selecting one and clicking a button, they are then presented with a new page depicting the orders for that customer and the detail items for each order, what is the conventional (best) way to "pass" the CustomerID from the first page to the second page and then use it to only select the relevant orders to display as well as only the relevant order...
11
1377
by: John Goche | last post by:
Hello, Consider the following example. There is a function foo(Foo1<Foo2foo1) { ... } The class Foo1 has an empty constructor. Foo2 can be constructed from an instance foo3 of Foo3.
0
1374
by: itsbhabesh | last post by:
I have grid view having data in runtime.i want to create a crystal report dynamically to contain the exact data of gridview including the format it has been displayed in gridview. i want this for printing the whole grid view.
0
9856
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9698
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10916
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10598
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10657
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7836
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4071
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.