Can you use an Accordion control in a masterpage?

G

Guest

Hi All - My Accordion control works fine until I move it into a master page;

Does anybody have an example of an Accordion control working entirely in the
masterpage.master file?


When I check the client src generated i find:

// this works on Default.aspx
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('Scriptmanager1',
document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>

// this page does not function
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ctl00$Scriptmanager1',
document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>
 
G

Guest

I am still testing...

this page works:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs"
Inherits="Default6" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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"
EnablePartialRendering="true"></asp:ScriptManager>
<script language="javascript" type="text/javascript">
function Openpane(paneIndex,eventElement) {
var behavior = $get("Accordion1").AccordionBehavior;
behavior.set_SelectedIndex(paneIndex);
}
</script>
<cc1:Accordion ID="Accordion1" runat="server" ContentCssClass="dimgreen"
FadeTransitions="false" FramesPerSecond="25"
TransitionDuration="250" HeaderCssClass="grey"
EnableViewState="false" SelectedIndex="-1"
SuppressHeaderPostbacks="true">
<Panes>
<cc1:AccordionPane runat="server" ID="PaneOne">
<Header>
<span
onmouseover="Openpane('0',event)">Accordion</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 1
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane1">
<Header>
<span onmouseover="Openpane('1',event)">Open
Panes</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 2
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane2">
<Header>
<span onmouseover="Openpane('2',event)">On
MouseOver</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 3
<br />
<br />
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
</form>
</body>
</html>

IN THE SAME APP this page does not work:

<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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"
EnablePartialRendering="true"></asp:ScriptManager>
<script language="javascript" type="text/javascript">
function Openpane(paneIndex,eventElement) {
var behavior = $get("Accordion1").AccordionBehavior;
behavior.set_SelectedIndex(paneIndex);
}
</script>
<div>
<cc1:Accordion ID="Accordion1" runat="server" ContentCssClass="dimgreen"
FadeTransitions="false" FramesPerSecond="25"
TransitionDuration="250" HeaderCssClass="grey"
EnableViewState="false" SelectedIndex="-1"
SuppressHeaderPostbacks="true">
<Panes>
<cc1:AccordionPane runat="server" ID="PaneOne">
<Header>
<span
onmouseover="Openpane('0',event)">Accordion</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 1
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane1">
<Header>
<span onmouseover="Openpane('1',event)">Open
Panes</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 2
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane2">
<Header>
<span onmouseover="Openpane('2',event)">On
MouseOver</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 3
<br />
<br />
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>

<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>

i AM NOT SURE WHAT NEEDS TO CHANGED????

Nate said:
Hi All - My Accordion control works fine until I move it into a master page;

Does anybody have an example of an Accordion control working entirely in the
masterpage.master file?


When I check the client src generated i find:

// this works on Default.aspx
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('Scriptmanager1',
document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>

// this page does not function
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ctl00$Scriptmanager1',
document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>
 
B

bruce barker

try:

var behavior = $get("<%=Accordion1.ClientId%>").AccordionBehavior;

-- bruce (sqlwork.com)
I am still testing...

this page works:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs"
Inherits="Default6" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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"
EnablePartialRendering="true"></asp:ScriptManager>
<script language="javascript" type="text/javascript">
function Openpane(paneIndex,eventElement) {
var behavior = $get("Accordion1").AccordionBehavior;
behavior.set_SelectedIndex(paneIndex);
}
</script>
<cc1:Accordion ID="Accordion1" runat="server" ContentCssClass="dimgreen"
FadeTransitions="false" FramesPerSecond="25"
TransitionDuration="250" HeaderCssClass="grey"
EnableViewState="false" SelectedIndex="-1"
SuppressHeaderPostbacks="true">
<Panes>
<cc1:AccordionPane runat="server" ID="PaneOne">
<Header>
<span
onmouseover="Openpane('0',event)">Accordion</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 1
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane1">
<Header>
<span onmouseover="Openpane('1',event)">Open
Panes</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 2
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane2">
<Header>
<span onmouseover="Openpane('2',event)">On
MouseOver</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 3
<br />
<br />
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
</form>
</body>
</html>

IN THE SAME APP this page does not work:

<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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"
EnablePartialRendering="true"></asp:ScriptManager>
<script language="javascript" type="text/javascript">
function Openpane(paneIndex,eventElement) {
var behavior = $get("Accordion1").AccordionBehavior;
behavior.set_SelectedIndex(paneIndex);
}
</script>
<div>
<cc1:Accordion ID="Accordion1" runat="server" ContentCssClass="dimgreen"
FadeTransitions="false" FramesPerSecond="25"
TransitionDuration="250" HeaderCssClass="grey"
EnableViewState="false" SelectedIndex="-1"
SuppressHeaderPostbacks="true">
<Panes>
<cc1:AccordionPane runat="server" ID="PaneOne">
<Header>
<span
onmouseover="Openpane('0',event)">Accordion</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 1
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane1">
<Header>
<span onmouseover="Openpane('1',event)">Open
Panes</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 2
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane2">
<Header>
<span onmouseover="Openpane('2',event)">On
MouseOver</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 3
<br />
<br />
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>

<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>

i AM NOT SURE WHAT NEEDS TO CHANGED????

Nate said:
Hi All - My Accordion control works fine until I move it into a master page;

Does anybody have an example of an Accordion control working entirely in the
masterpage.master file?


When I check the client src generated i find:

// this works on Default.aspx
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('Scriptmanager1',
document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>

// this page does not function
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ctl00$Scriptmanager1',
document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>
 
G

Guest

Thanks Bruce,

I get comile error:
error CS0117: 'AjaxControlToolkit.Accordion' does not contain a definition
for 'ClientId'

any ideas?

- Nate

bruce barker said:
try:

var behavior = $get("<%=Accordion1.ClientId%>").AccordionBehavior;

-- bruce (sqlwork.com)
I am still testing...

this page works:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs"
Inherits="Default6" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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"
EnablePartialRendering="true"></asp:ScriptManager>
<script language="javascript" type="text/javascript">
function Openpane(paneIndex,eventElement) {
var behavior = $get("Accordion1").AccordionBehavior;
behavior.set_SelectedIndex(paneIndex);
}
</script>
<cc1:Accordion ID="Accordion1" runat="server" ContentCssClass="dimgreen"
FadeTransitions="false" FramesPerSecond="25"
TransitionDuration="250" HeaderCssClass="grey"
EnableViewState="false" SelectedIndex="-1"
SuppressHeaderPostbacks="true">
<Panes>
<cc1:AccordionPane runat="server" ID="PaneOne">
<Header>
<span
onmouseover="Openpane('0',event)">Accordion</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 1
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane1">
<Header>
<span onmouseover="Openpane('1',event)">Open
Panes</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 2
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane2">
<Header>
<span onmouseover="Openpane('2',event)">On
MouseOver</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 3
<br />
<br />
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
</form>
</body>
</html>

IN THE SAME APP this page does not work:

<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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"
EnablePartialRendering="true"></asp:ScriptManager>
<script language="javascript" type="text/javascript">
function Openpane(paneIndex,eventElement) {
var behavior = $get("Accordion1").AccordionBehavior;
behavior.set_SelectedIndex(paneIndex);
}
</script>
<div>
<cc1:Accordion ID="Accordion1" runat="server" ContentCssClass="dimgreen"
FadeTransitions="false" FramesPerSecond="25"
TransitionDuration="250" HeaderCssClass="grey"
EnableViewState="false" SelectedIndex="-1"
SuppressHeaderPostbacks="true">
<Panes>
<cc1:AccordionPane runat="server" ID="PaneOne">
<Header>
<span
onmouseover="Openpane('0',event)">Accordion</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 1
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane1">
<Header>
<span onmouseover="Openpane('1',event)">Open
Panes</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 2
<br />
<br />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane2">
<Header>
<span onmouseover="Openpane('2',event)">On
MouseOver</span>
</Header>
<Content>
<br />
<br />
Expand Accordion Panes on Mouse Over :: Pane 3
<br />
<br />
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>

<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>

i AM NOT SURE WHAT NEEDS TO CHANGED????

Nate said:
Hi All - My Accordion control works fine until I move it into a master page;

Does anybody have an example of an Accordion control working entirely in the
masterpage.master file?


When I check the client src generated i find:

// this works on Default.aspx
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('Scriptmanager1',
document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>

// this page does not function
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ctl00$Scriptmanager1',
document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top