How to switch content page?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben

    How to switch content page?

    Hi,

    i'm trying to build a simple site navigation (using c#)... i
    implemented a master page that shows a sidebar user control on the
    left side, and a content page on the right.

    i click the link on the sidebar which calls Redirect.

    problem is that the whole page refreshes... i just want the right side
    to update to a new content.

    can anyone point me in the right direction to accomplish this?

    btw, i'm trying to use ajax when possible to make the job easier...
    but if i put the sidebar in an UpdatePanel (in hopes of avoiding a
    refresh) it gives this error:

    "Sys.WebForms.P ageRequestManag erParserErrorEx ception: The message
    received from the server could not be parsed. Common causes for this
    error are when the response is modified by calls to Response.Write( )"


    Thanks for any info you can give!
  • Alexey Smirnov

    #2
    Re: How to switch content page?

    On Mar 9, 11:26 am, Ben <benm5...@gmail .comwrote:
    Hi,
    >
    i'm trying to build a simple site navigation (using c#)... i
    implemented a master page that shows a sidebar user control on the
    left side, and a content page on the right.
    >
    i click the link on the sidebar which calls Redirect.
    >
    problem is that the whole page refreshes... i just want the right side
    to update to a new content.
    >
    can anyone point me in the right direction to accomplish this?
    >
    btw, i'm trying to use ajax when possible to make the job easier...
    but if i put the sidebar in an UpdatePanel (in hopes of avoiding a
    refresh) it gives this error:
    >
    "Sys.WebForms.P ageRequestManag erParserErrorEx ception: The message
    received from the server could not be parsed. Common causes for this
    error are when the response is modified by calls to Response.Write( )"
    >
    Thanks for any info you can give!

    Comment

    • Mark Rae [MVP]

      #3
      Re: How to switch content page?

      "Ben" <benm5678@gmail .comwrote in message
      news:e5befd3d-8521-4c90-acec-c9bcc67bca67@e3 1g2000hse.googl egroups.com...
      Thanks Mark -- That's why I looked into master pages, since i read
      that framesets are a thing of the past...
      >
      but isn't there some solution to just re-load the right side (the
      content) and leave the left (the menu sidebar) intact?
      Not with MasterPages...
      It doesn't look professional when the whole page refreshes every time
      someone clicks a new menu item....
      That's the way the web works...
      or is the only way to accomplish this using framesets?!?
      One of the main features of MasterPages is the server-side interoperabilit y
      between the content pages and MasterPages - you can't really do this with
      framesets or iframes, so you're left with client-side JavaScript.

      Obviously, you could create an asp:Literal control and fill it dynamically
      with HTML, but that would mean that you would lose all of the server-side
      ASP.NET functionality.

      I would strongly advise you to stick with MasterPages - once you've got the
      hang of them, you'll wonder how you ever managed without them...


      --
      Mark Rae
      ASP.NET MVP


      Comment

      • Ben

        #4
        Re: How to switch content page?

        On Mar 9, 9:22 am, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
        "Ben" <benm5...@gmail .comwrote in message
        >
        news:e5befd3d-8521-4c90-acec-c9bcc67bca67@e3 1g2000hse.googl egroups.com...
        >
        Thanks Mark -- That's why I looked into master pages, since i read
        that framesets are a thing of the past...
        >
        but isn't there some solution to just re-load the right side (the
        content) and leave the left (the menu sidebar) intact?
        >
        Not with MasterPages...
        >
        It doesn't look professional when the whole page refreshes every time
        someone clicks a new menu item....
        >
        That's the way the web works...
        >
        or is the only way to accomplish this using framesets?!?
        >
        One of the main features of MasterPages is the server-side interoperabilit y
        between the content pages and MasterPages - you can't really do this with
        framesets or iframes, so you're left with client-side JavaScript.
        >
        Obviously, you could create an asp:Literal control and fill it dynamically
        with HTML, but that would mean that you would lose all of the server-side
        ASP.NET functionality.
        >
        I would strongly advise you to stick with MasterPages - once you've got the
        hang of them, you'll wonder how you ever managed without them...
        >
        --
        Mark Rae
        ASP.NET MVPhttp://www.markrae.net
        yea, i want to avoid dynamically filling the HTML on the client
        side... i was really hoping for the exact same functionality framesets
        provided (being able to reload a particular frame), i just thought
        there's an alternative that would behave in a similar way.

        u know that MSDN page for the subscriber downloads... it's got a
        navigation tree on the left, and it doesn't refresh when you click
        things, just the content pane refreshes... that's what i wanted...
        maybe they're using framesets...

        btw, if there's any recommended book u can suggest that covers these
        topics (i'm using VS 2008 now), let me know, i'd really appreciate
        it... i think i need to get some basics down.

        thanks!!

        Comment

        • Mark Rae [MVP]

          #5
          Re: How to switch content page?

          "Ben" <benm5678@gmail .comwrote in message
          news:deed5e72-f0d2-4438-ad92-5bc185b3542c@2g 2000hsn.googleg roups.com...
          You know that MSDN page for the subscriber downloads... it's got a
          navigation tree on the left, and it doesn't refresh when you click
          things, just the content pane refreshes... that's what I wanted...
          maybe they're using framesets...
          The "content" pages are static HTML stored in a database...

          BTW, if there's any recommended book you can suggest that covers these
          topics (I'm using VS 2008 now), let me know, I'd really appreciate
          it... I think I need to get some basics down.




          --
          Mark Rae
          ASP.NET MVP


          Comment

          • Regan

            #6
            Re: How to switch content page?

            It might be easier for you to consider building your side menus into your
            content pages instead of the master page. Then you could definitely do
            partial page updates using nested update panels.

            Regan



            "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
            news:OFbfAffgIH A.6092@TK2MSFTN GP06.phx.gbl...
            "Ben" <benm5678@gmail .comwrote in message
            news:deed5e72-f0d2-4438-ad92-5bc185b3542c@2g 2000hsn.googleg roups.com...
            >
            >You know that MSDN page for the subscriber downloads... it's got a
            >navigation tree on the left, and it doesn't refresh when you click
            >things, just the content pane refreshes... that's what I wanted...
            >maybe they're using framesets...
            >
            The "content" pages are static HTML stored in a database...
            >
            BTW, if there's any recommended book you can suggest that covers these
            topics (I'm using VS 2008 now), let me know, I'd really appreciate
            it... I think I need to get some basics down.
            >

            >
            >
            --
            Mark Rae
            ASP.NET MVP
            http://www.markrae.net

            Comment

            • Mark Rae [MVP]

              #7
              Re: How to switch content page?

              "Regan" <regan.thomas@h otmail.comwrote in message
              news:OAyBuVggIH A.4880@TK2MSFTN GP03.phx.gbl...
              >>You know that MSDN page for the subscriber downloads... it's got a
              >>navigation tree on the left, and it doesn't refresh when you click
              >>things, just the content pane refreshes... that's what I wanted...
              >>maybe they're using framesets...
              >>
              >The "content" pages are static HTML stored in a database...
              >>
              >BTW, if there's any recommended book you can suggest that covers these
              >topics (I'm using VS 2008 now), let me know, I'd really appreciate
              >it... I think I need to get some basics down.
              >>
              >http://www.kencox.ca/
              >
              It might be easier for you to consider building your side menus into your
              content pages instead of the master page. Then you could definitely do
              partial page updates using nested update panels.
              Apart from the fact that that would totally defeat the purpose of
              MasterPages...


              --
              Mark Rae
              ASP.NET MVP


              Comment

              • Ben

                #8
                Re: How to switch content page?

                On Mar 9, 12:19 pm, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
                "Regan" <regan.tho...@h otmail.comwrote in message
                >
                news:OAyBuVggIH A.4880@TK2MSFTN GP03.phx.gbl...
                >
                >
                >
                >
                >
                >You know that MSDN page for the subscriber downloads... it's got a
                >navigation tree on the left, and it doesn't refresh when you click
                >things, just the content pane refreshes... that's what I wanted...
                >maybe they're using framesets...
                >
                The "content" pages are static HTML stored in a database...
                >
                BTW, if there's any recommended book you can suggest that covers these
                topics (I'm using VS 2008 now), let me know, I'd really appreciate
                it... I think I need to get some basics down.
                >>
                It might be easier for you to consider building your side menus into your
                content pages instead of the master page. Then you could definitely do
                partial page updates using nested update panels.
                >
                Apart from the fact that that would totally defeat the purpose of
                MasterPages...
                >
                --
                Mark Rae
                ASP.NET MVPhttp://www.markrae.net- Hide quoted text -
                >
                - Show quoted text -
                This is closer to what i need though... i'd rather not use a master
                page in this section if it forces a full refresh.

                I''m testing it now... so built a table with 2 columns in a webform,
                one side has my menu and the other an UpdatePanel.
                On menu item click I load a new Web User Control into the UpdatePanel
                using this code:

                UpdatePanel.Con tentTemplateCon tainer.Controls .Clear();
                UserControl uc =
                (UserControl)Lo adControl(sPath ToWebUI);
                UpdatePanel.Con tentTemplateCon tainer.Controls .Add(uc);

                It has a strange behavior -- when the contol loads, I click on a
                button and it doesn't post back... i click again and only then it
                works... is there anyway to fix this?

                Comment

                • Regan

                  #9
                  Re: How to switch content page?

                  I tried recreating your columns and update panel just to test it. I added a
                  "parent" update panel that holds everything except the Script Manager. And
                  then I dropped a variation of your code into my button onClick, which
                  created a Textbox control in the right column's Update Panel.

                  As expected, the partial post back worked fine. (with the "parent" Update
                  Panel). I would suggest, breaking through your user control; the two-click
                  bug might be in there.



                  I'm not sure what the code for your control looks like.

                  "Ben" <benm5678@gmail .comwrote in message
                  news:909a5f1f-4c14-41bd-a15f-86ed14af1c8c@y7 7g2000hsy.googl egroups.com...
                  On Mar 9, 12:19 pm, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
                  >"Regan" <regan.tho...@h otmail.comwrote in message
                  >>
                  >news:OAyBuVggI HA.4880@TK2MSFT NGP03.phx.gbl.. .
                  >>
                  >>
                  >>
                  >>
                  >>
                  >>You know that MSDN page for the subscriber downloads... it's got a
                  >>navigation tree on the left, and it doesn't refresh when you click
                  >>things, just the content pane refreshes... that's what I wanted...
                  >>maybe they're using framesets...
                  >>
                  >The "content" pages are static HTML stored in a database...
                  >>
                  >BTW, if there's any recommended book you can suggest that covers these
                  >topics (I'm using VS 2008 now), let me know, I'd really appreciate
                  >it... I think I need to get some basics down.
                  >>>>
                  It might be easier for you to consider building your side menus into
                  your
                  content pages instead of the master page. Then you could definitely do
                  partial page updates using nested update panels.
                  >>
                  >Apart from the fact that that would totally defeat the purpose of
                  >MasterPages. ..
                  >>
                  >--
                  >Mark Rae
                  >ASP.NET MVPhttp://www.markrae.net- Hide quoted text -
                  >>
                  >- Show quoted text -
                  >
                  This is closer to what i need though... i'd rather not use a master
                  page in this section if it forces a full refresh.
                  >
                  I''m testing it now... so built a table with 2 columns in a webform,
                  one side has my menu and the other an UpdatePanel.
                  On menu item click I load a new Web User Control into the UpdatePanel
                  using this code:
                  >
                  UpdatePanel.Con tentTemplateCon tainer.Controls .Clear();
                  UserControl uc =
                  (UserControl)Lo adControl(sPath ToWebUI);
                  UpdatePanel.Con tentTemplateCon tainer.Controls .Add(uc);
                  >
                  It has a strange behavior -- when the contol loads, I click on a
                  button and it doesn't post back... i click again and only then it
                  works... is there anyway to fix this?

                  Comment

                  Working...