我有两个嵌套中继器让我们说:外部一个用于发布内容,内部一个用于评论。 外部中继器包含两个Div:一个用于内部中继器,另一个包含一个文本框和一个用于添加评论的按钮。ASP.NET嵌套中继器处理外部中继器内的控件
问题是:当我点击按钮它只是没有任何东西(它必须访问数据库并添加评论),我添加了这个事件,但它根本没有达到它。
void btnComment_Command(object sender, CommandEventArgs e)
{
for (int i = 1; i <= commentRepeater.Items.Count; i++)
{
if (e.CommandName == i.ToString())
{
TextBox txtComment = (TextBox)commentRepeater.Items[i].FindControl("txtComment");
}
}
}
请给我一个帮助。
把一个破发点,看看你是否能得到你的过去循环中的if语句。 – edocetirwi
您可以添加中继器代码吗?我们越能看到,我们就能提供更多帮助。 –
mr.edocetirwi我无法越过命令本身! – Clairooo