RadioButtonList selection confirmation ~!
Don't talk nonsense, read the code ~!
Protected void Page_Load (object sender, EventArgs e)
{
This. RadioButtonList1.Items [1]. Attributes. Add ("onclick", "if (! Confirm ('You really want to ask me? ') {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> No title page </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>