<asp:DataList ID="dlMajor" runat="server" CssClass="dllist" OnItemDataBound="dlMajor_ItemDataBound">
<ItemTemplate>
<div class="div_major">
<%#Eval("major_name")%>
<asp:HiddenField ID="hf_major" runat="server" Value='<%#Eval("major_url") %>'></asp:HiddenField>
</div>
<asp:DataList ID="dlClass" runat="server" CssClass="dllist" OnItemDataBound="dlClass_ItemDataBound">
<ItemTemplate>
<div class="div_class">
<%#Eval("class_name")%>
<asp:HiddenField ID="hf_class" runat="server" Value='<%#Eval("class_url") %>'></asp:HiddenField>
</div>
<ul>
<asp:DataList ID="dlStudent" runat="server" CssClass="dllist" OnItemDataBound="dlClass_ItemDataBound">
<ItemTemplate>
<li>
<div class="num left">
<%#Eval("id")%>、</div> <%#new checkFiles.common.utils().GetInfo(Eval("student_url").ToString())%>
</div>
</li>
</ItemTemplate>
</asp:DataList>
</ul>
</ItemTemplate>
</asp:DataList>
</ItemTemplate>
<FooterTemplate>
<%-- <%if(dlMajor.Items.Count<=0) %>--%>
</FooterTemplate>
</asp:DataList>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using checkFiles.common; namespace checkFiles
{
public partial class center : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string path = "";
if (Request.QueryString["path"] != null && Request.QueryString["path"].ToString().Trim().Length > 0)
{ path = Server.HtmlDecode((Request.QueryString["path"].ToString().Trim())); } if (!IsPostBack)
{
utils util = new utils();
dlMajor.DataSource = util.GetMajorName(path);
dlMajor.DataBind();
if (dlMajor.Items.Count <= 0)
{
this.Panel1.Visible = true;
}
else
{
this.Panel1.Visible = false; }
} }
protected void dlMajor_ItemDataBound(object sender, DataListItemEventArgs e)
{ utils util = new utils(); HiddenField hf_major = (HiddenField)e.Item.FindControl("hf_major");
if (hf_major != null)
{ string path = hf_major.Value.ToString();
if (e.Item.ItemType == ListItemType.EditItem || e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataList dlClass = (DataList)e.Item.FindControl("dlClass");
dlClass.DataSource = util.GetClassName(path);
dlClass.DataBind();
} }
}
protected void dlClass_ItemDataBound(object sender, DataListItemEventArgs e)
{ utils util = new utils(); HiddenField hf_class = (HiddenField)e.Item.FindControl("hf_class");
if (hf_class != null)
{ string path = hf_class.Value.ToString();
if (e.Item.ItemType == ListItemType.EditItem || e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataList dlStudent = (DataList)e.Item.FindControl("dlStudent");
dlStudent.DataSource = util.GetStudentName(path);
dlStudent.DataBind();
}
}
}
}
}
05-08 08:33