Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Hidden fields with ajax and master pages

Hidden fields with ajax and master pages

Scheduled Pinned Locked Moved ASP.NET
helpannouncement
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SomeGuyThatIsMe
    wrote on last edited by
    #1

    First off, i dont really like what i'm trying to do,but i'm trying to avoid putting a bunch of stuff in the session. I'm using normal hidden inputs not invisible lables. I have several update panels and have tried putting the inputs in an update panel with UpdateMode="Always" thinking it might help, but i can access the control assign it values, but the values dont persist. It all works fine with postbacks, however when the user clicks Refresh all the values go away. And all this is in a content place holder for a master page. I've tried using invisable labels, enableing and disabling the viewstate on both my page and the master page. assigning values a few different ways, moving the code that reads the values inside and outside of !Page.IsPostBack if's. I've also tried a google, but didnt see anything relevent. I can post whatever code you guys want just not sure what all would be relevent. I've used this type of method before just not sure why it isnt working with the ajax and master page.

    Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

    N 1 Reply Last reply
    0
    • S SomeGuyThatIsMe

      First off, i dont really like what i'm trying to do,but i'm trying to avoid putting a bunch of stuff in the session. I'm using normal hidden inputs not invisible lables. I have several update panels and have tried putting the inputs in an update panel with UpdateMode="Always" thinking it might help, but i can access the control assign it values, but the values dont persist. It all works fine with postbacks, however when the user clicks Refresh all the values go away. And all this is in a content place holder for a master page. I've tried using invisable labels, enableing and disabling the viewstate on both my page and the master page. assigning values a few different ways, moving the code that reads the values inside and outside of !Page.IsPostBack if's. I've also tried a google, but didnt see anything relevent. I can post whatever code you guys want just not sure what all would be relevent. I've used this type of method before just not sure why it isnt working with the ajax and master page.

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Where is the control that is triggering the update? In the master page or the content page? Do you have the hidden fields in an UpdatePanel with a trigger for the control that should cause the refresh?


      only two letters away from being an asset

      S 1 Reply Last reply
      0
      • N Not Active

        Where is the control that is triggering the update? In the master page or the content page? Do you have the hidden fields in an UpdatePanel with a trigger for the control that should cause the refresh?


        only two letters away from being an asset

        S Offline
        S Offline
        SomeGuyThatIsMe
        wrote on last edited by
        #3

        The controls that are causing the updates are all in the content page. The hidden fields are in an update panel with UpdateMode="Always" so it should always postback, though i did get the info from msdn so it may not be accurate. Any other control that can cause a postback is in an update panel with its update mode set to conditional.

        Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        N A 2 Replies Last reply
        0
        • S SomeGuyThatIsMe

          The controls that are causing the updates are all in the content page. The hidden fields are in an update panel with UpdateMode="Always" so it should always postback, though i did get the info from msdn so it may not be accurate. Any other control that can cause a postback is in an update panel with its update mode set to conditional.

          Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          So, trying to follow along. You have two UpdatePanels, and you are trying to update controls in one from events in another? Have you added the controls that trigger the update to the triggers collection of the other?


          only two letters away from being an asset

          S 1 Reply Last reply
          0
          • S SomeGuyThatIsMe

            The controls that are causing the updates are all in the content page. The hidden fields are in an update panel with UpdateMode="Always" so it should always postback, though i did get the info from msdn so it may not be accurate. Any other control that can cause a postback is in an update panel with its update mode set to conditional.

            Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            SomeGuyThatIsMe wrote:

            Any other control that can cause a postback is in an update panel with its update mode set to conditional.

            I didn't get your point, If the Update Mode of Update Panel is set to conditional you can call the UpdatePanel.Update() in post back of any other control.

            cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

            S 1 Reply Last reply
            0
            • N Not Active

              So, trying to follow along. You have two UpdatePanels, and you are trying to update controls in one from events in another? Have you added the controls that trigger the update to the triggers collection of the other?


              only two letters away from being an asset

              S Offline
              S Offline
              SomeGuyThatIsMe
              wrote on last edited by
              #6

              You are correct. No i have not tried that, reading the msdn doc on it didnt make it sound necessary. I have gotten it to work with the 2 values in the session. I can put a function in the masterpage so that it clears out any unnecessary items when the navigation bar is used. Its not the best way, but i'm not sure if its any better or worse than using hidden fields in the html. If you or anyone else has an opinion on that or any insight into a better way i'd love to hear it. Thanks for all your help so far.

              Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

              N 1 Reply Last reply
              0
              • A Abhijit Jana

                SomeGuyThatIsMe wrote:

                Any other control that can cause a postback is in an update panel with its update mode set to conditional.

                I didn't get your point, If the Update Mode of Update Panel is set to conditional you can call the UpdatePanel.Update() in post back of any other control.

                cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

                S Offline
                S Offline
                SomeGuyThatIsMe
                wrote on last edited by
                #7

                The hidden fields are in an UpdateMode="Always" panel, all the controls that can cause a postback are in an UpdateMode="Conditional" panel. Those panels all 3 or 4 of them work fine, its the controls UpdateMode="always" panel that isnt working properly, but i belive i have it solved w/ 2 values in the session, i know its a bad practice, but i dont know if its much worse than using hidden fields in the html since the data i'm storing there isnt sensitive at all.

                Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

                1 Reply Last reply
                0
                • S SomeGuyThatIsMe

                  You are correct. No i have not tried that, reading the msdn doc on it didnt make it sound necessary. I have gotten it to work with the 2 values in the session. I can put a function in the masterpage so that it clears out any unnecessary items when the navigation bar is used. Its not the best way, but i'm not sure if its any better or worse than using hidden fields in the html. If you or anyone else has an opinion on that or any insight into a better way i'd love to hear it. Thanks for all your help so far.

                  Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

                  N Offline
                  N Offline
                  Not Active
                  wrote on last edited by
                  #8

                  Although the controls are available during the postback, the UpdatePanel, call it the refresh panel, knows nothing about the controls in the other UpdatePanel, call it the trigger, and vis versa. Add the trigger control to the Triggers collection of the refresh panel.


                  only two letters away from being an asset

                  S 1 Reply Last reply
                  0
                  • N Not Active

                    Although the controls are available during the postback, the UpdatePanel, call it the refresh panel, knows nothing about the controls in the other UpdatePanel, call it the trigger, and vis versa. Add the trigger control to the Triggers collection of the refresh panel.


                    only two letters away from being an asset

                    S Offline
                    S Offline
                    SomeGuyThatIsMe
                    wrote on last edited by
                    #9

                    I see what you're saying, I made the mistake of assuming msdn was correct. It said it would always go back on any postback sync or async, I figured it was handeled by the script manager or some other automagical thing. Thanks for the help.

                    Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups