单击确认消息框中的取消按钮后,如何清除文本框。我的消息框脚本是(在Web应用程序中)。如果我们无法使用此脚本消息执行此操作,请再次提及。
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "confirm", "confirm('Do you want to delete it ..!!');", true);
答案 0 :(得分:0)
confirm('Do you want to delete it ..!!')
根据您点击的按钮返回true or false
..
最好编写一个单独的函数并将其包含在JavaScript文件中并像上面那样调用..
否则你必须内联编写整个代码,但看起来很乱......
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "confirm", "" +
"document.body.onload = function(){"+
"if(confirm('Do you want to delete it ..!!')==false)" +
"{" +
"document.getElementById('myTextBox').value='';" +
"}"+
"}", true);
答案 1 :(得分:0)
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "confirm", "confirm('Do you want to delete it ..!!');", true) ? txtDate.text = string.Empty : txtdate1.text = string.Empty;