RadioButtonList的选择确认~!

不说废话,看代码~!

 

        protected void Page_Load(object sender, EventArgs e)
        {
            
this.RadioButtonList1.Items[1].Attributes.Add("onclick""if(!confirm('您真的要点我吗?')){document.getElementById('" + this.RadioButtonList1.ClientID+ "_0').checked=true;event.returnValue=false;}");

        }

 

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication5._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">
    
<title>无标题页</title>

</head>

<body>
    
<form id="form1" runat="server">
    
<div>
        
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
            
<asp:ListItem Selected="True">1</asp:ListItem>
            
<asp:ListItem>2</asp:ListItem>
        
</asp:RadioButtonList>
    
</div>
    
</form>
</body>
</html>

相关文章:

  • 2021-11-22
  • 2021-11-27
  • 2021-09-10
  • 2021-11-21
  • 2019-07-05
  • 2021-11-09
  • 2021-11-28
  • 2021-12-01
猜你喜欢
  • 2021-10-16
  • 2021-12-23
  • 2021-09-25
  • 2021-11-24
  • 2021-12-07
  • 2021-11-28
  • 2021-11-21
  • 2018-08-22
相关资源
相似解决方案