The parent page (Parent.aspx page) contains one iframe page (FrameChild.aspx page), when you need to call the iframe button's event method, then we should follow as follows.
In the parent page, the javascript method calls the following:
<script type="text/javascript" language="javascript"> function functionName() { document.getElementById(iframeID).contentWindow.MyIFrameFunction(); }
iframeID is the frame identifier, MyIFrameFunction () is the name of the javascript function in FrameChild.aspx and calls the functionName () method using the parent page button, which calls the call below MyIFrameFunction () of the child element. js.
The child page (FrameChild.aspx) must contain one function.
<script type="text/javascript" language="javascript"> function MyIFrameFunction() { __doPostBack('btnRenew', 'passparameter'); } </script>
suppose one button in FrameChild.aspx.
<asp:Button ID="btnRenew" runat="server" OnClick="btnRenew_Click" />
behind the FrameChild.aspx page.
protected void Page_Load(object sender, System.EventArgs e) { string target = Request["__EVENTTARGET"];
This code works for me.
Udeesh
source share