一.在ASPX中创建一个GridView控件,并绑定Radio客户端控件
<asp:GridView ID="GridMediaList" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="GridMediaList_SelectedIndexChanged">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<input name="RadioButton1" type="radio" value='<%# Eval("ID") %>' onclick="setRadio(this);" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
二.添加相关的JavaScript脚本
<script language="javascript" type="text/javascript">
function setRadio(nowRadio)
{
var myForm,objRadio;
myForm=document.forms[0];
for(var i=0;i<myForm.length;i++)
{
if(myForm.elements[i].type=="radio")
{
objRadio=myForm.elements[i];
if(objRadio!=nowRadio && objRadio.name.indexOf("GridView1")>-1 && objRadio.name.indexOf("RadioButton1")>-1)
{
if(objRadio.checked)
{
objRadio.checked=false;
}
}
}
}
}
</script>
来源:https://www.cnblogs.com/zhoufeng/archive/2009/02/28/1400333.html