<%@ page language="C#" autoeventwireup="true" inherits="admin_product_prolist, webpages" %>

<!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 runat="server">
    <title>无标题页</title>
    <meta name="Author"  content="webpages CMS" />
<link rel="stylesheet" href="../master.css" type="text/css">
<script type="text/javascript">
//把事件放在onload里，因为我不知道JS如果直接写到这儿是不是会等页面加载完才执行
//使用< . %.=.%.>方式输出GridView的ID是因为某些情况下（如使用了MasterPage）会造成HTML中ID的变化
//颜色值推荐使用Hex，如 #f00 或 #ff0000
window.onload = function()
{
GridViewColor("<%=GridView1.ClientID%>","#ffffff","#eeeeee","#158AFF","#158AFF");
}

//参数依次为（后两个如果指定为空值，则不会发生相应的事件）：
//GridView ID, 正常行背景色,交替行背景色,鼠标指向行背景色,鼠标点击后背景色
function GridViewColor(GridViewId, NormalColor, AlterColor, HoverColor, SelectColor){
//获取所有要控制的行
var AllRows = document.getElementById(GridViewId).getElementsByTagName("tr");

//设置每一行的背景色和事件，循环从1开始而非0，可以避开表头那一行
for(var i=3; i<AllRows.length-2; i++){
//设定本行默认的背景色
AllRows[i].style.background = i%2==0?NormalColor:AlterColor;

//如果指定了鼠标指向的背景色，则添加onmouseover/onmouseout事件
//处于选中状态的行发生这两个事件时不改变颜色
if(HoverColor != ""){
AllRows[i].onmouseover = function(){if(!this.selected)this.style.background = HoverColor;}
if(i%2 == 0){
AllRows[i].onmouseout = function(){if(!this.selected)this.style.background = NormalColor;}
}
else{
AllRows[i].onmouseout = function(){if(!this.selected)this.style.background = AlterColor;}
}
}

//如果指定了鼠标点击的背景色，则添加onclick事件
//在事件响应中修改被点击行的选中状态
if(SelectColor != ""){
AllRows[i].onclick = function(){
this.style.background = this.style.background==SelectColor?HoverColor:SelectColor;
this.selected = !this.selected;
}
}
}
}
</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999" >
<tr><td>
<!--开始表格 -->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#D1EAFE" >
  <tr>
    <td colspan="2" align="center"><strong>产品列表以及查询</strong></td>
    </tr>
  <tr>
    <td width="120" align="right" style="height: 14px">关键字：</td>
    <td style="height: 14px" >&nbsp;
        <asp:TextBox ID="keywords" runat="server" Width="171px"></asp:TextBox>
        <asp:DropDownList ID="seclist" runat="server">
            <asp:ListItem Value="1">按名称</asp:ListItem>
            <asp:ListItem Value="2">按描述</asp:ListItem>
        </asp:DropDownList>&nbsp;<asp:Button ID="Button1" runat="server" Text="确 定" OnClick="Button1_Click" /></td>
  </tr>
  <tr>
 <td colspan="2" align="center" style="height: 12px">&nbsp;</td>
  </tr>  
    <tr>
        <td align="center" colspan="2" style="text-align: center">
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" DataSourceID="datas1" Width="100%" DataKeyNames="id" DataMember="DefaultView" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" PageSize="15" OnLoad="GridView1_Load" OnRowCommand="GridView1_RowCommand">
                <Columns>
                    <asp:TemplateField HeaderText="id" InsertVisible="False" SortExpression="id">
                        <ItemTemplate>
                            <asp:Label ID="Label5" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="50px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="产品名称" SortExpression="proname">
                        <ItemTemplate>
                            <asp:Label ID="proname" runat="server" Text='<%# Bind("proname") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="300px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="价格" SortExpression="projiage">
                        <EditItemTemplate>
                            <asp:TextBox ID="editjiage" runat="server" Text='<%# Bind("projiage") %>' Width="80"></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="itemjiage" runat="server" Text='<%# Bind("projiage") %>' Width="80"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="点击数" SortExpression="hot">
                        <EditItemTemplate>
                            <asp:TextBox ID="edithot" runat="server" Text='<%# Bind("hot") %>' Width="50"></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="itemhot" runat="server" Text='<%# Bind("hot") %>' Width="50"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="审核" SortExpression="shenghe">
                        <EditItemTemplate>
                            <asp:CheckBox ID="editcheck" runat="server" Checked='<%# Bind("shenghe") %>'  Width="50"/>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="itemcheck" runat="server" Checked='<%# Bind("shenghe") %>' Enabled="false"  Width="50"/>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="推荐" SortExpression="tuijian">
                        <EditItemTemplate>
                            <asp:CheckBox ID="editcheck2" runat="server" Checked='<%# Bind("tuijian") %>'   Width="50"/>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="itemcheck2" runat="server" Checked='<%# Bind("tuijian") %>' Enabled="false"   Width="50"/>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="日期" SortExpression="date1">
                        <ItemTemplate>
                            <asp:Label ID="itemdate" runat="server" Text='<%# Bind("date1") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <EditItemTemplate>
                            <asp:LinkButton ID="Update1" runat="server" CausesValidation="True" CommandName="Update"
                                Text="更新"></asp:LinkButton>
                            <asp:LinkButton ID="Update01" runat="server" CausesValidation="False" CommandName="Cancel"
                                Text="取消"></asp:LinkButton>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:LinkButton ID="Edit001" runat="server" CausesValidation="False" CommandName="Edit"
                                Text="更改"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                        <asp:Label ID="xgms" runat="server" Text='' ><a href="editpro.aspx?id=<%# Eval("id") %> " target="_blank">修改 </a></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="Select002" runat="server" CausesValidation="False" OnClientClick="JavaScript:return confirm('确认删除么？');" CommandName="Delete"
                                Text="删除"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <RowStyle ForeColor="#000066" />
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <PagerStyle BackColor="CornflowerBlue" ForeColor="#000066" HorizontalAlign="Center" BorderColor="#E0E0E0" Font-Bold="True" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="False" ForeColor="White" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" Font-Size="12pt" />
                    <PagerSettings FirstPageText="首页" LastPageText="最后一页"
                    NextPageText="下一页" Position="TopAndBottom" PreviousPageText="上一页" />
            </asp:GridView>
            <asp:SqlDataSource ID="datas1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" >
                <DeleteParameters>
                    <asp:ControlParameter ControlID="GridView1" Name="id" PropertyName="SelectedValue" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:ControlParameter ControlID="GridView1" Name="projiage" PropertyName="SelectedValue" />
                    <asp:ControlParameter ControlID="GridView1" Name="hot" PropertyName="SelectedValue" />
                    <asp:ControlParameter ControlID="GridView1" Name="shenghe" PropertyName="SelectedValue" />
                    <asp:ControlParameter ControlID="GridView1" Name="tuijian" PropertyName="SelectedValue" />
                    <asp:ControlParameter ControlID="GridView1" Name="id" PropertyName="SelectedValue" />
                </UpdateParameters>
            </asp:SqlDataSource>
        </td>
    </tr>
    <tr>
        <td align="center" colspan="2">
        </td>
    </tr>
  
  
  
  
</table>
<!--结束表格 -->
</td></tr></table>		    
    
    </div>
    </form>
</body>
</html>
