У меня проблемы с отображением моего вида сетки, который извлекает информацию из файла. xml. Там нет ошибок, он просто не отображается на веб-странице (index.aspx).
Я наконец-то получил свой код до такой степени, что он не выдает ошибку, но теперь он вообще не отображается на веб-странице.
Мне нужно создать привлекательный index.aspx, но мне просто нужно сначала связать это!
Как только я смог получить эту ссылку, я могу перейти на следующие страницы: css et c.
Вот index.aspx:
<!DOCTYPE html>
<head>
<title>TEST</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="purchaseGrid" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="lblRegistrations_ID" runat="server" Text='<%# Bind ("id")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Full Name">
<ItemTemplate>
<asp:Label ID="lblRegistrations_FullName" runat="server" Text='<%# Bind ("fullName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Email">
<ItemTemplate>
<asp:Label ID="lbl_Email" runat="server" Text='<%# Bind("emailAddress") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Product Name">
<ItemTemplate>
<asp:Label ID="lbl_" runat="server" Text='<%# Bind ("productname") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unit Price">
<ItemTemplate>
<asp:Label ID="lbl_UP" runat="server" Text='<%# Bind ("unitprice") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unit quantity">
<ItemTemplate>
<asp:Label ID="lbl_quantity" runat="server" Text='<%# Bind ("quantity") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</form>
</body>
Вот мой диез:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Data;
public class purchases : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~/purchases.xml"));
purchaseGrid.DataSource = ds;
purchaseGrid.DataBind();
}
}
Вот мой xml до c:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<purchases>
<Purchase>
<id>1</id>
<fullName>Keiran Bernal</fullName>
<emailAddress>k.bernal@gmail.com</emailAddress>
<productname>Lab created engagement ring</productname>
<unitprice>5000</unitprice>
<quantity>1</quantity>
</Purchase>
<Purchase>
<id>2</id>
<fullName>Zachery Guy</fullName>
<emailAddress>z.guy@yahoo.com</emailAddress>
<productname>"flowergirl" necklace</productname>
<unitprice>1000</unitprice>
<quantity>1</quantity>
</Purchase>
<Purchase>
<id>3</id>
<fullName>Cordelia Pierce</fullName>
<emailAddress>c.pierce@outlook.com</emailAddress>
<productname>Semi-precious gem ring</productname>
<unitprice>500</unitprice>
<quantity>2</quantity>
</Purchase>
<Purchase>
<id>4</id>
<fullName>Kiana Hawworth</fullName>
<emailAddress>k.hawworth@bigpond.com</emailAddress>
<productname>Pearl Earrings</productname>
<unitprice>250</unitprice>
<quantity>15</quantity>
</Purchase>
</purchases>