62,050
社区成员
发帖
与我相关
我的任务
分享
protected void GuestBookDL1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (ReplyB!=null)
{
ReplyB.Click += new EventHandler(btn_Click);
}
}
private void btn_Click(object sender, EventArgs e)
{
Response.Write("hello");
}
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class GuestBook : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.GuestBookDL1.DataSource = Article.GetDataTableOtherArticleByBoardId(1);
this.DataBind();
}
protected void GuestBookDL1_ItemDataBound(object sender, DataListItemEventArgs e)
{
int ArtId = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ArtId"));
DataList GuestBookDL2 = (DataList)e.Item.FindControl("GuestBookDL2");
if (GuestBookDL2!=null)
{
GuestBookDL2.DataSource = Article.GetDataTableRepley(ArtId);
GuestBookDL2.DataBind();
}
TextBox ReplyT = (TextBox)e.Item.FindControl("ReplyT");
Button ReplyB = (Button)e.Item.FindControl("ReplyB");
if (ReplyB!=null)
{
ReplyB.Click += new EventHandler(ReplyB_Click);
}
}
void ReplyB_Click(object sender, EventArgs e)
{
Response.Write("Hello");
throw new NotImplementedException();
}
}