Repeater 的OnItemCommand 用法,求解...
前台:<asp:Repeater ID="rptmessage" runat="server" OnItemDataBound="rptmessage_OnItemDataBound" OnItemCommand="rptMessage_ItemCommand">
<ItemTemplate>
<asp:UpdatePanel ID="udtenl" runat="server">
<ContentTemplate>
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td style=" width:200px; text-align:center"><%#Eval("MessageTime")%></td>
<td style=" width:590px; text-align:right;">第 :<asp:Literal ID="litvLZ" runat="server"></asp:Literal>   楼   </td>
</tr>
<tr>
<td valign="top" align="center">
<asp:Image Width="80px" Height="90px" ID="image" runat="server" ImageUrl='<%#Eval("UserImage") %>'/>
</td>
<td valign="top"><%#Eval("MessageText")%></td>
</tr>
<tr>
<td style=" width:180px; text-align:center;"><a href='KJisUser.aspx?KJuesrID=<%#Eval("UserID") %>'><%#Eval("UserName")%></a></td>
<td style=" text-align:right;">
<asp:Label ID="labmeesageID" Text='<%#Eval("MessageID") %>' runat="server" style="display:none;"></asp:Label>
<input type="button" value="回 复" onclick='$("#di<%#Eval("MessageID") %>").show();' />
</td></tr>
<tr> <td colspan="2" align="right">
<div id="di<%#Eval("MessageID")%>" style="display:none; margin-right:10px;width:700px;height:100px;">
<table>
<tr>
<td>
<asp:TextBox ID="txtMessageComment" runat="server" style="width:600px; height:60px;"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="bntAddhuifu" runat="server" Text="确定" CommandName="CommuntAdd" />
<input id="bntquxiao" type="button" value="取 消" onclick='$("#di<%#Eval("MessageID")%>").hide();' />
</td>
</tr>
</table>
</div>
<asp:Repeater ID="rpthuifu" runat="server">
<ItemTemplate>
<table border="1" style=" margin-right:10px; background-color:#eff3f3;">
<tr>
<td align="center" style=" width:200px;"><%#Eval("CommentTime")%></td>
<td style=" width:550px;"></td>
</tr>
<tr>
<td align="center" valign="top">
<asp:Image Width="70px" Height="80px" ID="image" runat="server" ImageUrl='<%#Eval("UserImage") %>' />
<td valign="top" align="left"><%#Eval("CommentMessage")%></td>
</tr>
<tr>
<td align="center"><a href='KJisUser.aspx?KJuesrID=<%#Eval("UserID") %>'><%#Eval("UserName")%></a></td>
<td></td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:Repeater>
后台:
public void rptMessage_ItemCommand(object sender, RepeaterCommandEventArgs e)
{
if ( == "CommuntAdd")
{
int userID = Convert.ToInt32(Session["userid"]); //登录者的ID
int privateID = Convert.ToInt32(Request["KJuesrID"]); //当前空间用户的ID(对方)
int MessageID = Convert.ToInt32(Session["MessageID"]); //留言的ID
TextBox txtmessage = e.Item.FindControl("txtMessageComment") as TextBox;//回复的内容
CommentMessage comment = new CommentMessage();
comment.UserID = userID;
comment.privateID = privateID;
comment.MessageID = MessageID;
= txtmessage.Text;
int i = user.AddCommentMessage(comment);
if (i > 0)
{
getmessagelist();
}
}
}
两个Repeater 嵌套显示留言和回复 然后要添加回复的时候 Repeater 的rptMessage_ItemCommand 事件这样写怎么没有触发到啊?求解求解...