1
我在asp.net Usercontrol中有一个RadioButtonList。它包含值“离开”,“可用”。当用户点击“离开”时,我应该将信息显示为“你确定要离开吗?” “确定”和“取消”按钮。恢复asp.net中RadiobuttonList的以前状态
当用户点击Available/Leave时,下面的事件触发。
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, "");
}
}
这是客户端的JavaScript函数...
function confirmSave<%=this.ClientID%>(arg) {
if (arg == true) {
$find('<%= FindControl("txtUser").ClientID %>').set_value("User has taken Leave");
}
**如果用户点击离开单选框,并单击在确认消息框中取消,那么程序应该恢复更改为“可用“ 单选按钮。我如何在Server/Client端以编程方式选择“Available”?
编辑:主要目标是重置价值以前的状态**
我在这里有一个问题。 RadiobuttonList的Radiobuttons“Available”和“Leave”来自数据库。它可以超过2个值(“可用”和“离开”)。我需要在客户端JavaScript中识别并以编程方式设置它的值。我需要使用类似的代码,因为它是一个UserControl'$ find('<%= FindControl(“txtUser”)。ClientID%>')' –
使用JS函数的唯一名称(http://www.telerik .com/support/kb/aspnet-ajax/details/using-dynamic-unique-names-for-javascript-functions)并在每个实例中注入所需的ID与服务器代码块 – rdmptn