C# 如何在asp.net中显示代码隐藏文件中的对话框?
我正在开发一个web应用程序,其中多个对话框相互打开。如何在asp.net web应用程序中附加和显示cs文件中的对话框,以便代码更易于管理C# 如何在asp.net中显示代码隐藏文件中的对话框?,c#,javascript,jquery,asp.net,C#,Javascript,Jquery,Asp.net,我正在开发一个web应用程序,其中多个对话框相互打开。如何在asp.net web应用程序中附加和显示cs文件中的对话框,以便代码更易于管理 $("#dialog1").dialog({ autoOpen: false, modal: true, draggable: true, height: 340, width: 400, position: "center", resizable: false, button
$("#dialog1").dialog({
autoOpen: false,
modal: true,
draggable: true,
height: 340,
width: 400,
position: "center",
resizable: false,
buttons: {
"Yes": function () { $("#dialog1").dialog("close") },
"No": function () { }
}
});
$("#btnDialog").click(function () { $("#dialog1").dialog("open"); });
HTML
尝试在代码隐藏中编写js变量,并在页面中使用它
protected void Button1_Click(object sender, EventArgs e)
{ Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ShowDialog",
" var showDialog="+boolShowDialog, true);
}
}
第页
<script>
if(showDialog==true){
$(document).ready(function(){
$('#dialog-box').dialog("show");
});
}
</script>
如果(showDialog==true){
$(文档).ready(函数(){
$(“#对话框”)。对话框(“显示”);
});
}
你能展示你到目前为止做了什么吗?我正在从jquery文件$(“#dialog1”)打开对话框。对话框({autoOpen:false,modal:true,draggable:true,height:340,width:400,position:“center”,resize:false,button:{“Yes”:function(){$(“#dialog1”)。对话框(“close”)},“No”:function(){}};$(“#btnDialog”)。单击(function(){$(“#dialog1”)。dialog(“open”);};如何从cs文件中附加并打开同一对话框到按钮。听起来根本问题在于您的UI设计
protected void Button1_Click(object sender, EventArgs e)
{ Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ShowDialog",
" var showDialog="+boolShowDialog, true);
}
}
<script>
if(showDialog==true){
$(document).ready(function(){
$('#dialog-box').dialog("show");
});
}
</script>