当前位置: 代码迷 >> J# >> DataGrid绑定示范
  详细解决方案

DataGrid绑定示范

热度:410   发布时间:2013-02-25 00:00:00.0
DataGrid绑定示例
<%@ Register TagPrefix="webdiyer" Namespace="Wuqi.Webdiyer" Assembly="AspNetPager" %>
<%@ Page language="c#" Codebehind="ProductManage.aspx.cs" AutoEventWireup="false" Inherits="CN8681.SystemManage.Product.ProductManage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>ProductManage</title>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<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">
<LINK href="../../CSS/UserManageStyle.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<div align="center">
<asp:DataGrid ID="gridProduct" Width="97%" runat="server" AutoGenerateColumns="False" DataKeyField="productID">
<ItemStyle HorizontalAlign="Center" Height="25px" CssClass="ManageGridItem"></ItemStyle>
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Height="25px" CssClass="ManageGridHead"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="productID" Visible=False HeaderText="编号"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="产品信息">
<ItemTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="22%" rowspan="6" align="center"><a href='../../HtmlFile/<%# DataBinder.Eval(Container.DataItem,"FilePath")%>' target="_blank"><img border="0" width="60" height="60" src='../../UpLoad/Product/Thumbnail/<%# DataBinder.Eval(Container.DataItem,"BreviaryPicURL")%>'></a></td>
<td width="44%"><a href='../../HtmlFile/<%# DataBinder.Eval(Container.DataItem,"FilePath")%>' target='_blank'><b><%# DataBinder.Eval(Container.DataItem,"ProductName")%></b></a></td>
<td width="25%" align="center">发布时间:<%# GetDate(DataBinder.Eval(Container.DataItem,"PublishTime").ToString())%></td>
<td width="9%">
</td>
</tr>
<tr>
<td colspan="3">产品介绍:<%# GetSubString(DataBinder.Eval(Container.DataItem,"ProductIntro").ToString(),60)%>...<a href='../../HtmlFile/<%# DataBinder.Eval(Container.DataItem,"FilePath")%>' target="_blank">[详细资料]</a></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Width="80" ItemStyle-HorizontalAlign="Center" HeaderText="推荐设置">
<ItemTemplate>
<a style='CURSOR: hand' onClick="window.open('ProductSet.aspx?ProductID=<%# DataBinder.Eval(Container.DataItem,"ProductID")%>','','width=500,height=300')">推荐设置</a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="删除">
<ItemStyle HorizontalAlign="Center" Width="50px"></ItemStyle>
<ItemTemplate>
  相关解决方案