ASP.NET 無法讀取 checkbox/radiobutton是否checked

本帖最後由 inori 於 2016-8-9 17:55 編輯

我係個GridViewTable.Rows入面想搵個checkbox/radiobutto有冇check到,
但我試極佢return出黎都係False
  1. <ItemTemplate>
  2. <asp:Label ID="Label2" runat="server" Text="Y" ></asp:Label>
  3. <asp:RadioButton ID="RadioButtonItemY" runat="server" GroupName="RadioButtonGroup1"/>
  4. <asp:Label ID="Label3" runat="server" Text="N" ></asp:Label>
  5. <asp:RadioButton ID="RadioButtonItemN" runat="server" GroupName="RadioButtonGroup1" Checked=true/>
  6. </ItemTemplate>
複製代碼
  1. Dim rb As RadioButton = CType(row.Cells(0).FindControl("RadioButtonItemY"), RadioButton)
  2. Dim lb As Label = CType(row.FindControl("Label2"), Label)
複製代碼
rb.Checked 永遠都係False
我應該冇指錯object?因為我囉隔離個label2都囉到個Y出黎

但最奇怪既係我用vs2010行debug係localhost行係冇問題,認到checked的,
不過放係部iis server行就永遠都係False

其實係唔係某個.net ver既 bug黎?