find content page control from master page

Pls help me out this one

I am using a Master page and a lot of content pages. and i am using timer controls in various pages of my project....

All i need is i want to stop a timer control of a particular page by its id.. i just wrote code in javascript in masterpage as

function starttimer()

 

{

$get(
'Timer1').control._startTimer();

}

function stoptimer()

{

$get(
'Timer1').control._stopTimer();

}

 

It doesn't work for me..

how to find the control from master page...

Thanks in advance

0
muthulakshmanan
3/23/2009 10:42:14 AM
asp.net.ajax-ui 9760 articles. 0 followers. Follow

3 Replies
963 Views

Similar Articles

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

This link might help you out,

http://forums.asp.net/p/1330013/2670187.aspx#2670187


Joydeep Sen
Dotnet Developer

Dont forget to click “Mark as Answer” on the post that helped you.
This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers


0
joydeepsen
3/23/2009 12:13:01 PM
Hi 
 
You can also try the following demo, which works fine on our lab:
  
<%@ Master Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function starttimer() {

            $get('<%=ContentPlaceHolder1.FindControl("Timer1").ClientID %>').control._startTimer();
        }

        function stoptimer() {

            $get('<%=ContentPlaceHolder1.FindControl("Timer1").ClientID %>').control._stopTimer();
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
        
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>
 

Thanks.

 


Lance Zhang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Lance
3/26/2009 7:31:02 AM

When you used Master page you all control placed inside ContentPlaceHolder

You have used FindControl() to get the controlId as follow:

$get(ContentPlaceHolder.FindControl("Timer1")).control_startTimer()

$get(ContentPlaceHolder.FindControl("Timer1")).control_stopTimer()


Chetan Sarode
Software Engineer,
Approva Systems Pvt Ltd,
Pune, India.
0
chetan
3/27/2009 5:28:20 AM
Reply:

Similar Artilces:

Content controls have to be top-level controls in a content page or a nested master page that references a master page.
Why in the world am I getting this error? The solutions I have seen either don't apply or don't work.  Here is my master page code:<%@ Master Language="C#" AutoEventWireup="false" CodeFile="TechLMSMasters/MainSide.master.cs" Inherits="MainSide" %> <%@ Register TagPrefix="usercontrol" TagName="Search" Src="~/library/uc/Search.ascx" %> <%@ Register TagPrefix="usercontrol" TagName="UserName" Src="~/library/uc/UserNameDisplay.ascx" %><!DOCTYPE html PUBLI...

ERROR Content controls have to be top-level controls in a content page or a nested master page that references a master page.
This all used to work until about 5 minutes ago. Did I change something? For some reason I am now getting this error: Content controls have to be top-level controls in a content page or a nested master page that references a master page. What I have:  I have a masterpage inside of a directory. That directory is a first level directory with its own web.config file....The whole thing is protected by the web.config file above it (in the main public directory). That main public directory has a masterpage as well. I am not currently linking the two masterpages together becuase...

Error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.
when I make a directory on my root, and in that directory I put a masterpage and a web form ... I get always an error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.   Does somebody know what the problem is ? Is it possible you can't set a masterpage in a directory ... ?Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) i've founded ... I had to nest my masterpage ...Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) Hi Joeri Pansaerts, I am receiving the same error as the one posted her...

Error finding the user control in master page from content page
HI, I have a master page in which i have created a header which is a user control into which contains a label.  I a accessing this label from content page.  The code for the following is mentioned below.  Sometimes it works perfectly fine however sometimes it throws object reference error.  So my application is not stable.   Any suggestions what could be the possible issue???????     Utils UT = new Utils();    protected void Page_Load(object sender, EventArgs e)    {      Sys...

1)how to find or capture a control of a content page from master page?
please give me small sample code by which i can find or capture a control of a content page from master page. Here is some code I found on the internet sometime ago (sorry cant remember the site) You can pass the name of the control and it will return the control.    /// <summary>  /// Finds a Control recursively. Note finds the first match that exists  /// </summary>  /// <param name="ContainerCtl">Should be the lowest container in the heirarchy, for eg dont choose Master page if you can pick the specific panel</param>  ...

using findcontrol in content page to find master page control
 hi all,            I am trying to find a panel on a master page from its content page. But the panel is always coming null. This is my code:        ContentPlaceHolder cnt = new ContentPlaceHolder();        cnt = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");        Panel pnl = new Panel();        pnl = (Panel)cnt.FindControl("pnlLogin");      &nb...

Show content in both Master Page ContentPlaceholder AND Content Page Content control
I note that by default or rendering rules, when you add content/controls to the Content Page ASP:Content control matched to a Master Page ContentPlaceholder, any content/controls in the matching Master Page ContentPlaceholder is not displayed. Is there a setting that can be made to merge or show both content/controls in the Master Page ContentPlaceholder and content/controls in the matching Content Page Content control? Thanks         Don't think so. If you specify a content control in your page then whatever is in there displays and anything in the...

Content controls are allowed only in content page that references a master page.
HiI'm getting the above error with my application.Basically I had a master file and then some page files referencing the master file.In the page files I had some ajax controls so had :<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><atlas:ScriptManager ID="ScriptManager1" runat="server"></atlas:ScriptManager>in them.but when I try adding an ajax control to the master file and putting the above code in, it shows the error messagewhy would this be?thanks!  Make sure you have prop...

convertion from page to content page or from user control to content page
Hi, I have converted an asp.net 1.1 application to 2.0.  Now what I am looking for some enhancement.  I added a master page and now I want to add other pages as content pages. but those pages which I am converting into content have some user control. Now either I can convert those user control to content pages ( which i want to look for if it is possible),  Or I am thinking i shouldn't convert those user control to content pages cause they might be just good. So looking for some of those people opinion who have worked through this so can I get opinion here please.thanks&nb...

synchronizing content pages to master page when master page is edited
 Hi Guys,I'm new to designing websites so please forgive this basic question.I've updated my master page and the modfications ( adding a couple of extra place holders)  are not reflecting in the content pages.Is there any way we can update the content pages created before the changes to the master page were made.Thanks a lot  :)  abhinaynag: I'm new to designing websites so please forgive this basic question. I've updated my master page and the modfications ( adding a couple of extra place holders)  are not reflecting in the content pages. Is t...

error: Content controls are allowed only in content page that references a master page.
 I have a website that uses a masterpage. most of my users have no problem; but few get the error bellow. I was never able to duplicate the error.   ex.message: Content controls are allowed only in content page that references a master page.Stack trace:    at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)   at System.Web.UI.Page.get_Master()   at System.Web.UI.Page.ApplyMasterPage()   at System.Web.UI.Page.ProcessRequestMain(Boolean in...

Error:Content controls are allowed only in content page that references a master page?!!
 Hello All I have a web application, it is working well in localost without any error but when I upload it to the host it show me the error below:Any suggestion? I have not seen this error beforePlease any helpRegards, Server Error in '/' Application. Content controls are allowed only in content page that references a master page. Description: Anunhandled exception occurred during the execution of the current webrequest. Please review the stack trace for more information about theerror and where it originated in the code. Ex...

Finding a control in the master page from within a control on the "child" page....
I've seen several examples of finding controls, but I'm struggling with this.  I want to turn a panel to visible and set a label's text field from within a control... All the examples that I've seen, including the really good one at MSDN2 shows Master.FindControl.  When I use that, it says Master is not declared.  Is there an easy way to set the panel and the label from within the control? Am I close? '---------- My Master page...abbreviated... <%@ Master Language="VB" CodeFile="Secure_Master.master.vb" Inherits="MasterPage" %><%@ Register TagPrefix="cc" TagName="men...

Problem to use TreeView Control in a 'content page' This Error Occur "Only Content controls are allowed directly in a content page that contains Content controls."
hi I am trying to use the TreeView Control inside the content page (Page that has a master page is a content page). On compiling the project I got the following ASP.Net runtime error: "Only Content controls are allowed directly in a content page that contains Content controls."B@b@R J Issue resolved. I was putting script tag in the content page that is not allowed. when remove the script from content page problem is resolved.B@b@R J...

Web resources about - find content page control from master page - asp.net.ajax-ui

Help:Contents - Wikipedia, the free encyclopedia
Templates are special pages that contain boilerplate text intended to be displayed on more than one page in Wikipedia. This Tip of the day box ...

Portal:Contents/Culture and the arts - Wikipedia, the free encyclopedia
The word culture is derived from the Latin root cultura or cultus meaning to "inhabit, cultivate, or honour". In general, culture refers to human ...

A-B InBev Extends NBA Sponsorship, Gains Content Rights
... sports league sponsorships after extending its NBA deal for another four years. The renewal, which was announced today, includes a new content ...

Snapchat Allows Publishers to Link to Their Content Outside the App
... introduced the ability for its publishing partners to share their Discover Channels on Facebook and Twitter with links directly to their content, ...

Artsy has new content and is ready for Miami Art Week
... world close at hand with Artsy , then an update today, Dec. 2, will inspire you even more. The apps new version entitled Fresh brings new content ...

DirecTV will broadcast live 4K content by “early next year”
(credit: Adam Melancon ) Even if 4K TVs were popular Black Friday and Cyber Monday steals, there continues to be a lack of 4K content to watch ...

How to extract the contents of a setup file without installing it first
... only exist as a way to get adware onto your system, sometimes without you even noticing. One way to avoid this is to extract the contents of ...

Why content is ‘not’ king and never has been
... been in the search marketing industry for over a decade, and I don’t think a year has gone by in which I haven’t heard the expression ‘content ...

IDG Contributor Network: Is relying on a single content platform like Facebook worth the cost?
Everybody’s talking about how distributing content through third-party organizations such as Facebook or Twitter could hurt digital publishers, ...

Leveraging Parkinson’s Law to Push Out Content
One of the sneaky things about blogging is the treadmill of content you have to produce. You may think you know a lot about your niche, but when ...

Resources last updated: 12/2/2015 11:29:31 PM