Atlas not working with content and master pages

Rate It (3)

Last post 11-20-2006 10:33 AM by sje. 43 replies.

Sort Posts:

  • Re: Atlas not working with content and master pages

    04-10-2006, 7:36 PM
    • Member
      10 point Member
    • asgeirgs
    • Member since 04-07-2006, 3:07 PM
    • Posts 2

    I have the same problem when I deploy the website (works fine on dev machine)

    I have found that it matters for some strange reason if the website is deployed to the root (www.somesite.com) or if it is deployed as say (www.somesite.com/subapp).

    It works fine when deployed to the root and not at all when deployed to sub dir.

    This must be a bug !

    Regards,

    Asgeir

  • Re: Atlas not working with content and master pages

    04-10-2006, 11:26 PM

    This is true. I am trying it now and ATLAS works fine on a page without master page. There's no flicker of page postback when i'm switching views of multiview control. When i create another page with master page and use same code, there's postback when switching view.

     

  • Re: Atlas not working with content and master pages

    04-11-2006, 11:40 AM
    • Member
      140 point Member
    • dbRip
    • Member since 11-03-2004, 12:19 PM
    • Posts 30
    yea, I can't get this to work not matter where i put my ScriptManager and UpdatePanel tags. I've taken out <script> tags and there are no underscores . . . .i keep getting a alert box that says "exception has been thrown by the target of an invocation" . . .
  • Re: Atlas not working with content and master pages

    04-11-2006, 12:18 PM
    • Member
      520 point Member
    • LordHits
    • Member since 07-22-2002, 10:22 AM
    • Lisle, IL USA
    • Posts 104

    Ok, I could swear this was working on the version prior to the March CTP. Maybe it's changed on the March CTP. Hopefully Bertand or Nikhil is monitoring this thread and can give us some feedback.

    H

  • Re: Atlas not working with content and master pages

    04-11-2006, 2:43 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368

    hello.

    any chance of putting a small page+master that reproduces the problem?  this will improve your chances of getting an answer on this...

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: Atlas not working with content and master pages

    05-01-2006, 5:24 PM
    • Member
      10 point Member
    • bradgagne
    • Member since 05-01-2006, 8:52 PM
    • Posts 2

    I've only just started playing with Atlas for the last week or so, but experienced the same problem as the original post.  However I think I've figured out why it happens, and how you can get around it. 

    First, an explanation of my setup:

    1. A Master Page with two content placeholders called "LeftColumn" and "RightColumn"
    2. A regular Page (i.e. "Content Page") that uses the master page and overrides both content placeholders to provide its own content as follows:
      1. A LinkButton in LeftColumn called btnTest that updates a Label named lblTest
      2. An UpdatePanel in RightColumn defined as follows:

    <

    ATLAS:UPDATEPANEL id="pnlTest" runat="server">

    <

    CONTENTTEMPLATE>

    <ASP:LABEL id="lblTest" runat="server">my ATLAS test label</ASP:LABEL>

    </

    CONTENTTEMPLATE>

    <TRIGGERS>

    </TRIGGERS>

    </

    ATLAS:UPDATEPANEL>

    Note the emtpy "Triggers" element.  If we add a trigger for btnTest we end up with this ugly error:

    The ControlID property of the trigger must reference a valid control.

    Instead of declaring the Trigger up front, we're going to add it programmatically... I'll explain why below.

    If I'm understanding things correctly, the problem arises because of a combincation of factors:

    1. the UpdatePanel registers its triggers in the Init() stage of the Page lifecycle
    2. The btnTest LinkButton actually ends up with a client-side ID of ctl00_cphRightColumn_btnTest, since it is contained not only within the ASP:CONTENT element, but also the MasterPage (which your Page treats as yet another User Control... more on this later) 

    So your UpdatePanel is looking for a Click event raised by a control named btnTest, but by the time your page loads and renders itself, your button is called something completely different... I don't completely understand it, but it's almost like the ScriptManager is still smart enough to fire the LinkButton's Click() event through AJAX, but the UpdatePanel is looking for an event from btnTest instead of ctl00_cphRightColumn_btnTest so it doesn't bother updating itself.  As a result, it appears that nothing happens (and yet with a breakpoint we can see that our PostBack really is happening!).  Just a guess.

    To address this problem I added a bit of code to my OnInit() handler:

    protected override void OnInit(EventArgs e)

    {

    base.OnInit(e);

    ControlEventTrigger trigger = new ControlEventTrigger();

    trigger.ControlID = btnTest.UniqueID;

    trigger.EventName =

    "Click";

    pnlTest.Triggers.Add(trigger);

    }

    Pretty self-explanatory... I simply add a trigger to my UpdatePanel with the ID that my LinkButton is going to have when it is rendered.  Note that I use btnTest.UniqueID (and not .ClientID) because of the problem with underscores that another poster has already mentioned.

    With this code in place my postback works through AJAX and my UpdatePanel updates itself without a full Page PostBack.

    Here is a great article that helped me semi-understand how Master Pages worked (including an explanation of how your Page treats its MasterPage like a UserControl, whcih helped me deduce what was going wrong and why): http://www.odetocode.com/Articles/450.aspx

  • Re: Atlas not working with content and master pages

    05-01-2006, 5:26 PM
    • Member
      10 point Member
    • bradgagne
    • Member since 05-01-2006, 8:52 PM
    • Posts 2
    Oops, sorry about that messed-up HTML formatting.  Smile [:)]
  • Re: Atlas not working with content and master pages

    05-02-2006, 4:22 AM
    • Member
      20 point Member
    • Lion_1
    • Member since 05-02-2006, 7:53 AM
    • Posts 4

    hey there

    i have the same problem, but different. Trying to implement atlas in existing project, it happend that using an asmx with atlas is no trouble at all! Although using a masterpage.

    <atlas:ScriptManager ID="ScriptManager" runat="server" EnableScriptComponents="false">
     <Services>
      <atlas:ServiceReference Path="test.asmx" />
     </Services>
    </atlas:ScriptManager>

    BUT:

    now I wanted to use the updatepanel to be able to change a second listbox according to the selection made in the first listbox with atlas. Doing this on a plain page no master etc. it works fine. using my master it doesnt change the second listbox. Now I tried all that mentioned here, creating a plain masterpage with only one contentplaceholder which is beeing populated in the content page... but it still doesn't work although there's no JS and no underscores and so on...

    Any Ideas?

     

  • Re: Atlas not working with content and master pages

    05-02-2006, 4:37 AM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    bradgagne:

    So your UpdatePanel is looking for a Click event raised by a control named btnTest, but by the time your page loads and renders itself, your button is called something completely different... I don't completely understand it, but it's almost like the ScriptManager is still smart enough to fire the LinkButton's Click() event through AJAX, but the UpdatePanel is looking for an event from btnTest instead of ctl00_cphRightColumn_btnTest so it doesn't bother updating itself.  As a result, it appears that nothing happens (and yet with a breakpoint we can see that our PostBack really is happening!).  Just a guess.

    you're almost on the tight track. to get the full picture, you'll have to look at the atlas source files and at the code that is generated on the page presented by the browser. what happens is that when you set a trigger, you're adding the ID of an element to a special collection maintained by the pagerequestmanager control. so, as you have found out, you really need to get the correct client id for element that will trigger the postback.

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: Atlas not working with content and master pages

    05-02-2006, 4:42 AM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368

    hello.

    so, in your scenario, are you using triggers?  can you show us your code?

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: Atlas not working with content and master pages

    05-04-2006, 2:22 AM
    • Member
      20 point Member
    • Lion_1
    • Member since 05-02-2006, 7:53 AM
    • Posts 4
     
    <%@ Page Language="VB"
    	CodeFile="src/Kopievonkka.aspx.vb" 
    	Inherits="kkaPage"
    	AutoEventWireup="true"
    	MasterPageFile="~/masterpages/Kopievoncontent.master" 
    %>
    <asp:content runat="server" ContentPlaceHolderId="ContentContent">
    	<form id="form1" runat="server">
    		<div id="test" runat="server">
    			<atlas:ScriptManager ID="scriptmanager1" EnablePartialRendering="true" runat="Server" />
    			<atlas:UpdatePanel ID="TableUpdatePanel" runat="server">
    				<ContentTemplate>
    				<div id="test1" runat="server">
    					<asp:ListBox runat="server"
    						ID="ListBox1"
    						AutoPostBack="true"
    						DataValueField="ID"
    						DataTextField="Bezeichnung"
    						OnSelectedIndexChanged="ListBoxSelectedIndexChanged"
    						Width="300"
    						Height="200"></asp:ListBox>
    				</div>
    				<div id="test2" runat="server">
    					<asp:ListBox runat="server"
    						ID="ListBox2"
    						AutoPostBack="true"
    						DataValueField="ID"
    						DataTextField="Bezeichnung"
    						OnSelectedIndexChanged="ListBoxSelectedIndexChanged"
    						Visible="false"
    						Width="300"
    						Height="200"></asp:ListBox>
    				</div>
    				</ContentTemplate>
    			</atlas:UpdatePanel>
    		</div>
    		<div id="laden">
    			<atlas:UpdateProgress ID="progres1" runat="server">
    				<ProgressTemplate>
    					<div>
    						<font color="firebrick" face ="Arial" size="3"><img src="indicator.gif">&nbsp;<strong><i>die Daten werden geladen ...</i></strong></font>
    					</div>
    				</ProgressTemplate>
    			</atlas:UpdateProgress>
    		</div>
    	</form>
    </asp:content>
    ___________________________________________________________________
    	Public Sub ListBoxSelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    		Dim iCount As Integer
    		Dim objDataTable As DataTable
    		iCount = sender.ID.substring(sender.ID.length()-1,1)
    		objDataTable = getKategories(iThema, iCount, sender.SelectedItem.Value)
    		iCount = iCount + 1
    		Dim lb As ListBox = FindControl( "ListBox" & iCount )
    		If (Not lb Is Nothing)
    			lb.Visible = false
    		End If
    		If ((NOT objDataTable.Equals(NOTHING)) AND (NOT objDataTable.Rows.Equals(NOTHING)) AND (objDataTable.Rows.Count>0)) Then
    			If (Not lb Is Nothing)
    				lb.Visible = true
    				lb.DataSource = objDataTable
    				lb.DataBind()
    			End If
    		End If
    		For i As Integer = iCount+1 To 5
    			Dim control As ListBox = FindControl( "ListBox" & i )
    			If (Not control Is Nothing)
    				control.Visible = false
    			End If
    		Next
    	End Sub
    
     
  • Re: Atlas not working with content and master pages

    05-04-2006, 5:48 AM
    • Member
      20 point Member
    • Lion_1
    • Member since 05-02-2006, 7:53 AM
    • Posts 4

    ok.

    found out some stuff myself:

    it looks like Atlas doesn't like something like:

    ...script for=document event="onkeydown()" language="JScript"...

    well I had that inside my Masterpage!

    But thats not enough:

    also Atlas didn't like my stylesheet reference in the HTML-Head. putting it in the HTML-Body solved the problem. But then I have two stylesheet references underneath each other, works fine until the first Atlas callback happens, after that it seemed to ignore the first of the two:

    doing something like:

    <link rel=""stylesheet"" href="firstCSS.css" type=""text/css"">
    <link rel=""stylesheet"" href="secondCSS.css" type=""text/css"">
    <link rel=""stylesheet"" href="firstCSS.css" type=""text/css"">

    got it convinced...

    but unfortunatly I ain't got any idea why...

     

     
  • Re: Atlas not working with content and master pages

    05-19-2006, 7:06 PM
    • Member
      5 point Member
    • Mikep
    • Member since 05-19-2006, 11:01 PM
    • Posts 1
    Have the same problem as everyone else, and have tried the above code sample. It now finds the control (A button) properly BUT I am now getting the following error:

    The EventName must be set to a valid event name on the associated control

    So it looks like the master page is mangling the name of the event as well??

    My code was the same as above basically:

    protected

    override void OnInit(EventArgs e)

    {

    base.OnInit(e);

    ControlEventTrigger trigger = new ControlEventTrigger();

    trigger.ControlID = this.Button_StackTrace.UniqueID;

    trigger.EventName = "ButtonStackTraceClick";

    updateID1.Triggers.Add(trigger);

     

    }

     

    You can see that Event name is the non magled name. How do I get the mangled name at runtime?

    Thanx

  • Re: Atlas not working with content and master pages

    05-20-2006, 8:01 AM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368

    hello.

    setting it to Click should be enough (you're using a button, right?)

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: Atlas not working with content and master pages

    06-26-2006, 5:34 AM
    • Member
      91 point Member
    • roopkt
    • Member since 06-21-2006, 6:18 AM
    • Mumbai
    • Posts 100

    Hi,

    I read all the discussions and I do have the same problem in master page.

    But i want to implement atlas only in the master page not in content page.

    And when ever i am trying to do in master page it simply throws an jerror "PageMethods is undefined".

    Can any one help me please do reply.

    regards

    Rupesh

    Rupesh kumar Tiwari
    India
Page 2 of 3 (44 items) < Previous 1 2 3 Next >