日期:2014-05-18 浏览次数:21069 次
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 BLL; namespace TestWeb { public partial class _Default : System.Web.UI.Page { private BLL.Bll bll = new Bll(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataBindQuestionDataList(); } } /// <summary> /// 绑定问题list控件 /// </summary> private void DataBindQuestionDataList() { this.DataList1.DataSource = bll.SearchQuestion(); this.DataList1.DataBind(); } public DataSet BindReply(Guid id) { return bll.SearchReply(id); } protected void dlReply_Load(object sender, EventArgs e) { } } }
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestWeb._Default" %> <!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> </head> <body> <form id="form1" runat="server"> <table border="0" width="100%" cellpadding="1" cellspacing="1"> <tr> <td> <label>问题主旨:</label> <asp:Label ID="labSubject" runat="server"></asp:Label> </td> </tr> <tr> <td><asp:DataList ID="DataList1" runat="server" > <ItemTemplate> <table border="0" cellpadding="1"> <tr> <td style="width:60px"> <asp:Label ID="labTitle" runat="server" Text="问题:"></asp:Label> </td> <td style="width:340px"> <asp:Label ID="labQuestion" runat="server" Text='<%# Bind("Content") %>'></asp:Label> </td> <td style="width: 60px"> </td> </tr> <tr> <td> <asp:DataList ID="dlReply" runat="server" DataSource='<%# BindReply((Guid)DataBinder.Eval(Container,"DataItem.CvsCmtID")) %>' OnLoad="dlReply_Load"> <ItemTemplate> <table border="0" > <tr> <td> <label>回覆:</label>