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.
Bash
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
TypeScript
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

Sanjeeb LenkaRank #301 · 8.3K reputationPosted Nov 6, 2013, 6:55 PM EST
check this attached sample solution. and reply if you have any problem.
Abhishek Srivastava9 reputationPosted Nov 10, 2013, 1:00 AM EST
Abhishek Srivastava9 reputationPosted Nov 10, 2013, 1:05 AM EST
I moved the code from add_keys method to load method of ModalPopupExtender (mp1)
protected void mp1_Load(object sender, EventArgs e) { string url = "getKeysforAddUpdatePropertyKey.aspx?PropertyId=" + txt_property_id.Text; irm1.Attributes["src"] = url; }On the front end (aspx page) changed
asp:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panl1" DropShadow="true" TargetControlID="cmd_add_key" CancelControlID="cmd_cancel" asp:ModalPopupExtender>asp:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panl1" DropShadow="true" TargetControlID="cmd_add_key" CancelControlID="cmd_cancel" onload="mp1_Load">/asp:ModalPopupExtender>xxinchunn18 reputationPosted Mar 14, 2019, 6:36 PM EDT