XML, dataset, and DataGrid

Source: Internet
Author: User
(1)
This article describes the usage of XML in ASP. NET. Here, I only show the usage of XML and dataset. In fact, ASP. NET has many methods and objects for XML operations, such as xmldatadocument and xmltextreader. These objects are fully functional and practical.

This article takes the XML used by the adrotator control as an example (for beginners, let's take a look at the usage of the adrotator control) and write an advertisement managementProgram. In this program, the control used by the flying knife is mainly the DataGrid. It can be said that almost all functions of the DataGrid have been used. while paying attention to XML, you can learn how to use the DataGrid at the same time.

First, we will explain some of the methods used in this example:

Dataset mainly uses readxml and writexml methods. Their functions will be known by name, and the flying knife will not be so arrogant. The DataGrid uses many methods and objects. For example, the allowpaging attribute is used for paging and the allowsorting attribute is used for sorting. In this example, all events in the DataGrid are used, such as onitemcommand, oneditcommand, oncancelcommand, and onupdatecommand.

Check the handling of these events carefully.

When you look at the program, think about the number of pages required for the program to write using ASP, this is the advantage of Asp.net.
(2)

<? XML version = "1.0" standalone = "yes"?>
<Advertisements>
<XSD: schema id = "advertisements" targetnamespace = "" xmlns = ""
Xmlns: XSD = "http://www.w3.org/1999/XMLSchema"
Xmlns: msdata = "urn: Schemas-Microsoft-com: XML-msdata">
<XSD: element name = "ad">
<XSD: complextype content = "elementonly">
<XSD: All>
<XSD: element name = "imageurl" minoccurs = "0" type = "XSD: string"/>
<XSD: element name = "navigateurl" minoccurs = "0" type = "XSD: string"/>
<XSD: element name = "alternatetext" minoccurs = "0" type = "XSD: string"/>
<XSD: element name = "keyword" minoccurs = "0" type = "XSD: string"/>
<XSD: element name = "Impressions" minoccurs = "0" type = "XSD: string"/>
</XSD: All>
</XSD: complextype>
</XSD: Element>
<XSD: element name = "advertisements" msdata: isdataset = "true">
<XSD: complextype>
<XSD: Choice maxoccurs = "unbounded">
<XSD: Element ref = "ad"/>
</XSD: Choice>
</XSD: complextype>
</XSD: Element>
</XSD: schema>
<Ad>
<Imageurl> aspcn_bbs1.gifc </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> BBS </keyword>
<Impressions> 50 </impressions>
</Ad>
<Ad>
<Imageurl> aspcn_bbs3.gif </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> BBS </keyword>
<Impressions> 50 </impressions>
</Ad>
<Ad>
<Imageurl> aspcn_bbs2.gifc </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> bbs2 </keyword>
<Impressions> 50 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp/keyword>
<Impressions> 80 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp/keyword>
<Impressions> 80 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp/keyword>
<Impressions> 80 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp/keyword>
<Impressions> 80 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp/keyword>
<Impressions> 80 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp/keyword>
<Impressions> 80 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp/keyword>
<Impressions> 80 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp/keyword>
<Impressions> 80 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp/keyword>
<Impressions> 80 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
Http://www.chinabs.net <navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp </keyword>
<Impressions> 98090 </impressions>
</Ad>
<Ad>
Http://asp.6to23.com/jefenet/webimages/logo.gif <imageurl> </imageurl>
<Navigateurl> </navigateurl>
<Alternatetext> China BS Network </alternatetext>
<Keyword> Asp </keyword>
<Impressions> 98090 </impressions>
</Ad>
<Ad>
Http://wwwaspcn.com <imageurl> </imageurl>
<Navigateurl> http: // </navigateurl>
<Alternatetext> Asp </alternatetext>
<Keyword> </keyword>
<Impressions> </impressions>
</Ad>
</Advertisements>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.