Calling parent window (using master page) button click event from an opened child window (not using master page)

I have a parent window that pops up a child window. In the child window, there is a server control LinkButton, with the following command at code-behind upon clicking:

        Response.Write("<SCRIPT> javascript:window.opener.document.getElementById('<%=btnMas.ClientID%>').click(); </SCRIPT>");
        Response.Write("<SCRIPT> javascript:window.close() </SCRIPT>");

What it would like to do are:
1) Invoke the btnMas Click event at the parent window (to refresh a dropdownlist)
2) Close the child window

However, there is an error using the javascript to call the btnMas.Click event:  window.opener.document.getElementById(...)' is null or not an object

The parent window is using a master page (child window not using master page).

How would you call the parent window btnMas Click event from the child window in this case?


11/11/2008 4:56:22 AM 24353 articles. 2 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 16
Get it on Google Play
Get it on Apple App Store


you cannot get client id <%=btnMas.ClientId%> in your child page because btnMas is in your parent page, so it is trying to get the value which is not in your child page and it is giving the null error,

try hardcoding the value if it is acceptable or pass the value of your clientid of btnmas to ur child page and use it from there to call the click event,

you can also use window,opener.forms[0].submit(); which will postback ur parent page

Please Mark as Answer if it helps you
11/11/2008 5:22:14 AM

 Thanks for the pointers.

 I tried the option of 'pass the value of your clientid of btnmas to ur child page and use it from there to call the click event', and it works Smile



11/12/2008 4:48:57 AM

Similar Artilces:

Open pop-up window in a Page using a Master Page
Helllo, I am trying to open a pop-up window within a page that contains a Master Page. It gives me an error, but if I try same code in a normal page, (no master page) it works fine. What is the trick here? I am including code. <input type="button" value="usage" onclick=" ('ImUsage.aspx?pID=' + this.form.TextBox15.value, 'useWin', 'toolbar=0, height=600, width=500, resizable=0, scroolbars=1')"> Tank you, Gus G. Hi Gus:The problem is that when you use Master Pages, the id of the controls is "mangled" (ASP.NET does this to ensure that each control has a unique...

How to make use of master page class name in the page which is making use of master page
Hi All, Suppose page 1 makes use of one  master page say master1 How to make use of master page class name in page1.   Thanks and regards Abdul  You can use the masterpage class by adding a refference of the master page in the aspx. You can add the reference directly in the page tag or use a <%@ MasterType %> tage to refer the master page typeVikram www.vikramlakhotia.comPlease mark the answer if it helped you Hi, abdulmg:How to make use of master page class name in page1. You can try to do like below: YourMasterPagesClassName master = (YourMasterPagesClassN...

automatic redirect to other page using from client side when page is fully posted back
 hi,     i am experiencing  a problem in <asp:history runat="server"/> order to maintain back and forward button concept i am using <asp:history works fine but the problem is when i redirect to other page using response.redirect ("") i loss my all history points and when i click on back/forward button i am redirected to last full rendered page not to partially updated by ajax.second thing is i cant use server.transfer("") ,since it will not change URL. Third thing is i cant use scriptmanager .registerc...

Opening child window once click finish button it come to parent page but it show window of small size
  Hai i have Linkbutton in one window?It has some line written in Page_LoadInsertEmailFile_LinkButton.Attributes.Add("onclick", "'Admin_EmailFileUpload.aspx?title=" & Emailtitle_DropDownList.SelectedValue & "', 'newwindow','toolbar=no,location=no,menubar=no,width=500,height=215,resizable=no,scrollbars=yes,top=200,left=250');return false;")if if click the LIINKBUTTON then the above page shown ...?there one button in this window..on that button i have code.. Response.Redirect("~/Admin/Admin_Email.aspx?...

Modifying a Parent Master Page from within a Child (Nested) Master Page's Page Lifecycle Event Handlers
Hello, I am having difficulty modifying a control within a parent master page from within a child master page. Essentially, I am building a custom tab-based navigation system, and depending on the page (or master page, in this case), I want to set the CssClass of a hyperlink in the master page to "selected". When I attempt this within the individual ASPX pages themselves, it works flawlessly, though, seems awfully redundant to rewrite the same code for a handful of pages that will inevitably share the same master page anyway. In stepping through (debugging), it seems that we n...

Root master page and re-use root master page in child project
I have a master page on my root project. I would like to reuse the same master page on my child project. However when I am setting the master page file in my child project it doesn't see that page because it is adding a name space from my child project. Below is what I have: RootProject /UserControls RootMasterPage.Master /ChildProject   childProjectWebPage.aspx with page directive to MasterPageFile="~/UserControls/RootMasterPage.Master" When I run my project it is looking for childProjectWebPage/UserControls/RootMasterPage.Master and it can find that master page. Can...

Using javascript on pages that use a master page
I was wondering if i could get any guidance on using javascript for pages that make use of a masterpage. To give a specific example i would like to implement the delay load described by Matt Berseth here: In the example he implements a lot of javascript that is specific to the page so i don't think it makes sense to add it to a script library. But how do i use it in a page inherited from a master page. The js is specific to the content of the page so i would not want to put it in the master page and you can't add a &...

How to clear the contents of a child page using the button created in Master Page
 Hello friends I need a small help from you people.I am designing a webpage for my client, In this process I have designed a webpage with a Button and named it as Clear. So when I click this button in any of the child page that I am going to create the contents of the child page should be cleared. Can any one let me know how to do this???? Thanks and RegardsSandeep Hi, when I click this button in any of the child page that I am going to create the contents of the child page should be cleared You can try to place a panel control in the content page, an...

using master page controls in content page and adding click event
Hi  I've currently got a control on my master page and i'm trying to write an even on the content page that fires when the button is clicked, I don't think it is working though. Can someone help? The code is below:  masterpage <asp:ImageButton id="imgButton" runat="server"/> code behind Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load, Me.Load Public ReadOnly Property lnkbFromMasterPage() As ImageButtonGetReturn imgButtonEnd GetEnd Property  content page code behind: Public Sub Page_Load(ByVa...

How can I use javascript in a page that uses master page?
How can I use javascript in a page that uses master page? my page is uses master page. Therefore it has not Header, Body section. If I want to use javascript in this page, how can I do that? Thanks You can place a ContentPlaceHolder on the master page within the Head section. Then in each content page you want to include some Javascript, you can add the include javascript file in Content holder. This way, you added a jsvsacript file in the head of the page!! Got the solution? RegardsBilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP Hi haidar_Bilal, Have you sample? Tha...

Opening a new Browser Window with an Update Panel and using Master Page
With Response.Write() not working to open a new Browser window, I searched for an alternative to open a new browser window via server side and found the method below but it seems it's trying to insert it into the head section and the page has no head section as it is contained within the Master Page of the site resulting in an error:  Anyone know any other way to open a new browser window? protected void OpenNewBrowserWindow() { string openParams = "toolbar=1,resizable=1"; string url = null; url = "

Calling Child Master Page from Super Master Page Programatically
I have pages in my application like default.aspx, aboutus.aspxThese pages have supermaster page file...Now again I have two master pages inside Skin1 and Skin2 Folder...I want in the runtime I shoudl be be able to switch between skin1.master and skin2.master For this I want to call skin1 or skin2 master from supermaster file.. programatically  Can anyone help me...I have used Page_PreInit, in supermaster Page, but it dint helped me.... Please MARK post as ANSWERED, if you find answer helpful I have done this by putting the Page_PreIni...

Accessing parent master page function from child master page
Hi,I'm using nested master pages for one of my websites. In the parent.master, I have a public function defined called Test(), and at the top of child.master, I have the two lines <%@ master Language="C#" MasterPageFile="parent.master" %> and  <%@ MasterType VirtualPath="parent.master" %>  ... how do I access the Test() function in the parent.master file from the child.master code behind? Thanks in advance for any help.  this worked for me... Master.Test();Jared RobertsLead Application Developer Hi, Check this article -

What is the event sequence when using Master Page and Content page.
 When using master pages, what are the sequence of events. I need to understand which events, like page_load or page_init, comes first. Is it from the master page or the content page. I'm really new on Thanks for any explanation or link someone can provide. It's not uncommon to wonder at the sequence that the various events fire in the Page's Life Cycle. I have added an FAQ that shows the Life Cycle event sequence that you can review here:  Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try co...

Web resources about - Calling parent window (using master page) button click event from an opened child window (not using master page) -

London Calling - Wikipedia, the free encyclopedia
London Calling is the third studio album by the English punk rock band The Clash . It was released in the United Kingdom on 14 December 1979 ...

List of country calling codes - Wikipedia, the free encyclopedia
This is a list of country calling codes defined by ITU-T recommendations E.123 and E.164 , also called IDD ( International Direct Dialling ) ...

Free VoIP Calling Added To Facebook Messenger For IOS In The U.K.
Voice-over-Internet-protocol calling has made its way across the pond for Facebook Messenger users, as the social network updated its iOS version ...

Facebook Video Calling - Facebook
Bring your conversations to life on Facebook. With face-to-face video calling, now you can watch your friends smile, wink and LOL. To get started, ...

Facebook roundup: video ads, voice calling, logos and more
... than three per day at launch. It is unclear whether the ads will autoplay in the feed or not. More Messenger for Android users get free calling ...

Berlin Calling (@neuraum) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Calling all foodies: Here comes @TwitterFood
There are many thousands of food-related Tweets people send on Twitter each day – Tweets about meals, ingredients, favorites, recipes and dining ...

YUBISASHI NIPPON CALLING ENGLISH for iPhone, iPod touch, and iPad on the iTunes App Store
Get YUBISASHI NIPPON CALLING ENGLISH on the App Store. See screenshots and ratings, and read customer reviews.

Calling woman II - Flickr - Photo Sharing!
Explore Marcel Oosterwijk's photos on Flickr. Marcel Oosterwijk has uploaded 2195 photos to Flickr.

Rebtel takes back the phone lines with Internet-free calling
... you have friends and family in different countries, it might be expensive keeping up with them other than through Facebook. International calling ...

Resources last updated: 2/9/2016 3:15:46 PM