| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 884 人关注过本帖
标题:GridView中应用模板列(image)
只看楼主 加入收藏
梦的守护神
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2006-5-25
收藏
 问题点数:0 回复次数:2 
GridView中应用模板列(image)
GridView中应用模板列增加一个image的控件 为什么就不能把数据库中的图片读取到GridView上

高手门 发表你们的见解
搜索更多相关主题的帖子: GridView image 模板 应用 
2007-03-08 15:41
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
收藏
得分:0 
看一下你绑定的代码...

飘过~~
2007-03-08 16:49
梦的守护神
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2006-5-25
收藏
得分:0 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TbBillmg.aspx.cs" Inherits="tieba_mg_TbBillmg" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>广告管理版块</title>
 <link href="../../CSS/mgcss.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
&nbsp;<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:xhhyconn %>"
DeleteCommand="DELETE FROM [QqjyTbAds] WHERE [AdsID] = @original_AdsID "
InsertCommand="INSERT INTO [QqjyTbAds] ([AdsUrl], [AdsImage], [AdsWord], [AdsText], [Adsfrom], [AdsPeriod], [AdsAddDate], [AdsAddUser], [AdsPriority], [AdsStatus]) VALUES (@AdsUrl, @AdsImage, @AdsWord, @AdsText, @Adsfrom, @AdsPeriod, @AdsAddDate, @AdsAddUser, @AdsPriority, @AdsStatus)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [QqjyTbAds]"
UpdateCommand="UPDATE [QqjyTbAds] SET [AdsUrl] = @AdsUrl, [AdsImage] = @AdsImage, [AdsWord] = @AdsWord, [AdsText] = @AdsText, [Adsfrom] = @Adsfrom, [AdsPeriod] = @AdsPeriod, [AdsAddDate] = @AdsAddDate, [AdsAddUser] = @AdsAddUser, [AdsPriority] = @AdsPriority, [AdsStatus] = @AdsStatus WHERE [AdsID] = @original_AdsID ">
<DeleteParameters>
<asp:Parameter Name="original_AdsID" Type="Int32" />
<asp:Parameter Name="original_AdsUrl" Type="String" />
<asp:Parameter Name="original_AdsImage" Type="String" />
<asp:Parameter Name="original_AdsWord" Type="String" />
<asp:Parameter Name="original_AdsText" Type="String" />
<asp:Parameter Name="original_Adsfrom" Type="String" />
<asp:Parameter Name="original_AdsPeriod" Type="Int32" />
<asp:Parameter Name="original_AdsAddDate" Type="DateTime" />
<asp:Parameter Name="original_AdsAddUser" Type="String" />
<asp:Parameter Name="original_AdsPriority" Type="Int32" />
<asp:Parameter Name="original_AdsStatus" Type="Boolean" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="AdsUrl" Type="String" />
<asp:Parameter Name="AdsImage" Type="String" />
<asp:Parameter Name="AdsWord" Type="String" />
<asp:Parameter Name="AdsText" Type="String" />
<asp:Parameter Name="Adsfrom" Type="String" />
<asp:Parameter Name="AdsPeriod" Type="Int32" />
<asp:Parameter Name="AdsAddDate" Type="DateTime" />
<asp:Parameter Name="AdsAddUser" Type="String" />
<asp:Parameter Name="AdsPriority" Type="Int32" />
<asp:Parameter Name="AdsStatus" Type="Boolean" />
<asp:Parameter Name="original_AdsID" Type="Int32" />
<asp:Parameter Name="original_AdsUrl" Type="String" />
<asp:Parameter Name="original_AdsImage" Type="String" />
<asp:Parameter Name="original_AdsWord" Type="String" />
<asp:Parameter Name="original_AdsText" Type="String" />
<asp:Parameter Name="original_Adsfrom" Type="String" />
<asp:Parameter Name="original_AdsPeriod" Type="Int32" />
<asp:Parameter Name="original_AdsAddDate" Type="DateTime" />
<asp:Parameter Name="original_AdsAddUser" Type="String" />
<asp:Parameter Name="original_AdsPriority" Type="Int32" />
<asp:Parameter Name="original_AdsStatus" Type="Boolean" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="AdsUrl" Type="String" />
<asp:Parameter Name="AdsImage" Type="String" />
<asp:Parameter Name="AdsWord" Type="String" />
<asp:Parameter Name="AdsText" Type="String" />
<asp:Parameter Name="Adsfrom" Type="String" />
<asp:Parameter Name="AdsPeriod" Type="Int32" />
<asp:Parameter Name="AdsAddDate" Type="DateTime" />
<asp:Parameter Name="AdsAddUser" Type="String" />
<asp:Parameter Name="AdsPriority" Type="Int32" />
<asp:Parameter Name="AdsStatus" Type="Boolean" />
</InsertParameters>
</asp:SqlDataSource>
<table class="mg1_table" cellspacing="1" border="0" align="center" >
<tr>
<td class="mg_td_top" colspan="2" align="center" style="height: 20px"> 广告管理版块</td>
</tr>
<tr>
<td colspan="2" style="height: 20px">
广告编号<asp:TextBox ID="TextBox2" runat="server" Width="83px"></asp:TextBox>
有效期<asp:TextBox ID="TextBox3" runat="server" Width="83px"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox3"
ErrorMessage="只能为数字" ValidationExpression="^([1-9]\d+|\d)(\.\d+)?$"></asp:RegularExpressionValidator>添加人<asp:TextBox
ID="TextBox4" runat="server" Width="83px"></asp:TextBox>优先级<asp:DropDownList ID="DropDownList2"
runat="server">
<asp:ListItem></asp:ListItem>
<asp:ListItem>0</asp:ListItem>
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>状态
<asp:DropDownList ID="DropDownList3" runat="server">
<asp:ListItem></asp:ListItem>
<asp:ListItem Value="1">启用</asp:ListItem>
<asp:ListItem Value="0">禁用</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="查找" /></td>
</tr>
<tr>
<td colspan="2" rowspan="3">
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="100%" DataKeyNames="AdsID" OnRowDataBound="GridView1_RowDataBound" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDeleted="GridView1_RowDeleted" OnRowEditing="GridView1_RowEditing" OnRowUpdated="GridView1_RowUpdated" PageSize="5" >
<Columns>
<asp:TemplateField HeaderText="编号" SortExpression="AdsID">
<EditItemTemplate>
<asp:CheckBox ID="CB" runat="server" Text='<%# Bind("AdsID") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="CB" runat="server" Text='<%# Bind("AdsID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="AdsUrl" HeaderText="连接地址" SortExpression="AdsUrl" ConvertEmptyStringToNull="False" >
<ControlStyle Width="83px" />
</asp:BoundField>
<asp:TemplateField HeaderText="图片" SortExpression="AdsImage">
<EditItemTemplate>
&nbsp;<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("AdsImage", "{2}") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("AdsImage") %>' />
</ItemTemplate>
<ControlStyle Width="83px" />
</asp:TemplateField>
<asp:BoundField DataField="AdsWord" HeaderText="文字" SortExpression="AdsWord" />
<asp:BoundField DataField="AdsText" HeaderText="说明文字" SortExpression="AdsText" />
<asp:BoundField DataField="Adsfrom" HeaderText="来源" SortExpression="Adsfrom" />
<asp:BoundField DataField="AdsPeriod" HeaderText="有效期" SortExpression="AdsPeriod" />
<asp:BoundField DataField="AdsAddDate" HeaderText="添加日期" SortExpression="AdsAddDate" ReadOnly="True" />
<asp:BoundField DataField="AdsAddUser" HeaderText="添加人" SortExpression="AdsAddUser" ReadOnly="True" />
<asp:TemplateField FooterText="AdsPriority" HeaderText="优先级" SortExpression="AdsPriority">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("AdsPriority") %>'>
<asp:ListItem Selected="True">0</asp:ListItem>
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("AdsPriority") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CheckBoxField DataField="AdsStatus" HeaderText="状态" SortExpression="AdsStatus" />
<asp:CommandField EditText="修改" HeaderText="修改" ShowEditButton="True" />
<asp:CommandField HeaderText="删除" ShowDeleteButton="True" />
</Columns>
</asp:GridView>
&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="全选" />&nbsp;<asp:Button
ID="Button3" runat="server" OnClick="Button3_Click" Text="取消选择" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="批量删除" />
<asp:Button ID="AddUrl" runat="server" Text="添加新广告" OnClick="AddUrl_Click" />
&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>

红色的就是 我的帮定

2007-03-08 16:59
快速回复:GridView中应用模板列(image)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032756 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved