📄 categorieslisting.aspx
字号:
<%@ Page Language="C#" MasterPageFile="~/CommonMaster.master" Title="Categories Listing" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml.Serialization" %>
<%@ Import Namespace="CategoriesProxy" %>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
/* Synchronous Web Service Call
CategoriesProxy.CategoriesService obj = new CategoriesProxy.CategoriesService();
gridCategories.DataSource = obj.GetCategories();
gridCategories.DataBind();
* /
/* Asynchronous Web Service Call through the XML file generated by the Windows Service */
string xmlFilePath = @"C:\Projects\Wrox\Categories.xml";
XmlSerializer serializer = new XmlSerializer(typeof(Category[]));
TextReader reader = new StreamReader(xmlFilePath);
//Deserialize the Category and close the TextReader
gridCategories.DataSource = (Category[])serializer.Deserialize(reader);
gridCategories.DataBind();
reader.Close();
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContent" Runat="Server">
<asp:GridView id="gridCategories" style="Z-INDEX: 101; LEFT: 162px; POSITION: absolute; TOP: 147px" runat="server" Height="321px" width="529px" BorderColor="Black" cellpadding="4" Font-Names="Verdana" Font-Size="8pt" AutoGenerateColumns="False" ShowFooter="True">
<FooterStyle ForeColor="Control" BackColor="ActiveCaptionText"></FooterStyle>
<HeaderStyle BackColor="Gray"></HeaderStyle>
<RowStyle BackColor="Control"></RowStyle>
<Columns>
<asp:BoundField DataField="CategoryName" HeaderText="Category Name">
</asp:BoundField>
<asp:HyperLinkField Text="Show all products" DataNavigateUrlFields="CategoryID" DataNavigateUrlFormatString="ProductsListing.aspx?CategoryID={0}" HeaderText="All products in the Category"></asp:HyperLinkField>
</Columns>
</asp:GridView>
</asp:Content>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -