1

我有嵌套中继器。我正在使用 3 中继器。用于调用(触发)第一个工作正常并返回 100% 结果的中继器。但是当我呼叫(发射)第二个中继器时。它没有开火。我只想知道如果它是嵌套格式,我应该调用第二个转发器事件吗?或者我不能打电话。如果我可以打电话,你能建议我如何打电话给那个活动吗?

<asp:UpdatePanel ID="RepeaterPanel" runat="server">
                            <ContentTemplate>
                                <div id="mydiv">
                                    <asp:Repeater ID="RpterShareDetails" runat="server" onitemcommand="RpterShareDetails_ItemCommand">
                                        <HeaderTemplate>
                                            <table id="table1">
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <tr>
                                                <td rowspan="2" align="center" class="message_repeater_panel_left">
                                                    <asp:Image ID="Image1" runat="server" ImageUrl="~/ShowImage.ashx" alt="" width="50" height="50" />                                                 
                                                </td>
                                                <td> 

                                                    <embed src='<%# Eval("FilePath") %>' type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="150" height="150" runat="server" Visible='<%# IsVisible(Eval("UploadType"))%>'></embed>                                                    
                                                    <asp:ImageButton ID="ibtnHolder" runat="server" Width="130" Height="130" ImageUrl='<%# Eval("FilePath") %>' Visible='<%# NotVisible(Eval("UploadType"))%>' />

                                                </td>
                                                <td class="textTob">
                                                    <asp:Label ID="UserCommentLabel" runat="server"  Text='<%# Eval("Comments") %>' />                                                    
                                                </td>
                                            </tr>
                                            <tr>
                                                <td valign="bottom">  User Keyword:
                                                    <asp:Label ID="UserKeywordLabel" runat="server" Text='<%# Eval("Keyword") %>' />
                                                </td>                
                                            </tr>
                                            <tr>
                                                <td colspan="2"> 
                                                    <div class="message_repeater_links12">                                                     
                                                        <span>
                                                            <asp:LinkButton ID = "lnkLike" runat = "server" CommandName = "Like">Like</asp:LinkButton>
                                                        </span>
                                                        <span>
                                                            <asp:LinkButton ID="lnk_Comments" runat="server" CommandName="comments" CommandArgument='<%# Eval("Sniffid") %>'>Comments</asp:LinkButton></span>
                                                        <span>   
                                                            <asp:LinkButton ID="lnk_ShowComments" runat="server" CommandName="Show" CommandArgument='<%# Eval("Sniffid") %>'>Show</asp:LinkButton></span>                                    
                                                        <span><a href="#">Share</a></span>                  
                                                        <asp:Panel ID="Add_Comments" runat="server" Width="90%" class="message_repeater_panel_left">
                                                        </asp:Panel>
                                                        <asp:Panel ID="Dis_comments" runat="server" Width="90%" class="message_repeater_panel_left">
                                                        </asp:Panel>
                                                    </div>
                                                </td>
                                            </tr>
                                            <asp:TextBox ID="txt_comment" runat="server" TextMode="MultiLine" Width="300" Visible="false"></asp:TextBox>
                                            <asp:UpdatePanel ID="RepeaterPanel" runat="server" >   
                                                <ContentTemplate>
                                                    <div style="background-color: #C0C0C0">  
                                                        <asp:Repeater ID="Rbt_comments" runat="server" onitemcommand="Rbt_comments_ItemCommand1" >
                                                            <HeaderTemplate>
                                                                <table>
                                                            </HeaderTemplate>
                                                            <ItemTemplate> 
                                                            <%--<div class="message_repeater_panel_left1"  >--%>
                                                            <tr>
                                                                <td>
                                                                    <span >
                                                                        <img src="images/photo_sniff.jpg" width="25px" />
                                                                        <%--<asp:Image ID = "imgCommentPhotos" runat = "server" ImageUrl = "~/AddCommentPhotos.ashx" Width = "25" Height = "25" />--%>
                                                                    </span>
                                                                </td>
                                                                <td>
                                                                    <span><asp:Label ID="UserCommentLabel" runat="server"  Text='<%# Eval("Comments") %>' /></span>
                                                                </td>
                                                            </tr>   
                                                            <%--</div>
                                                            <div class="message_repeater_links12">      --%>                                                    
                                                                <tr>
                                                                    <td>
                                                                        <span><asp:LinkButton ID = "lnkLike" runat = "server" CommandName = "SubLike">Like</asp:LinkButton></span>
                                                                    </td>
                                                                    <td>
                                                                        <span><asp:LinkButton ID="lnk_Comments" runat="server" CommandName="Subcomments">Comments</asp:LinkButton></span>
                                                                    </td>
                                                                    <td>
                                                                        <span><asp:LinkButton ID="lnk_ShowComments" runat="server" CommandName="SubShow">Show</asp:LinkButton></span>
                                                                    </td>
                                                                     <td>
                                                                        <span><a href="#">Share</a></span>
                                                                     </td>
                                                                </tr>                                                                
                                                                <%--</div>--%>  
                                                               <tr>
                                                                <td colspan="4">
                                                                    <asp:TextBox ID = "txtComment" runat = "server" TextMode="MultiLine" Width="300" Visible = "false"></asp:TextBox>
                                                                    <div class="message_repeater_panel_left1"  ></div>
                                                                    <div class="message_repeater_links12"></div>
                                                                </td>
                                                               </tr>                                                                     
                                                                  <ContentTemplate>
                                                                            <div style="background-color: #C0C0C0">
                                                                                <asp:Repeater ID="rptSubComments" runat="server">
                                                                                   <HeaderTemplate>
                                                                                    <table>
                                                                                   </HeaderTemplate>
                                                                                   <ItemTemplate>  
                                                                                        <tr>
                                                                                            <td>
                                                                                                <span >
                                                                                                    <img src="images/Santosh.jpg" width="25px" />
                                                                                                    <%--<asp:Image ID = "imgCommentPhotos" runat = "server" ImageUrl = "~/AddCommentPhotos.ashx" Width = "25" Height = "25" />--%>
                                                                                                </span>
                                                                                            </td>
                                                                                            <td>
                                                                                                <span><asp:Label ID="lblUserSubComment" runat="server"  Text='<%# Eval("Comments") %>' /></span>
                                                                                            </td>
                                                                                        </tr>  
                                                                                   </ItemTemplate>
                                                                                </asp:Repeater>
                                                                            </div>
                                                                        </ContentTemplate>                                                         
                                                            </ItemTemplate>
                                                            <FooterTemplate></table></FooterTemplate>
                                                        </asp:Repeater>
                                                    </div>
                                                </ContentTemplate>
                                            </asp:UpdatePanel>
                                        </ItemTemplate>
                                        <SeparatorTemplate>
                                            <br />
                                        </SeparatorTemplate>
                                        <FooterTemplate>
                                            </table>
                                        </FooterTemplate>

                                    </asp:Repeater>  
                                </div>  
                                <br />  
                                <br />
                                <uc1:CustomPagination ID="RepeaterCustomPagination" runat="server" />                      
                            </ContentTemplate>
                        </asp:UpdatePanel>

protected void Rbt_comments_ItemCommand1(object source, RepeaterCommandEventArgs e) { try { if (e.CommandName == "Subcomments") {

        }
    }
    catch (Exception ex)
    {

    }        
}

protected void RpterShareDetails_ItemCommand(object source, RepeaterCommandEventArgs e)
{
    try
    {
        if (e.CommandName == "Like")
        {
            Int32 UserId = Convert.ToInt32(Session["UserID"].ToString());
            LikeShareDetails(UserId); 
        }
        if (e.CommandName == "comments")
        {
            LinkButton btn = e.CommandSource as LinkButton;
            if (btn != null)
            {
                TextBox txt = (TextBox)e.Item.FindControl("txt_comment");
                txt.Visible = true;
                txt.Attributes.Add("OnKeyPress", "isNumberKey(this,"+ e.CommandArgument.ToString() +")");
                Panel Panel2 = (Panel)e.Item.FindControl("Add_Comments");
                Literal lt = new Literal(); lt.Text = "<br />"; 
                Panel2.Controls.Add(lt);
                Panel2.Controls.Add(txt);
                DataTable dt = new DataTable();
                Repeater gv = (Repeater)e.Item.FindControl("Rbt_comments");
                SqlConnection sqlCon = new SqlConnection();
                sqlCon.ConnectionString = ConfigurationManager.ConnectionStrings["ISnifferDBConnectionString"].ConnectionString;
                //sqlCon.ConnectionString = CommonUtil.GetConfigValue("ISnifferDBConnectionString");
                string strSql = "select Comments from Comments where SniffId in ('" + e.CommandArgument.ToString() + "') order by CommentId desc";
                SqlCommand sqlComd = new SqlCommand(strSql, sqlCon);
                sqlCon.Open();
                SqlDataAdapter sqlAdpt = new SqlDataAdapter();
                sqlAdpt.SelectCommand = sqlComd;
                sqlAdpt.Fill(dt);
                int row = dt.Rows.Count;
                if (row >= 1)
                {
                    gv.DataSource = dt;
                    gv.DataBind();
                }
                else
                {
                    dt.Rows.Add("No Comments");
                    gv.DataSource = dt;
                    gv.DataBind();
                }
                Panel Panel1 = (Panel)e.Item.FindControl("Dis_comments");
                Panel1.Controls.Add(gv);
            }
        }

} }

4

0 回答 0