473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

master pages and AJAX controls

I'm having a problem getting AJAX working with a master page.

I have created a new website using the AJAXControlToolkit template and
default.aspx as follows.

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Panel ID="Panel1" runat="server" Height="134px"
Width="217px">
This is where the definition goes! It should be invisible
until the LinkButton is hovered on.

</asp:Panel>
<br />
<asp:LinkButton ID="LinkButton1"
runat="server">LinkButton</asp:LinkButton><br />
<ajaxToolkit:AnimationExtender ID="AnimationExtender1"
runat="server" TargetControlID="LinkButton1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>

</ajaxToolkit:AnimationExtender>
</form>
</body>
</html>

This page works correctly, fading in when hovering over the LinkButton
and fading out when moving off.

Then I created a master page (I added nothing to it) and a new WebForm
based on this master page.

Here's the WebForm.

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="ATKTest.aspx.cs" Inherits="ATKTest"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />

<asp:Panel ID="Panel1" runat="server" Height="134px"
Width="217px">
This is where the definition goes! It should be
invisible until the LinkButton is hovered on.

</asp:Panel>
<br />
<asp:LinkButton ID="LinkButton1" runat="server">AM -
Amplitude</asp:LinkButton><br />
<ajaxToolkit:AnimationExtender ID="AnimationExtender1"
runat="server" TargetControlID="LinkButton1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>

</ajaxToolkit:AnimationExtender>
</div>
</asp:Content>

this page does not work and generates a Javascript error as follows:
----------
Sys.ArgumentException:
AjaxControlToolKit.Animation.Animation.set_animati onTarget requires
the ID
of a Sys.UI.DomElement or a Sys.UI.Control. No element or control
could be
found corresponding to 'Panel1'
Parameter name: id
-----------

Any help is greatly appreciated!

Mike

Feb 20 '07 #1
6 6807
you need a form in the master page if you remove it from the page.

-- bruce (sqlwork.com)

mi**@5starserv.com wrote:
I'm having a problem getting AJAX working with a master page.

I have created a new website using the AJAXControlToolkit template and
default.aspx as follows.

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Panel ID="Panel1" runat="server" Height="134px"
Width="217px">
This is where the definition goes! It should be invisible
until the LinkButton is hovered on.

</asp:Panel>
<br />
<asp:LinkButton ID="LinkButton1"
runat="server">LinkButton</asp:LinkButton><br />
<ajaxToolkit:AnimationExtender ID="AnimationExtender1"
runat="server" TargetControlID="LinkButton1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>

</ajaxToolkit:AnimationExtender>
</form>
</body>
</html>

This page works correctly, fading in when hovering over the LinkButton
and fading out when moving off.

Then I created a master page (I added nothing to it) and a new WebForm
based on this master page.

Here's the WebForm.

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="ATKTest.aspx.cs" Inherits="ATKTest"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />

<asp:Panel ID="Panel1" runat="server" Height="134px"
Width="217px">
This is where the definition goes! It should be
invisible until the LinkButton is hovered on.

</asp:Panel>
<br />
<asp:LinkButton ID="LinkButton1" runat="server">AM -
Amplitude</asp:LinkButton><br />
<ajaxToolkit:AnimationExtender ID="AnimationExtender1"
runat="server" TargetControlID="LinkButton1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>

</ajaxToolkit:AnimationExtender>
</div>
</asp:Content>

this page does not work and generates a Javascript error as follows:
----------
Sys.ArgumentException:
AjaxControlToolKit.Animation.Animation.set_animati onTarget requires
the ID
of a Sys.UI.DomElement or a Sys.UI.Control. No element or control
could be
found corresponding to 'Panel1'
Parameter name: id
-----------

Any help is greatly appreciated!

Mike
Feb 20 '07 #2
The master page has a form tag in it - it is the exact master page
that is created when you select 'New' from the menu and 'Master Page'
from the dialog.

On Feb 20, 2:05 pm, bruce barker <nos...@nospam.comwrote:
you need a form in the master page if you remove it from the page.

-- bruce (sqlwork.com)

m...@5starserv.com wrote:
I'm having a problem getting AJAX working with a master page.
I have created a new website using the AJAXControlToolkit template and
default.aspx as follows.
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Panel ID="Panel1" runat="server" Height="134px"
Width="217px">
This is where the definition goes! It should be invisible
until the LinkButton is hovered on.
</asp:Panel>
<br />
<asp:LinkButton ID="LinkButton1"
runat="server">LinkButton</asp:LinkButton><br />
<ajaxToolkit:AnimationExtender ID="AnimationExtender1"
runat="server" TargetControlID="LinkButton1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>
</ajaxToolkit:AnimationExtender>
</form>
</body>
</html>
This page works correctly, fading in when hovering over the LinkButton
and fading out when moving off.
Then I created a master page (I added nothing to it) and a new WebForm
based on this master page.
Here's the WebForm.
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="ATKTest.aspx.cs" Inherits="ATKTest"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Panel ID="Panel1" runat="server" Height="134px"
Width="217px">
This is where the definition goes! It should be
invisible until the LinkButton is hovered on.
</asp:Panel>
<br />
<asp:LinkButton ID="LinkButton1" runat="server">AM -
Amplitude</asp:LinkButton><br />
<ajaxToolkit:AnimationExtender ID="AnimationExtender1"
runat="server" TargetControlID="LinkButton1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>
</ajaxToolkit:AnimationExtender>
</div>
</asp:Content>
this page does not work and generates a Javascript error as follows:
----------
Sys.ArgumentException:
AjaxControlToolKit.Animation.Animation.set_animati onTarget requires
the ID
of a Sys.UI.DomElement or a Sys.UI.Control. No element or control
could be
found corresponding to 'Panel1'
Parameter name: id
-----------
Any help is greatly appreciated!
Mike- Hide quoted text -

- Show quoted text -

Feb 20 '07 #3
On 20 Feb 2007 09:34:47 -0800, mi**@5starserv.com wrote:

>Sys.ArgumentException:
AjaxControlToolKit.Animation.Animation.set_animat ionTarget requires
the ID
of a Sys.UI.DomElement or a Sys.UI.Control. No element or control
could be
found corresponding to 'Panel1'
Parameter name: id
-----------

Any help is greatly appreciated!

Mike
Being a newbie on this myself, I had a table in an updatepanel and
was getting the same/similar error (from memory).

I had to do something in the codebehind in the page_load method like:

if (table1 == null) table1 = new Table()

then I had to add it to the form using

form1.Controls.Add(table1).
Not sure quite why I had to do this, but it seemed to fix the problem.
----------------
AndyW,
Mercenary Software Developer
Feb 21 '07 #4
On Feb 21, 5:29 pm, AndyW <a...@b.no.emailwrote:
On 20 Feb 2007 09:34:47 -0800, m...@5starserv.com wrote:
Sys.ArgumentException:
AjaxControlToolKit.Animation.Animation.set_animati onTarget requires
the ID
of a Sys.UI.DomElement or a Sys.UI.Control. No element or control
could be
found corresponding to 'Panel1'
Parameter name: id
-----------
Any help is greatly appreciated!
Mike

Being a newbie on this myself, I had a table in an updatepanel and
was getting the same/similar error (from memory).

I had to do something in the codebehind in the page_load method like:

if (table1 == null) table1 = new Table()

then I had to add it to the form using

form1.Controls.Add(table1).

Not sure quite why I had to do this, but it seemed to fix the problem.
----------------
AndyW,
Mercenary Software Developer
The error stems from the fact that MasterPages mangle the ID of
controls - Panel1 becomes ctl00_ContentPlaceHolder1_Panel1 (in my
case).
If I hard code this in, it works fine. Maybe creating the
AnimationExtender at runtime in PageLoad would allow me to set the
AnimationTarget to the correct ID, which I can find by using
FindControl. I'll play with it and see.

Mike

Feb 22 '07 #5
On 22 Feb 2007 05:05:04 -0800, mi**@5starserv.com wrote:
>
The error stems from the fact that MasterPages mangle the ID of
controls - Panel1 becomes ctl00_ContentPlaceHolder1_Panel1 (in my
case).
If I hard code this in, it works fine. Maybe creating the
AnimationExtender at runtime in PageLoad would allow me to set the
AnimationTarget to the correct ID, which I can find by using
FindControl. I'll play with it and see.
The control's ClientID property will provide the control's decorated
name.The assignment

AnimationExtender.AnimationTarget = Panel1.ClientID;

or something similar should work FB

regards
A.G.
Feb 22 '07 #6
On 22 Feb 2007 05:05:04 -0800, mi**@5starserv.com wrote:
>On Feb 21, 5:29 pm, AndyW <a...@b.no.emailwrote:
>On 20 Feb 2007 09:34:47 -0800, m...@5starserv.com wrote:
>Sys.ArgumentException:
AjaxControlToolKit.Animation.Animation.set_animat ionTarget requires
the ID
of a Sys.UI.DomElement or a Sys.UI.Control. No element or control
could be
found corresponding to 'Panel1'
Parameter name: id
-----------
>Any help is greatly appreciated!
>Mike

Being a newbie on this myself, I had a table in an updatepanel and
was getting the same/similar error (from memory).

I had to do something in the codebehind in the page_load method like:

if (table1 == null) table1 = new Table()

then I had to add it to the form using

form1.Controls.Add(table1).

Not sure quite why I had to do this, but it seemed to fix the problem.
----------------
AndyW,
Mercenary Software Developer

The error stems from the fact that MasterPages mangle the ID of
controls - Panel1 becomes ctl00_ContentPlaceHolder1_Panel1 (in my
case).
If I hard code this in, it works fine. Maybe creating the
AnimationExtender at runtime in PageLoad would allow me to set the
AnimationTarget to the correct ID, which I can find by using
FindControl. I'll play with it and see.

Mike
I think there is a UniqueID property.

So something like Panel1.UniqueId.ToString.

I'd have to check tho.

----------------
AndyW,
Mercenary Software Developer
Feb 22 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Alan Silver | last post by:
Hello, In classic ASP, I used to use two include files on each page, one before and one after the main content, to provide a consistent layout across a web site. That way I could just change the...
6
by: Dorte | last post by:
Hi, I use master pages for ensuring a consistent layout on my app. I need to add client side functionality to my server controls. I do this in page_load (server side) like this:...
5
by: Vincent A. | last post by:
Hello, I'm developping an asp.net application which used master page on which i add several web control. One of the them is a menu control which as several button in order to develop each sub...
2
by: igotyourdotnet | last post by:
Is there a way to prevent the master page to reload every time the user makes a selection off of the menu? I want to give it a "Frame" like appearance were only the content section changes with a...
3
by: Shailesh Patel | last post by:
Hi, Where can I find good tutorial for AJAX with Masterpages. Thank you in advance. Shailesh
1
by: =?Utf-8?B?TGFycnkgRXBu?= | last post by:
I have an app using Ajax. The scriptmanager is within the form that is within the master page. I also have web user controls that are doing partial rendering and are "borrowing" or "inheriting"...
4
by: Annie | last post by:
Hi guys, I am having a weired situation that don't know how to handle it ... I have master pages, the master page contains a dynaic menu which is set up in the database and has page url, name,...
2
by: =?Utf-8?B?REo=?= | last post by:
I have a peculiar problem here that I did not have until I migrated from ASP.NET 2.0 to 3.5. I use a master page for my application. Because the master page uses update panels I have the...
10
by: =?Utf-8?B?RGFuaQ==?= | last post by:
Hi, Trying to create a master page that holds a menu, and the menu switches between pages in the site. 2 problem arrosed: a. When I navigate from page to page (all AJAX Web Forms, with the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.