如何添加服务器端弹出窗口 [英] how to add server side popup window
本文介绍了如何添加服务器端弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在点击按钮时写弹出窗口代码(服务器端)。
它显示弹出窗口有四个asp:按钮,但是当我选择一个按钮并单击它时它将不会重定向我希望页面。
有什么问题?
代码: -
i am writing popup window code(server side) on button click.
it showing popup window with four asp:buttons,but when i select one button and click on it it won't redirect me to desire page.
what is the problem?
code:-
<script>
function ShowPopup() {
$(function () {
$("#dialog").dialog({
title: "SELECT SUBJECT",
width:400,
buttons: {
Close: function () {
$(this).dialog('close');
}
},
});
});
};
</script>
<pre lang="xml"><div id="dialog" style="display: none" runat="server">
<asp:Button ID="Button3" runat="server" Text="Button" Height="50px"
Width="150px" onclick="Button3_Click" />    
<asp:Button ID="Button4" runat="server" Text="Button" Height="50px"
Width="150px" onclick="Button4_Click" />     <br />
<asp:Button ID="Button5" runat="server" Text="Button" Height="50px"
Width="150px" onclick="Button5_Click" />    
<asp:Button ID="Button6" runat="server" Text="Button" Height="50px"
Width="150px" onclick="Button6_Click" />
</div>
aspx.cs:-
protected void Button2_Click(object sender, EventArgs e)
{
.
.
.
reader2.Read();
Button3.Text = reader2["subject1"].ToString();
Button4.Text = reader2["subject2"].ToString();
Button5.Text = reader2["subject3"].ToString();
Button6.Text = reader2["subject4"].ToString();
reader2.Close();
ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup()", true);
}
protected void Button3_Click(object sender, EventArgs e)
{
Response.Redirect("attendance.aspx");
}
这是我的代码,弹出窗口显示有四个按钮但是当我点击button3时它没有重定向我。
this is my code,popup is showing with four buttons but when i click on button3 it is not redirecting me.
推荐答案
( function (){
( #dialog)。dialog({
title: < span class =code-string> SELECT SUBJECT,
width: 400 ,
按钮:{
关闭: function (){
("#dialog").dialog({ title: "SELECT SUBJECT", width:400, buttons: { Close: function () {
( this )。对话框(' close');
}
},
});
});
};
< / script>
< pre lang = xml>< div id = 对话框 style = < span class =code-string> display:none runat = server >
< asp:按钮ID = Button3 runat = server Text = 按钮高度= 50px
Width = 150px onclick = Button3_Click /> & nbsp& nbsp& nbsp&bbsp b< asp:按钮ID = Button4 runat = server Text = < span class =code-string>按钮高度= 50px
Width = 150px onclick = Button4_Click /> & nbsp& nbsp& nbsp< br />
< asp:按钮ID = Button5 runat = server Text = 按钮高度= 50px
Width = 150px onclick = Button5_Click /> & nbsp& nbsp& nbsp&bbsp b< asp:按钮ID = Button6 runat = server Text = < span class =code-string>按钮高度= 50px
Width = 150px onclick = Button6_Click />
< / div >
aspx.cs: -
protected void Button2_Click(对象发送者, EventArgs e)
{
。
。
。
reader2.Read();
Button3.Text = reader2 [ subject1]。ToString() ;
Button4.Text = reader2 [ subject2]。ToString();
Button5.Text = reader2 [ subject3]。ToString();
Button6.Text = reader2 [ subject4]。ToString();
reader2.Close();
ClientScript.RegisterStartupScript( this .GetType(), Popup, ShowPopup(),真跨度>);
}
受保护 void Button3_Click(对象发件人,EventArgs e)
{
Response.Redirect( attendance.aspx);
}
(this).dialog('close'); } }, }); }); }; </script> <pre lang="xml"><div id="dialog" style="display: none" runat="server"> <asp:Button ID="Button3" runat="server" Text="Button" Height="50px" Width="150px" onclick="Button3_Click" />     <asp:Button ID="Button4" runat="server" Text="Button" Height="50px" Width="150px" onclick="Button4_Click" />     <br /> <asp:Button ID="Button5" runat="server" Text="Button" Height="50px" Width="150px" onclick="Button5_Click" />     <asp:Button ID="Button6" runat="server" Text="Button" Height="50px" Width="150px" onclick="Button6_Click" /> </div> aspx.cs:- protected void Button2_Click(object sender, EventArgs e) { . . . reader2.Read(); Button3.Text = reader2["subject1"].ToString(); Button4.Text = reader2["subject2"].ToString(); Button5.Text = reader2["subject3"].ToString(); Button6.Text = reader2["subject4"].ToString(); reader2.Close(); ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup()", true); } protected void Button3_Click(object sender, EventArgs e) { Response.Redirect("attendance.aspx"); }
这是我的代码,弹出窗口显示有四个按钮但是当我点击button3时它没有重定向我。
this is my code,popup is showing with four buttons but when i click on button3 it is not redirecting me.
这篇关于如何添加服务器端弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文