0
我試圖設置第一個單選按鈕在直放站作爲託運:Repeater的Container.ItemIndex始終爲0?
<asp:RadioButton runat="server" GroupName="ApplicationOption"
Checked="<%# new Func<bool>(() => {
System.Diagnostics.Debugger.Break();
return !IsPostBack && Container.ItemIndex == 0; })() %>" />
的Debugger.Break調用導致執行在調試模式打破,所以我可以檢查值。每次它中斷時,Container.ItemIndex是0,而我期望它是0,1或2.
中繼器的數據源是3項的列表。我不想使用Code-Behind;即我想將所有內容都保存在標記中。
我缺少什麼?
此外,Repeater本身在DataBound DataList中,其ItemIndex是我需要的實際的。要獲得_that_,請使用:(Container.NamingContainer.NamingContainer作爲DataListItem).ItemIndex'。 –