Hidden fields with ajax and master pages
-
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.
-
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.
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
-
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
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.
-
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.
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
-
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.
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
-
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
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.
-
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
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.
-
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.
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
-
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
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.