Welcome Guest Search | Active Topics | Sign In | Register

MsgBox Redirect Options
koochy
Posted: Wednesday, August 26, 2009 3:32:38 PM
Rank: Newbie
Groups: Member

Joined: 8/26/2009
Posts: 3
Hi,

Code: C#
protected void Button1_Click(object sender, EventArgs e)
    {
        MsgBox1.Show("Test",
        "This is a test message", null,
       new EO.Web.MsgBoxButton("Yes", null, "OK"));

}



protected void MsgBox1_ButtonClick(
    object sender, System.Web.UI.WebControls.CommandEventArgs e)
{

    if (e.CommandName == "OK")
    {
        Response.Redirect("Default.aspx");
    }
}


Response.Redirect is not working, how can i fix it?


eo_support
Posted: Wednesday, August 26, 2009 3:39:28 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The code you posted looks fine and I don't think Redirect has anything to do with MsgBox. If you can post a full test page that can demonstrate the problem (so that we can run it here to see the problem), we will be happy to take a look and see what we can find.

Thanks!
koochy
Posted: Wednesday, August 26, 2009 3:50:45 PM
Rank: Newbie
Groups: Member

Joined: 8/26/2009
Posts: 3
This is actually the whole code :)

I am just testing the msgBox control before using it

The only controls that I included are the button and the msgBox, even the default page is empty
eo_support
Posted: Wednesday, August 26, 2009 4:04:44 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We tested the following code and it works fine here:

Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <eo:MsgBox ID="MsgBox1" runat="server" 
            OnButtonClick="MsgBox1_ButtonClick">
        </eo:MsgBox>
    
    </div>
        <asp:Button ID="Button1" runat="server" 
            OnClick="Button1_Click" Text="Button" />
    </form>
</body>
</html>


Code: C#
public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        MsgBox1.Show("Test",
            "This is a test message", null,
            new EO.Web.MsgBoxButton("Yes", null, "OK"));
    }

    protected void MsgBox1_ButtonClick(object sender, CommandEventArgs e)
    {
        if (e.CommandName == "OK")
        {
            Response.Redirect("Default.aspx");
        }
    }
}


So there got to be something different between your test page and our test page. I am suspecting that your MsgBox1_ButtonClick event handler is not correctly hooked up. There are a number of ways to hookup event handler. In our code it is hooked up by OnButtonClick="MsgBox1_ButtonClick" in the aspx file.

Please try our test code and see if it works for you. If it does you can compare yours with ours to see if you can spot the difference. If you can not spot the difference, post the full test page and we should be able to find it out for you.

Thanks!

koochy
Posted: Wednesday, August 26, 2009 4:19:11 PM
Rank: Newbie
Groups: Member

Joined: 8/26/2009
Posts: 3
Thnx for your effort

I missed this:
OnClick="Button1_Click" Text="Button"
Silenced

Regards,
eo_support
Posted: Wednesday, August 26, 2009 4:25:55 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
koochy wrote:

I missed this:
OnClick="Button1_Click" Text="Button"


That's why we asked you to post a full test page. :)

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.