I'll share a problem that could be embarrassing but others may be here at some point too.
I tend to wrap controls into div tags just so that I can set style position x/y.
Within that I'm often confused about when to use a RadAjaxPanel, asp:Panel, asp:UpdatePanel, or a div.
The thing is that the RadAjaxManager creates panels around controls and ajaxifies them for us. But it can only do this if the controls are visible. So what gets me is when I need to make a control visible - it's not there for Ajax to toggle Visible=true. For these controls I think I sometimes need to do the ajaxifying in code-behind. So I split ajaxification between markup and code - which seems sloppy.
Then there are timers, and I have a recent thread going on about this. You can't ajaxify a timer as the updated control directly because it's not a visible control. You "may" need to put the control on a panel and set that as the updated control. While I've seen this stated many times, examples show timers outside of panels, and I've tried that code and it works. In my more sophisticated pages it seems like sometimes I need the timer in a panel and other times not. I'm just never sure about which panel to try - it's just a guessing game. So why does the RadAjaxManager wrap other controls in a panel and not a timer? And what are the firm rules about exactly how this is supposed to be coded?
Here is a simple example that demonstrates some of my confusion related to the above.
I have a tab with a multi-page and a single timer on the page. In each tab is a start/stop button which can toggle the timer. If you press Start on tab 0 the timer is enabled and the button.Text is changed to Stop. Now click Stop, timer.enabled=false and button.text gets reset to Start. Tab 1 has the same functionality. The timer does postbacks which perform work, and when the work is complete the timer is supposed to get disabled and the button on the current tab toggled off. If I pre-ajaxify the buttons in markup so that Timer1 updates both of them, only one of the buttons is visible at any given time, so I'll get an error at runtime. So I think I need to ajaxify controls in page_load for each pageview, depending on which tab is active. I also find that sometimes my controls ajaxify but the timer does not, or the timer ajaxifies but the controls do not. The effect is that on a timer_tick, (1) control updates are not reflected on the client, or (2) when I set timer.enabled=false, the client doesn't get that message and the timer keeps ticking.
I have spent exactly one week on nothing but the above problems, getting absolutely nothing productive done. The code for these things is always too extensive to send to Telerik Support, though those great people are always eager to help us workout issues like this. Over the last year I've spent many hours trying to balance RadAjaxManager with various panels and controls and codebehind code to accomplish the task of the day, and quite often the end result is "I don't know why that worked but I'll accept it". That's unprofessional, I want to understand this better better. What I'd rather see is a very clearly defined set of rules for when we need specific panels, and exactly what happens in the RadControls black-box "for" us, so that I know what to expect in my code.
This situation is causing me to re-consider using web forms for this stuff, and maybe to switch to MVC to eliminate a lot of the black-box activity that makes some of these very helpful tools yet another layer for debugging. I don't know if that will really help. Any comments?
Thanks for your time, and any feedback or links to indepth blogs or articles on this topic.
I tend to wrap controls into div tags just so that I can set style position x/y.
Within that I'm often confused about when to use a RadAjaxPanel, asp:Panel, asp:UpdatePanel, or a div.
The thing is that the RadAjaxManager creates panels around controls and ajaxifies them for us. But it can only do this if the controls are visible. So what gets me is when I need to make a control visible - it's not there for Ajax to toggle Visible=true. For these controls I think I sometimes need to do the ajaxifying in code-behind. So I split ajaxification between markup and code - which seems sloppy.
Then there are timers, and I have a recent thread going on about this. You can't ajaxify a timer as the updated control directly because it's not a visible control. You "may" need to put the control on a panel and set that as the updated control. While I've seen this stated many times, examples show timers outside of panels, and I've tried that code and it works. In my more sophisticated pages it seems like sometimes I need the timer in a panel and other times not. I'm just never sure about which panel to try - it's just a guessing game. So why does the RadAjaxManager wrap other controls in a panel and not a timer? And what are the firm rules about exactly how this is supposed to be coded?
Here is a simple example that demonstrates some of my confusion related to the above.
I have a tab with a multi-page and a single timer on the page. In each tab is a start/stop button which can toggle the timer. If you press Start on tab 0 the timer is enabled and the button.Text is changed to Stop. Now click Stop, timer.enabled=false and button.text gets reset to Start. Tab 1 has the same functionality. The timer does postbacks which perform work, and when the work is complete the timer is supposed to get disabled and the button on the current tab toggled off. If I pre-ajaxify the buttons in markup so that Timer1 updates both of them, only one of the buttons is visible at any given time, so I'll get an error at runtime. So I think I need to ajaxify controls in page_load for each pageview, depending on which tab is active. I also find that sometimes my controls ajaxify but the timer does not, or the timer ajaxifies but the controls do not. The effect is that on a timer_tick, (1) control updates are not reflected on the client, or (2) when I set timer.enabled=false, the client doesn't get that message and the timer keeps ticking.
I have spent exactly one week on nothing but the above problems, getting absolutely nothing productive done. The code for these things is always too extensive to send to Telerik Support, though those great people are always eager to help us workout issues like this. Over the last year I've spent many hours trying to balance RadAjaxManager with various panels and controls and codebehind code to accomplish the task of the day, and quite often the end result is "I don't know why that worked but I'll accept it". That's unprofessional, I want to understand this better better. What I'd rather see is a very clearly defined set of rules for when we need specific panels, and exactly what happens in the RadControls black-box "for" us, so that I know what to expect in my code.
This situation is causing me to re-consider using web forms for this stuff, and maybe to switch to MVC to eliminate a lot of the black-box activity that makes some of these very helpful tools yet another layer for debugging. I don't know if that will really help. Any comments?
Thanks for your time, and any feedback or links to indepth blogs or articles on this topic.