Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:-
JavaScript
<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" /> &nbsp&nbsp&nbsp
        <asp:Button ID="Button4" runat="server" Text="Button" Height="50px"
        Width="150px" onclick="Button4_Click" /> &nbsp&nbsp&nbsp <br />
        <asp:Button ID="Button5" runat="server" Text="Button" Height="50px"
        Width="150px" onclick="Button5_Click" /> &nbsp&nbsp&nbsp
        <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");
    }

this is my code,popup is showing with four buttons but when i click on button3 it is not redirecting me.
Posted
Updated 7-Mar-15 0:43am
v2
Comments
Arkadeep De 7-Mar-15 6:35am    
If you wouldn't share your code how any one will be able to help you..
Share what you have done...
batman56 7-Mar-15 6:43am    
shared my code.
Arkadeep De 7-Mar-15 6:52am    
any error are showing? use debugger to follow your flow...
batman56 7-Mar-15 6:55am    
no error.
when i click on button it shows clicking effect but nothing happens,the popup window stays there.
Arkadeep De 7-Mar-15 7:17am    
use the debugger and check whether its hitting the code behind or not...

1 solution

Put that button out side the dialog div and make it display none. On the popup, add one button and fire the click event of the outside button (button 3). We have to do this, because jQuery dialog stops post back.

One example - How to make ASP.Net Button do PostBack in jQuery Modal Dialog Popup[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900