I have a RadioButtonList in asp.net Usercontrol. It contains the values "Leave", "Available". When the user clicks "Leave", then, I should display message as "Are you sure you want to take Leave?" with "Ok" and "Cancel" buttons.
When the user clicks Available/Leave, then the following event fires.
protected void rdlUser_SelectedIndexChanged(object sender, EventArgs e)
{
if (rdlUser.SelectedIndex == 0)
{
radWindowManager.RadConfirm("Are you sure you want to take Leave?", "confirmSave" + this.ClientID, 300, 100, null, "");
}
}
This is Client side javascript function...
function confirmSave<%=this.ClientID%>(arg) {
if (arg == true) {
$find('<%= FindControl("txtUser").ClientID %>').set_value("User has taken Leave");
}
**If the user clicks Leave Radiobutton and clicks cancel in the confirm message box, then the program should revert the change to "Available" Radiobutton. How can I select that "Available" programatically in Server/Client side?
EDIT:The main goal is to reset the value to previous state**
Add an else statement to catch arg==false
and set the checked
property of the desired radio input to true
. See Check a radio button with javascript
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.