Hi, I am trying to populate the datagrid with xml datasource. It shows up design view. while populating I get an empty dataset. Below is the code.I would apprecite it if any one can let me now where I am going wrong ? Code : <% @ Import Namespace="System.Data" %><% @ Import Namespace="System.Xml" %><% @ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %><! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">< html xmlns="http://www.w3.org/1999/xhtml">< head runat="server"><title>Untitled Page</title></ head>< script runat="server">Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)Dim myDataSet As New System.Data.DataSet()myDataSet.ReadXml(Server.MapPath( "books.xml"))dgBooksPretty.DataSource = myDataSet.Tables(0) dgBooksPretty.DataBind() End Sub</ script>< body><form id="form2" runat="server"><asp:DataGrid ID="dgBooksPretty" runat="server" AutoGenerateColumns="False" Font-Size="Small" Visible="true"HorizontalAlign="Center" ItemStyle-BackColor="#FFFFCC" AlternatingItemStyle-BackColor="#EEEEEE"><HeaderStyle BackColor="Red" HorizontalAlign="Center" ForeColor="White" Font-Bold="True" /><Columns><asp:BoundColumn HeaderText="Title" DataField="title" /><asp:BoundColumn HeaderText="Author" DataField="author" /><asp:BoundColumn HeaderText="Year" DataField="year" /></Columns></asp:DataGrid></form></ body></ html>
Ria 08
|