HTML Code:

 

代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="tlrrList.aspx.cs" Inherits="byd.EquipmentManager.tlrrList" %>

<!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>
<script type="text/javascript" src="../Scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
var showDiv=function(img){
var td=img.parentNode;
var tr=td.parentNode;
var thead=tr.parentNode;
var tbody=thead.nextSibling;
var tbodystyle=tbody.style;
var picName=img.src;
picName
=picName.substring(picName.lastIndexOf("/")+1);

img.src
=picName.toLowerCase()=="close.gif"?"../Images/open.gif":"../Images/close.gif";
tbodystyle.display
=tbodystyle.display=="none"?"":"none";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<table cellpadding="0" cellspacing="0" border="1" width="100%;">
<tr>
<td align="right"><a href="tlrr.aspx">New TLRR</a></td>
</tr>
<tr><td>
<asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False" Width="100%"
CellPadding
="4" ForeColor="#333333" GridLines="None">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<table cellpadding="0" cellspacing="0" border="1" width="100%;">
<thead>
<tr>
<td style="width:15%" align="center">msid</td>
<td style="width:15%" align="center">session id</td>
<td style="width:15%" align="center">request_id</td>
<td style="width:15%" align="center">time</td>
<td style="width:15%" align="center">status</td>
<td style="width:15%" align="center">action</td>
</tr>
</thead>
</table>
</HeaderTemplate>
<ItemTemplate>
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<thead>
<tr>
<td>
<img onclick="showDiv(this)" style="cursor:hand" src="../Images/open.gif" alt="" />
<%#Eval("msid_mdn")%>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<asp:Repeater ID="rptDetail" runat="server" DataSource='<%# ((System.Data.DataRowView)Container.DataItem).CreateChildView("tableRelation") %>'
DataMember="msid_mdn" OnItemCommand="rptDetail_ItemCommand">
<HeaderTemplate>
<table cellpadding="0" cellspacing="0" border="1" width="100%;">
<tr>
<td colspan="5" style="height:5px;"></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="width:15%" align="center"><asp:Label runat="server" ID="msid" Text='<%# DataBinder.Eval(Container.DataItem,"msid")%>'></asp:Label></td>
<td style="width:15%" align="center"><%# DataBinder.Eval(Container.DataItem,"session_id")%></td>
<td style="width:15%" align="center"><%# DataBinder.Eval(Container.DataItem,"request_id")%></td>
<td style="width:15%" align="center"><%# DataBinder.Eval(Container.DataItem,"time")%></td>
<td style="width:15%" align="center">
<asp:DropDownList ID="ddlStatus" runat="server">
<asp:ListItem Text="select" Value="1"></asp:ListItem>
<asp:ListItem Text="view" Value="2"></asp:ListItem>
<asp:ListItem Text="fellow" Value="3"></asp:ListItem>
</asp:DropDownList>&nbsp;&nbsp;<asp:LinkButton ID="lbnGO" runat="server" CommandName="GO" Font-Underline="false">GO</asp:LinkButton>
</td>
<td style="width:15%" align="center"></td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</tbody>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</td></tr>
</table>
</form>
</body>
</html>

CS Code:

 

代码
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DataAccess;

namespace byd.EquipmentManager
{
public partial class tlrrList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind();
}
}

private void Bind()
{
DataSet ds
= new DataSet();
using (EntityDAO edo = new EntityDAO())
{
ds
= edo.Get_TLRRList();

DataColumn father
= ds.Tables[0].Columns["msid_mdn"];
DataColumn child
= ds.Tables[1].Columns["msid"];
DataRelation tableRelation
= new DataRelation("tableRelation", father, child, false);
ds.Relations.Add(tableRelation);

gvList.DataSource
= ds.Tables[0];
gvList.DataBind();
}
}

protected void rptDetail_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "GO")
{
DropDownList ddl
= (DropDownList)e.Item.FindControl("ddlStatus");
string val = ddl.SelectedValue;
Label lbl
= (Label)e.Item.FindControl("msid");
string msid = lbl.Text.ToString();
if (val == "1")
{
Response.Redirect(
"tlrr.aspx?ddlStatus=" + msid);
}
}
}
}
}

 

posted on 2010-06-04 18:18  ssyang  阅读(206)  评论(0编辑  收藏  举报