• xml保存图片和读取图片(二)


    3.ImageList.aspx

    <%@ Page language="c#" Codebehind="ImageList.aspx.cs" AutoEventWireup="false" Inherits="WebForm_Question2.ImageList" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
        
    <HEAD>
            
    <title>ImageList</title>
            
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
            
    <meta name="CODE_LANGUAGE" Content="C#">
            
    <meta name="vs_defaultClientScript" content="JavaScript">
            
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        
    </HEAD>
        
    <body MS_POSITIONING="GridLayout">
            
    <form id="Form1" method="post" runat="server">
                
    <TABLE id="Table1" style="Z-INDEX: 102; LEFT: 152px; WIDTH: 694px; POSITION: absolute; TOP: 16px; HEIGHT: 240px"
                    cellSpacing
    ="1" cellPadding="1" width="694" border="1">
                    
    <TR>
                        
    <TD align="center" style="HEIGHT: 34px">
                            
    <asp:Label id="Label1" runat="server" Width="128px" ForeColor="#000040" Font-Bold="True" Font-Size="Larger">图片列表页面</asp:Label></TD>
                    
    </TR>
                    
    <TR>
                        
    <TD style="HEIGHT: 155px">
                            
    <asp:DataGrid id="DG_ImageList" runat="server" AutoGenerateColumns="False" Width="672px" BorderColor="#CCCCCC"
                                BorderStyle
    ="None" BorderWidth="1px" BackColor="White" CellPadding="3" Height="144px" AllowSorting="True"
                                AllowPaging
    ="True" PageSize="5">
                                
    <FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
                                
    <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>
                                
    <ItemStyle ForeColor="#000066"></ItemStyle>
                                
    <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#006699"></HeaderStyle>
                                
    <Columns>
                                    
    <asp:BoundColumn DataField="imageID" HeaderText="图片ID"></asp:BoundColumn>
                                    
    <asp:BoundColumn DataField="imagepath" HeaderText="图片路径"></asp:BoundColumn>
                                    
    <asp:BoundColumn DataField="imageinfo" HeaderText="图片说明"></asp:BoundColumn>
                                    
    <asp:BoundColumn DataField="imagesize" SortExpression="imagesize" HeaderText="图片大小"></asp:BoundColumn>
                                    
    <asp:TemplateColumn>
                                        
    <ItemTemplate>
                                            
    <a href='ImageDisplay.aspx?imageID=<%# DataBinder.Eval(Container.DataItem,"imageID")%>'>
                                                查看
    </a>
                                        
    </ItemTemplate>
                                    
    </asp:TemplateColumn>
                                
    </Columns>
                                
    <PagerStyle HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages"></PagerStyle>
                            
    </asp:DataGrid></TD>
                    
    </TR>
                    
    <TR>
                        
    <TD><FONT face="宋体">
                                
    <asp:HyperLink id="HyperLink2" runat="server" NavigateUrl="index.aspx">主页面</asp:HyperLink>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                
    <asp:HyperLink id="HyperLink1" runat="server" NavigateUrl="ImageList.xml">查看XMl文件</asp:HyperLink>
                            
    </FONT>
                        
    </TD>
                    
    </TR>
                
    </TABLE>
            
    </form>
        
    </body>
    </HTML>
    4.ImageList.aspx.cs
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;

    namespace WebForm_Question2
    {
        
    /// <summary>
        
    /// ImageList 的摘要说明。
        
    /// </summary>

        public class ImageList : System.Web.UI.Page
        
    {
            
    protected System.Web.UI.WebControls.Label Label1;
            
    protected System.Web.UI.WebControls.HyperLink HyperLink2;
            
    protected System.Web.UI.WebControls.HyperLink HyperLink1;
            
    protected System.Web.UI.WebControls.DataGrid DG_ImageList;
        
            
    private void Page_Load(object sender, System.EventArgs e)
            
    {
                
    // 在此处放置用户代码以初始化页面
                if(!IsPostBack)
                
    {
                    ViewState[
    "SortField"= "imagesize"//默认排序字段
                    BindDG();
                }

            }


            
    Web 窗体设计器生成的代码
            
    将ImageList.xml文件绑定DataGrid中
            
    排序事件处理程序
            
    DataGrid分页事件
            
    鼠标经过事件
        }

    }

    作者:青羽
  • 相关阅读:
    观察者模式
    系统高并发网络图书室
    java keytool
    ant 脚本使用技巧
    Unsupported major.minor version 51.0 错误解决方案
    Oracle的网络监听配置
    win8 JDK环境变量不生效
    javax.mail
    xmlrpc
    网络时间同步
  • 原文地址:https://www.cnblogs.com/tenghoo/p/507038.html
Copyright © 2020-2023  润新知