首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

急在Repeater中,单选按钮选中之后,但是通过断点调试,单选按钮的checked属性还是为false

2013-01-11 
急急急!!!在Repeater中,单选按钮选中以后,但是通过断点调试,单选按钮的checked属性还是为false在aspx中的

急急急!!!在Repeater中,单选按钮选中以后,但是通过断点调试,单选按钮的checked属性还是为false
在aspx中的代码为      <asp:Repeater ID="Users" runat="server">
    <ItemTemplate>  <h1> 
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Name")%>' >
       <%#Eval("Name")%></asp:Label> 
 <asp:RadioButton ID="rb1" runat="server"  Text="好"   GroupName="1"  />
<asp:RadioButton ID="rb2" runat="server" Text="比较好"   GroupName="1" />
  <asp:RadioButton ID="rb3" runat="server"  Text="一般"   GroupName="1" />
  <asp:RadioButton ID="rb4" runat="server" Text="差"  GroupName="1" />
                </h1></ItemTemplate>
                </asp:Repeater>


 后台代码为 foreach (RepeaterItem item in Users.Items){
                Label lbl = (Label)item.FindControl("Label1");
                RadioButton rdo1 = (RadioButton)item.FindControl("rb1");
                RadioButton rdo2 = (RadioButton)item.FindControl("rb2");
                RadioButton rdo3 = (RadioButton)item.FindControl("rb3");
                RadioButton rdo4 = (RadioButton)item.FindControl("rb4");  
} 我通过断点调试以后,rdo1的checked属性一直为false
在线等。。。。。
[解决办法]
if(!isXXXX)
{}
[解决办法]
if(!IsPostback)
{
Users.DataSource//数据源绑定放在!IsPostback里面
}

热点排行