Data from args is empty first time on page load

210 Views Asked by At

I have a button on my parent page which opens a modal window and passes a string value:

AXDialogArgs args = new AXDialogArgs();
args.Data = "Some data";
args.URL = url.Url.ToString();
args.Size = DialogSize.Maximum;

DialogHelper.Open(args, this);

But when the modal page loads, args.Data is empty

protected void Page_Load(object sender, EventArgs e)
{
    AXDialogArgs args = DialogHelper.DialogArgs;
    Label1.Text = args.Data.ToString();
}

However, if I create a button with an empty event:

protected void Button2_Click(object sender, EventArgs e) {}

the method "Page_Load" is fired again, but this time args.Data contains "Some data"

I know that the button fires a postback, but what I don't understand is why "Some data" occurs after "Page_load" has been fired the second time

0

There are 0 best solutions below