标题:Repeater 的OnItemCommand 用法,求解...
取消只看楼主
跳过去
Rank: 8Rank: 8
等 级:贵宾
威 望:20
帖 子:282
专家分:976
注 册:2012-8-13
结帖率:91.3%
已结贴  问题点数:10 回复次数:1 
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> &nbsp 楼  &nbsp </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 事件这样写怎么没有触发到啊?求解求解...
搜索更多相关主题的帖子: asp table server border center 
2012-11-19 19:42
跳过去
Rank: 8Rank: 8
等 级:贵宾
威 望:20
帖 子:282
专家分:976
注 册:2012-8-13
得分:0 
问题没解决啊....

光棍中.....
2012-11-21 17:07



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-387598-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.101887 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved