我有一箇中繼器和內部的標籤我有一個複選框,其中.Checked
屬性我想在中繼器的ItemDataBound事件內設置。問題是args.Item.FindControl("checkboxSelect");
返回我null
。FindControl內部中繼器不工作
下面是HTML:
<asp:Repeater ID="productRepeater" runat="server" OnItemDataBound="productRepeater_ItemDataBound">
<ItemTemplate>
<tr class="hand">
<td class="hyperLink center-text width50px">
<fieldset data-role="controlgroup" id="divCheckbox">
<input type="checkbox" name="checkboxSelect" id="checkboxSelect" class="custom" />
<label for="checkboxSelect">
</label>
</fieldset>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
而且productRepeater_ItemDataBound方法:
protected void productRepeater_ItemDataBound(object sender, RepeaterItemEventArgs args)
{
CheckBox checkboxSelect = (CheckBox)args.Item.FindControl("checkboxSelect");
}
我認爲是什麼原因導致的問題是<fieldset data-role="controlgroup" id="divCheckbox">
,因爲在中繼器(未顯示)的其他<td>
我找到控件沒有問題。有什麼建議如何在當前情況下得到控制?
但CheckBox沒有'RunAt =「Server」'那麼解析器怎麼知道呢? – Belogix