RadioButton?
解决方案 »
- 点击Button,没弹出对话框问题
- 对web.config加密的问题
- asp.net 中关于appdomain.createinstanse的问题
- 为什么我的程序在调试运行时显示:Error while trying to run project:Unableto start debugging.Unable to find microsoft Internet Exp
- !!!!!!!!!!数据不能在网站空间中添加、删除、更新
- 太简单了,可是我不知道
- ***************问一个调用存储过程的问题************
- 为什么用VS2005做的会有这种怪问题?
- RadioButton1_CheckedChanged事件怎么才能把值传到SaveButton_Click<单击事件>事件中==============
- 各位大侠,救命呀,马上给分。不够再加
- 图像瓶颈
- 关于DetailsView控件中RadioButtonList数据绑定问题
<asp:GridView ID="gv" runat="server" OnRowDataBound="gv_RowBound">
<Columns>
<asp:TemplateField HeaderText="客户确认">
<ItemTemplate>
<asp:RadioButton ID="RB_Confim" runat="server" GroupName="name" />
</ItemTemplate>
<ItemStyle HorizontalAlign="center" Width="90px" />
<HeaderStyle HorizontalAlign="Center" Font-Bold="false" Width="90px" />
</asp:TemplateField>
</Columns>
</asp:GridView>
//js
function onClientClick(selectedId)
{
var inputs = document.getElementById("gv").getElementsByTagName("input");//如果你用木板页的话getElementById("gv")就应换成getElementById("<%=gv.ClientID%>"),客户端ID了。
for(var i=0; i <inputs.length; i++)
{
if(inputs[i].type=="radio")
{
if(inputs[i].id==selectedId)
inputs[i].checked = true;
else
inputs[i].checked = false;
}
}
}
//后台
protected void gv_RowBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
RadioButton rb = (RadioButton)e.Row.FindControl("RB_Confim");
if (rb != null)
rb.Attributes.Add("onclick", "onClientClick('" + rb.ClientID + "')");
} }