简体   繁体   English

用户控件外部的搜索控件

[英]Search Control Outside Of The UserControl

I have button inside user control AddPostUserControl . 我在user control AddPostUserControl中button I want when the click event of the button inside user control AddPostUserControl fire to find asp:ListView with ID ShowPostsListView . 我希望在单击事件的button里面user control AddPostUserControl火灾找到asp:ListView与ID ShowPostsListView。 How can I do this ? 我怎样才能做到这一点 ?

              <%--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>
Page page = HttpContext.Current.Handler as Page
ListView lsv = page.FindControl("ShowPostsListView");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM