日期:2014-05-17 浏览次数:20624 次
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" onpageindexchanging="GridView1_PageIndexChanging" Width="624px"> <PagerSettings FirstPageText="第一页" LastPageText="最后页" NextPageText="下一页" Position="TopAndBottom" PreviousPageText="上一页" /> <Columns> <asp:TemplateField> <ItemTemplate> <ima alt="" src='〈%# DataBinder.Eval(Container, "DataItem.filePath", "{0}") %>'/> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <img src="./imagebase/1.jpg" alt="" /> </asp:Content>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Net; using System.Text.RegularExpressions; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("filePath"); DataRow dr = dt.NewRow(); dr["filePath"] = "./imagesbase/1.jpg"; dt.Rows.Add(dr); this.GridView1.DataSource = dt; this.GridView1.DataBind(); } protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { } }
<div> <table cellspacing="0" rules="all" border="1" id="MainContent_GridView1" style="width:624px;border-collapse:collapse;"> <tr> <th scope="col"> </th> </tr><tr> <td> <ima alt="" src='〈%# DataBinder.Eval(Container, "DataItem.filePath", "{0}") %>'/> </td> </tr> </table> </div> <img src="./imagebase/1.jpg" alt="" />
<html> <head> <title>Bad Request</title> <style> body {font-family:"Verdana";font-w