问题描述
- asp.net Repeater中取不到RadioButton的状态在线求解
-
<asp:Repeater ID="Repeater1" runat="server"><ItemTemplate><tr><td colspan="3" class="td1"> <span>ID:</span><asp:Label ID="lb1_1" runat="server" Text='<%#Eval("ID")%>'></asp:Label> <asp:Label ID="lb1" runat="server" Text='<%#Eval("bmmc")%>'></asp:Label> <a href="bmzz1.aspx?id=<%#Eval("ID")%>" target="_blank"><span style="color:#CCFFFF; font-size:12px;font-weight:100">部门职责</span></a></td></tr> <tr><td style=" background-color:White; text-align:center;width:10%;height:40px"><b>分项评价项目</b></td><td style=" background-color:White; text-align:center;width:60%"><b>分项评价指标</b></td><td style="background-color:White; text-align:center; width:30%"><b>评价选项</b></td></tr> <tr style="line-height:10px"><td style=" width:10%; background-color:White" colspan="3"><br /></td></tr> <tr> <td style="background-color:White;text-align:center;width:10%"><asp:Label ID="lbxm1_1" runat="server" Text="制度建设"></asp:Label></td> <td style="background-color:White;text-align:left;width:60%;padding:4px;line-height:23px"><asp:Label ID="lbzb1_1" runat="server" Text="制定的政策、制度考虑高校实际,便于理解,可操作性强。严格按制度管人、办事,不因人而异、乱开口子。"></asp:Label></td> <td style=" background-color:White;text-align:center; width:40%;"> <asp:RadioButton ID="r1_1_1" OnCheckedChanged="r1_1_1_CheckedChanged" Checked="true" runat="server" GroupName="gn_1_1" Text=" 好"/> <asp:RadioButton ID="r1_2_1" runat="server" GroupName="gn_1_1" Text=" 较好"/> <asp:RadioButton ID="r1_3_1" runat="server" GroupName="gn_1_1" Text=" 一般"/> <asp:RadioButton ID="r1_4_1" runat="server" GroupName="gn_1_1" Text=" 差"/></td> </tr></ItemTemplate></asp:Repeater> protected void LinkButton4_Click(object sender, EventArgs e) { int flag=0; RadioButton r1_1_1 = (RadioButton)Repeater1.Items[flag].FindControl("r1_1_1"); RadioButton r1_2_1 = (RadioButton)Repeater1.Items[flag].FindControl("r1_2_1"); RadioButton r1_3_1 = (RadioButton)Repeater1.Items[flag].FindControl("r1_3_1"); RadioButton r1_4_1 = (RadioButton)Repeater1.Items[flag].FindControl("r1_4_1"); if (r1_1_1.Checked == true) { string sql = "update 1_tb set h=h+1 where xh=" + flag + "+1"; DbHelper.ExecuteSql(sql); } else if (r1_2_1.Checked == true) { string sql = "update 1_tb set jh=jh+1 where xh=" + flag + "+1"; DbHelper.ExecuteSql(sql); } else if (r1_3_1.Checked == true) { string sql = "update 1_tb set yb=yb+1 where xh=" + flag + "+1"; DbHelper.ExecuteSql(sql); } else if (r1_4_1.Checked == true) { string sql = "update 1_tb set c=c+1 where xh=" + flag + "+1"; DbHelper.ExecuteSql(sql); } }
,RadioButton明明已经选中,但是后台依然是false,在线等,已经折腾一晚上了
时间: 2024-12-23 09:07:26