0

我在AddPostUserControlbutton里面。我想当内部AddPostUserControl的点击事件触发时找到ID ShowPostsListView。我怎样才能做到这一点 ?user controlbuttonuser control asp:ListView

              <%--add post user control--%>
                <uc1:AddPostUserControl runat="server" id="AddPostUserControl" />

                <%--show posts--%>
                <asp:ListView ID="ShowPostsListView" runat="server">
                    <ItemTemplate>
                        <div class="thisPost">
                            <div class="thisPostAuthor">
                                <%# this.GetCurrentUser(Eval("User")) %>
                            </div>
                            <div class="thisPostHeader">
                                <h3>
                                    <%# Eval("Title") %>
                                </h3>
                                <span class="postDateTime">
                                    <%# Eval("PostDate") %>
                                </span>
                            </div>
                            <div class="thisPostContent">
                                <p>
                                    <%# Eval("PostContent") %>
                                </p>
                            </div>
                        </div>
                    </ItemTemplate>
                </asp:ListView>
4

1 回答 1

1
Page page = HttpContext.Current.Handler as Page
ListView lsv = page.FindControl("ShowPostsListView");
于 2013-03-22T14:04:41.823 回答