日期:2014-05-16  浏览次数:20403 次

c#后台往前台输出table(多组radio)如何取值?
cs后台代码
C# code
sb.Append("<table borer='1'>");
        int i;
        for(i=0;i<myds.Tables[0].Rows.Count;i++)
        {
            sb.Append("<tr><td>");
            sb.Append(myds.Tables[0].Rows[0]["title"].ToString());
            sb.Append("</td></tr>");
                sb.Append("<tr><td width='80%'>");
                sb.Append(myds.Tables[0].Rows[i]["name"].ToString());
                sb.Append("</td></tr>");
                sb.Append("<tr><td width='80%'>");
                sb.Append("<input type='radio' id='rdo_id"+i+"' name='rdo_wy" + i + "' value='A' >");
                sb.Append(myds.Tables[0].Rows[i]["A"].ToString());
                sb.Append("</td></tr>");
                sb.Append("<tr><td width='80%'>");
                sb.Append("<input type='radio' id='rdo_id"+i+"' name='rdo_wy" + i + "' value='B' >");
                sb.Append(myds.Tables[0].Rows[i]["B"].ToString());
                sb.Append("</td></tr>");
                sb.Append("<tr><td width='80%'>");
                sb.Append("<input type='radio' id='rdo_id"+i+"' name='rdo_wy" + i + "' value='C' >");
                sb.Append(myds.Tables[0].Rows[i]["C"].ToString());
                sb.Append("</td></tr>");
                sb.Append("<tr><td width='80%'>");
                sb.Append("<input type='radio' id='rdo_id"+i+"' name='rdo_wy" + i + "' value='D' >");
                sb.Append(myds.Tables[0].Rows[i]["D"].ToString());
                sb.Append("</td></tr>");
                sb.Append("<tr><td width='20%' align='right'>");
                sb.Append("<input type='button' id='xs_yc"+i+"' j='"+i+"' value='显示答案' onclick='yc_xs(this);'>");
                sb.Append("</td></tr>");
                sb.Append("<tr ><td width='80%' id='div"+i+"' bgcolor='#F1F8FE'>");
                sb.Append(myds.Tables[0].Rows[i]["zqda"].ToString());
                sb.Append("</td></tr>");
        }
        sb.Append("</table>");
        td2.InnerHtml = sb.ToString();


aspx前台文件
C# code
<form id="form1" runat="server">
    <div class=style11>
        <table cellpadding="0" cellspacing="0" border="0" width="100%" class="tableN" 
            style="font-size: small">
            <tr>
            <td align="left" runat="server" id="td2" ></td>
            </tr>
        </table>
    </div>
    </form>


现在用extjs 取值
JScript code
function tijiaoFn() {
    for (var i = 0; i < 2; i++) {
        var dd = document.all('leftIframe').contentWindow.document;
        var radios = dd.getElementById("rdo_id" + i);
        [color=#FF0000]alert(radios.value);//这边无论如何都是A的值??????????[/color]
    }   
}


------解决方案--------------------
代码掉了...