DNR
DNR

Reputation: 3736

Passing variables from one modal window to another in asp.net

I have an asp.net application where I need to pass values from one modal windown to another modal window. I have tried session variables, but they return null 50% of the time.

What would be another alternative to pass paramaters from a modal window to another?

Cookies are not an option.

Thanks

Upvotes: 1

Views: 1026

Answers (1)

Paul T Davies
Paul T Davies

Reputation: 2573

I have found the only reliable way to do this is through javascript:

the child window can can set a value in the parent like this:

window.parent.setValue(x);

with this in the parent:

function setValue(x)
{
     document.getElementById(<% HiddenField1.ClientID %>).value = x;
}

The child has now set a value in the parent window which can be accessed form the parent's codebehind via the control HiddenField1.

Upvotes: 1

Related Questions