下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、绑定数据源之后,编辑列-在可用字段中选择ImageField字段,点击添加按钮。在下方选定字段中选择刚才的ImageField字段,在右侧属性里边找到DataImageUrlField,选择相应的数据库字段就可以了。前台:<div style="width:713px;height:500px;"><br/> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" OnPageIndexChanging="
2、Part_PageIndexChanging" CellPadding="4" PageSize="3" AutoGenerateColumns="False" Font-Size="9pt" Width="713px" HorizontalAlign="Center" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidt
3、h="1px" OnRowDataBound="GridView1_RowDataBound" Height="234px"> <RowStyle ForeColor="#003399" BackColor="White" /> <Columns> <asp:BoundField DataField="computerID" HeaderText="电脑型号"/> <asp:BoundField DataFi
4、eld="computerName" HeaderText="电脑名" /> <asp:BoundField DataField="computerPrice" HeaderText="电脑报价" /> <asp:ImageField DataImageUrlField="computerUrl" ControlStyle-Width="180px" ControlStyle-Height="140px" HeaderText=&q
5、uot;电脑图片"><ControlStyle Height="140px" Width="180px"></ControlStyle> </asp:ImageField> <asp:BoundField DataField="computerText" HeaderText="简述" /> </Columns> <EmptyDataTemplate> 抱歉,您要查询的信息不存在! </EmptyDataTemplate&
6、gt; <FooterStyle BackColor="#99CCCC" ForeColor="#003399" /> <PagerStyle BorderColor="Blue" BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" /> <SelectedRowStyle BackColor="#009999" Font-Bold="True
7、" ForeColor="#CCFF99" /> <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" /> </asp:GridView></div>后台:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using Syste
8、m.Web.UI.WebControls;using System.Data;using System.Data.SqlClient;using System.Configuration;public partial class GridView : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) Bind(); protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
9、foreach (TableCell tc in e.Row.Cells) tc.Attributes"style" = "border-color:Black" if (e.Row.RowIndex != -1) int id = GridView1.PageIndex * GridView1.PageSize + e.Row.RowIndex + 1; e.Row.Cells0.Text = id.ToString(); protected void Part_PageIndexChanging(object sender, GridViewPage
10、EventArgs e) GridView1.PageIndex = e.NewPageIndex; Bind(); public void Bind() try SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings"connstr".ConnectionString); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select * from computerImage" cmd.Connection = cn; cn.Open(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataSet ds = new DataSe
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- (新教材)2026人教版三年级下册数学 3.1 多边形 教学课件
- 2026年劳务合同和聘用合同(1篇)
- 2025 网络基础中教育网络的网络教育公平性网络保障案例课件
- 刑法案例分析中犯罪构成要件分析
- 2025 高中信息技术数据与计算之算法的关键路径算法课件
- 高危药品管理策略
- 人力资源开发与管理真题试卷及答案
- 2025 高中信息技术数据与计算之数据在电商用户复购率提升策略中的应用课件
- 2025 高中信息技术数据与计算之数据可视化的流图设计课件
- 2026年北斗三号基准站网观测环境评估与选址规范
- GB/T 25123.2-2018电力牵引轨道机车车辆和公路车辆用旋转电机第2部分:电子变流器供电的交流电动机
- 水电消防安装知识
- 后补埋件计算~~
- 统编版二年级下册读书吧必读书《绿野仙踪》导读、阅读检测【含答案】
- 湖北中医药大学-医学-护理105400专业考研复习题库大全-上(500题)
- 种子类中药课件
- (完整word)a3标准规范试卷模板
- 说明书hid500系列变频调速器使用说明书s1.1(1)
- 软体家具、沙发质量检验及工艺
- 建设项目工程造价管理办法
- 测量管理体系标准宣贯ppt课件
评论
0/150
提交评论