I am working on a website in asp.Net
, and i am using iframe
to load a separate page.
The separate page named Districting.aspx
, includes an asp button
, which onClick()
, calls a function in c#, named DoneClicked()
.
This is the asp button control:
<asp:Button ID="LinkButtonDone" CssClass="button button-yellow" runat="server" OnClick="DoneClicked" Text="Done" />
In code behind, the DoneClicked function:
protected void Doneclicked(object sender, EventArgs e)
{
// Some code here
// Calling a function from Default page
}
What I need to do is at the end of DoneClicked
function, a function from the Default.aspx
page must be called.
So how can I access a function from Default.aspx.cs
in the iframe page code behind?
Thanks:)
Try Below It Worked for me
In Code Behind
protected void Doneclicked(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "scriptid", "window.parent.location.href='ParentPageName.aspx';", true);
}
You can't access it directly (at least not in an advisable fashion).
You should abstract out the common code from Default.aspx into a class somewhere that can be used by both pages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With