SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 73 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

NET



XML Control




DataFile="~/App_Data/ApressBooks.mdb"
SelectCommand="SELECT [ISBN], [Author], [DatePublished], [NumPages], [Price]
FROM [Books]">


Listing 1-14. The XMLControl Web Form Code-Behind Class File
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ControlsBook2Web.Ch01
{
public partial class XMLControls : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoadXMLControl();
}
}
CHAPTER 1 ?–  SERVER CONTROL BASICS 33
private void LoadXMLControl()
{
//Create a DataView from the AccessDataSource control
DataView dv = (DataView)ApressBooksds.Select(new DataSourceSelectArguments());
try
{
dv.Table.TableName = "Books";
DataSet ds = dv.Table.DataSet;
ds.DataSetName = "ApressBooks";
// give the XML control the XML and xslt
Xml1.DocumentContent = ds.GetXml();
Xml1.TransformSource = "ApressBooks.xslt";
}
finally
{
dv.Dispose();
}
}
}
}
The code has a copy of the AccessDataSource ApressBooksds used in the list controls
demonstration to generate a DataSet from the AccessDataSource:
DataView dv = new DataView();
dv = (DataView)ApressBooksds.


Pages:
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6