Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 获取转发器标头模板中的复选框_Asp.net_Webforms - Fatal编程技术网

Asp.net 获取转发器标头模板中的复选框

Asp.net 获取转发器标头模板中的复选框,asp.net,webforms,Asp.net,Webforms,我需要访问中继器标题模板中的一些复选框 实际上,它们不在它的范围内,而在后面的代码中,它们是使用关键字“this”访问的。我不能改变所有的代码,我必须保持相同的逻辑。问题是,如果我在中继器的报头内移动复选框,我无法使用“this”找到它们 我有这样的想法: <div id="containerListNotify" style="padding-left: 5px;"> <asp:UpdatePanel ID="UpdatePanelRe

我需要访问中继器标题模板中的一些复选框

实际上,它们不在它的范围内,而在后面的代码中,它们是使用关键字“this”访问的。我不能改变所有的代码,我必须保持相同的逻辑。问题是,如果我在中继器的报头内移动复选框,我无法使用“this”找到它们

我有这样的想法:

<div id="containerListNotify" style="padding-left: 5px;">
                    <asp:UpdatePanel ID="UpdatePanelRepListNotify" runat="server" UpdateMode="Conditional" ClientIDMode="Static">
                        <ContentTemplate>
                            <asp:HiddenField ID="iconsHiddenField" runat="server" ClientIDMode="Static" />
                            <asp:Repeater ID="repListNotify" runat="server" OnItemCommand="RepListNotify_ItemCommand"
                                OnItemDataBound="RepListNotify_ItemCreated">
                                <HeaderTemplate>
                                    <table id="tableCentroMessaggi" class="table table-hover">
                                        <thead>
                                            <tr id="HeaderMessaggi">
                                                <th>
                                                    <%--<asp:Label runat="server" ID="docFascCol" Text='<%#this.getDocFascColText() %>' />--%>
                                                    <div class="dropdown">
                                                        <button onclick="openCloseDocFascDropdown()" class="dropbtn"><asp:Label runat="server" ID="docFascCol" Text='<%#this.getDocFascColText() %>' /><b class="caret"></b></button>                                              
                                                        <div id="docFascDropdown" class="dropdown-content">
                                                            <ul>
                                                                <li>
                                                                    <asp:CheckBox ID="IndexCheckDoc" CssClass="clickableLeftN" Checked="true" runat="server"
                                                                        AutoPostBack="true" OnCheckedChanged="IndexCkbFilterObject_CheckedChanged" /> 
                                                                </li>
                                                                <li>
                                                                    <asp:CheckBox ID="IndexCheckProj" CssClass="clickableLeftN" Checked="true" runat="server"
                                                                        AutoPostBack="true" OnCheckedChanged="IndexCkbFilterObject_CheckedChanged" />
                                                                </li>
                                                                <li>
                                                                    <asp:CheckBox ID="IndexCheckOther" CssClass="clickableLeftN" Checked="true" runat="server"
                                                                        AutoPostBack="true" OnCheckedChanged="IndexCkbFilterObject_CheckedChanged" />
                                                                </li>
                                                            </ul>                                                              
                                                        </div>
                                                    </div>
                                                </th>
                                                <th>

--%>
重要的是,我需要访问它们,即使是在私有方法中,而不仅仅是在事件方法中

我希望有一个解决办法。我想我可以用“FindControl”。 这个.aspx使用母版页


提前感谢。

如果您想访问另一个控件(如Repeater、GridView等)中的控件,则必须使用FindControl和项/行索引。在哪里访问它们并不重要

CheckBox IndexCheckDoc = repListNotify.Controls[0].Controls[0].FindControl("IndexCheckDoc") as CheckBox;
CheckBox IndexCheckProj = repListNotify.Controls[0].Controls[0].FindControl("IndexCheckProj") as CheckBox;
CheckBox IndexCheckOther = repListNotify.Controls[0].Controls[0].FindControl("IndexCheckOther") as CheckBox;

如果要访问另一个控件(如Repeater、GridView等)中的控件,则必须使用
FindControl
和项/行索引。您不能使用
直接访问它们,此
位于Repatter HeaderTemplate中。即使在我没有该项的私有方法中,我也必须访问它们。