【发布时间】:2013-04-21 01:29:58
【问题描述】:
在 DataList 中,我从数据库中检索了 cmets。每个评论集都有自己的回复文本框以及用于提交回复的提交按钮。在按钮上,我有一个 click 事件以及 commentID 作为 commandArgument,因此我可以在我的事件中检索评论 ID。我如何引用特定的评论框来检索文本。我的评论容器看起来像:
<div class="replyContainer">
<asp:TextBox ID="replyBox" runat="server"></asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server"
CommandArgument='<%# Eval("cID") %>'
onclick="replyPostClick" />
</div>
我背后的 C# 方法如下所示:
protected void replyPostClick(object sender, EventArgs e)
{
ImageButton btn = sender as ImageButton;
CommentQueries.addComment(objectID, userID, btn.CommandArgument.ToString(), ?);
}
问号是我在评论中传递的地方。有没有办法以某种方式检索相关文本框的文本?
【问题讨论】: