3
Answers

Pass value to a new web form in modal popup

The following code  is based on an article in this forum.

Following is the link for it

I have the following code in my main aspx form.

<asp:button id="Button1" name="cmd_add_key" runat="server" OnClick="add_keys" Text="Attach keys" />
        <asp:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server"></asp:ToolkitScriptManager>
        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panl1" DropShadow="true"
            TargetControlID="cmd_add_key" CancelControlID="cmd_cancel" ></asp:ModalPopupExtender>
        <asp:Panel ID="Panel1" runat="server" CssClass="#transparent" align="center" style = "display:none; background-color:White;">
            <iframe style=" width: 800px; height: 300px;" id="Iframe1" src="getKeysforAddUpdatePropertyKey.aspx?PropertyId=324" runat="server"></iframe>
            <br/>
            <asp:Button ID="Button2" runat="server" Text="Close" class="btn btn-primary"/>
        </asp:Panel>

Following is the code behind of add_keys method
protected void add_keys(object sender, EventArgs e)
{
    string url = "getKeysforAddUpdatePropertyKey.aspx?PropertyId=" + txt_property_id.Text;
    irm1.Attributes["src"] = url;
}

Now every time popup opens the modal form "getKeysforAddUpdatePropertyKey.aspx", I get the value 324 which I understand is the default value I am passing as a parameter. I am however looking for a way where I can change the value. I thought by writing the code in add_keys method will do the trick, however it is completely ignored and I always get 324.
 
Any help would be appreciated.
 
Many thanks in advance




Answers (3)