473,770 Members | 4,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 AJAXControlTool kit template and
default.aspx as follows.

<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs" Inherits="_Defa ult" %>

<!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>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptMana ger ID="ScriptManag er1" 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:LinkButt on ID="LinkButton1 "
runat="server"> LinkButton</asp:LinkButton> <br />
<ajaxToolkit:An imationExtender ID="AnimationEx tender1"
runat="server" TargetControlID ="LinkButton 1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>

</ajaxToolkit:Ani mationExtender>
</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.mast er"
AutoEventWireup ="true" CodeFile="ATKTe st.aspx.cs" Inherits="ATKTe st"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" 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:LinkButt on ID="LinkButton1 " runat="server"> AM -
Amplitude</asp:LinkButton> <br />
<ajaxToolkit:An imationExtender ID="AnimationEx tender1"
runat="server" TargetControlID ="LinkButton 1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>

</ajaxToolkit:Ani mationExtender>
</div>
</asp:Content>

this page does not work and generates a Javascript error as follows:
----------
Sys.ArgumentExc eption:
AjaxControlTool Kit.Animation.A nimation.set_an imationTarget requires
the ID
of a Sys.UI.DomEleme nt 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 6819
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 AJAXControlTool kit template and
default.aspx as follows.

<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs" Inherits="_Defa ult" %>

<!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>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptMana ger ID="ScriptManag er1" 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:LinkButt on ID="LinkButton1 "
runat="server"> LinkButton</asp:LinkButton> <br />
<ajaxToolkit:An imationExtender ID="AnimationEx tender1"
runat="server" TargetControlID ="LinkButton 1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>

</ajaxToolkit:Ani mationExtender>
</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.mast er"
AutoEventWireup ="true" CodeFile="ATKTe st.aspx.cs" Inherits="ATKTe st"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" 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:LinkButt on ID="LinkButton1 " runat="server"> AM -
Amplitude</asp:LinkButton> <br />
<ajaxToolkit:An imationExtender ID="AnimationEx tender1"
runat="server" TargetControlID ="LinkButton 1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>

</ajaxToolkit:Ani mationExtender>
</div>
</asp:Content>

this page does not work and generates a Javascript error as follows:
----------
Sys.ArgumentExc eption:
AjaxControlTool Kit.Animation.A nimation.set_an imationTarget requires
the ID
of a Sys.UI.DomEleme nt 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 AJAXControlTool kit template and
default.aspx as follows.
<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Defau lt.aspx.cs" Inherits="_Defa ult" %>
<!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>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptMana ger ID="ScriptManag er1" 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:LinkButt on ID="LinkButton1 "
runat="server"> LinkButton</asp:LinkButton> <br />
<ajaxToolkit:An imationExtender ID="AnimationEx tender1"
runat="server" TargetControlID ="LinkButton 1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>
</ajaxToolkit:Ani mationExtender>
</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.mast er"
AutoEventWireup ="true" CodeFile="ATKTe st.aspx.cs" Inherits="ATKTe st"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" 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:LinkButt on ID="LinkButton1 " runat="server"> AM -
Amplitude</asp:LinkButton> <br />
<ajaxToolkit:An imationExtender ID="AnimationEx tender1"
runat="server" TargetControlID ="LinkButton 1">
<Animations>
<OnHoverOver>
<FadeIn AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOver>
<OnHoverOut>
<FadeOut AnimationTarget ="Panel1" Duration=".
5" />
</OnHoverOut>
</Animations>
</ajaxToolkit:Ani mationExtender>
</div>
</asp:Content>
this page does not work and generates a Javascript error as follows:
----------
Sys.ArgumentExc eption:
AjaxControlTool Kit.Animation.A nimation.set_an imationTarget requires
the ID
of a Sys.UI.DomEleme nt 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.ArgumentEx ception:
AjaxControlToo lKit.Animation. Animation.set_a nimationTarget requires
the ID
of a Sys.UI.DomEleme nt 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.emai lwrote:
On 20 Feb 2007 09:34:47 -0800, m...@5starserv. com wrote:
Sys.ArgumentExc eption:
AjaxControlTool Kit.Animation.A nimation.set_an imationTarget requires
the ID
of a Sys.UI.DomEleme nt 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_ContentPl aceHolder1_Pane l1 (in my
case).
If I hard code this in, it works fine. Maybe creating the
AnimationExtend er 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_ContentPl aceHolder1_Pane l1 (in my
case).
If I hard code this in, it works fine. Maybe creating the
AnimationExten der at runtime in PageLoad would allow me to set the
AnimationTarge t 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

AnimationExtend er.AnimationTar get = 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.emai lwrote:
>On 20 Feb 2007 09:34:47 -0800, m...@5starserv. com wrote:
>Sys.ArgumentEx ception:
AjaxControlToo lKit.Animation. Animation.set_a nimationTarget requires
the ID
of a Sys.UI.DomEleme nt 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_ContentPl aceHolder1_Pane l1 (in my
case).
If I hard code this in, it works fine. Maybe creating the
AnimationExten der at runtime in PageLoad would allow me to set the
AnimationTarge t 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
2428
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 include files to change the layout. When I came to ASP.NET, I used user controls to do a similar thing. I have just been looking at master pages, and it looks like they do the same thing. If so, is there any advantage in using them over the...
6
3906
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: DropDownList1.Attributes.Add("onchange", "Test();"); I add a javascript function ("Test") to the page that changes the disabled property of several server controls when DropDownList1 has changed. In an
5
3480
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 menu. When i click on this button it rises a postback and refresh all my controls. My question is the following : is it possible the postback acts only on one web control ? Thanks in advance
2
3861
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 menu selection.
3
5287
by: Shailesh Patel | last post by:
Hi, Where can I find good tutorial for AJAX with Masterpages. Thank you in advance. Shailesh
1
7558
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" the scriptmanager from the master page. Heck, when they're rendered, the scriptmanager is on all the pages and it works. However, in the VS2005 designer, I constantly see "Can't render image" errors, and it's nearly impossible to effectively use...
4
1605
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, title etc. The menu is loaded dynamically at run time. The problem that I have is that once the users are selecting any menu option (eg a link) i should manage to save current page content and
2
5539
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 scriptmanager control on the master page. Any pages in the app that uses the master page under 2.0 automatically used that script manager if any AJAX controls were involved. Everything was well with the world and we all sang ohmmmmmmmmmmmm.... After...
10
2146
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 Master pages as their master...) the entire page is refreshed - also the menu which belongs to the master, how can I fix it - so only the inside content will be refreshed ?
0
9602
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9439
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10071
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7431
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.