Code behind to Set the Message and expand the Splitter:
8 Answers, 1 is accepted
If an error or anything happens on and Child/Content Page, that page can say: masterPage.SetMessage(string message, string bgColor).
Currently on any Child Page, if I throw an error on Purpose in the Page Load, I can get the Error to represent itself in the Master Page. I just can't get it to work when any other Postback occurs on the Page(Button Click, selection Changed, etc).
See attached image please.
Can anyone give me a hand here?
If you need to this from the server you can simply execute the script from there as explained below:
If you need to call it on the client, you can directly do so.
In case you need further assistance, please prepare sample, fully runnable code and share it along with detailed explanations and I will modify it for you in order to meet your requirements.
the Telerik team
BUT, I think I have PARTIALLY found the problem. In my new Test Project, I copied the Site.Master and one of my "Child" pages to the new project, but stripped out just about all of the Custom HTML/Controls. I just kept in the RadSplitter/Panels/etc...and a few small buttons to execute code behind.
This NEW project worked fine. The error message is getting set and the Sliding Panel is expanding/collapsing when being set from the Code behind. I was perplexed so I tried to look for more offending controls/code.
Then, I noticed in my original application, I referenced the Ajax Control Toolkit both on the SiteMaster AND the Child page. There are still a few of their controls on the Master Page and Child page that got stripped out when I created the new Test Project.
I added an Ajax Toolkit ComboBox to my RadSliding Panels...NOW, the code is broken. So it seems there is a problem between the Telerik Controls and the Ajax Toolkit controls.
Not sure what to do next.
If I can't upload a project, here is how you can recreate the problem.
1. Create new Rad Web Project.
2. Add Master Page.
3. Add Splitter/Sliding Panel.
4. Put Label inside one of the panes. Call it something like "lblErrorMessage".
5. In code behind of master page, create public method, called SetMessage(string message).
6. Code for SetMessage()
lblErrorMessage.Text = message;
////This Line should EXPAND the Sliding Pane...
RadSlidingZone1.ExpandedPaneId = RadSlidingPane1.ID;
RadSlidingPane1.BackColor = System.Drawing.Color.Green;
7. Add an Ajax Control Toolkit control to the page, maybe a combo box.
8. Create a Child Page, use your Site Master as the Master Page.
9. Add a Splitter/RadPanel to this page.
10. Put a RadButton inside the Panel. Add this code to the button Click event:
Site masterPage = (Site)Page.Master;
masterPage.SetAlertMessage("Setting Message Panel in the Master Page!");
11. Add an Ajax Control toolkit combobox to the child page.
12. Run the application. Click the button. The Error Message in the Splitter will not get set and will not expand. BUT, if you remove the ComboBoxes and the reference to the Ajax Toolkit, the code should work fine.
If I need to, I can open up a Support Ticket.
I did some more testing. On my "Child" Page, I had a Splitter with a few Panes in it. Then I had a RadPanel inside one of those Panes. When my button providing the Postback is in one of those Panes, The Message Center does not refresh on the MasterPage even though the code gets called in the code behind.
BUT, when I REMOVE the RadPanel from inside the Splitter and just have the Button in there that provides the Postback, the Message Center works fine.
I'm probably using the control wrong, I don't know but hopefully, this helps get the problem fixed.
Again, any advice would help greatly.
I followed the steps you provided and this resulted in the page you can find attached. On my end it seems to be working fine as you can see from the video I recorded during my experiment: http://screencast.com/t/Mg0lxXt5aotN. For the sake of minimizing the download I have not included the dlls, but I am using Q1 2011 SP1 and the latest AjaxControlToolkit from their official site.
Please note that I am using another method to reference the master page since my project is strongly typed. If that does not cover your scenario please modify my test project until it displays the issue you are having and send it back.
I hope this test project will help you in your development. If it fits your scenario you can use it as base and extend your functionality from there. Please note my comments in the code.
All the best,
the Telerik team
How I modified your code:
1. Add a RadAjaxManagerProxy and LoadPanel to the page.
2. OnSelectedChanged of your Combobox, update a Label with the current time. Make the current thread Sleep for 3 seconds...
3. Modify the RadAjaxManagerProxy to update the Container the Label is in when the Drop Down box changes.
4. Fire it up. The Sliding Panel should still work. Plus, when you choose an item from the Drop Down List, I should see the Spinning "LoadingPanel"...
The Sliding Panel still works, but the Loading Panel does not.
If there is somewhere else I can upload the project, let me know and I will do that.
Here is my modified HTML and Code Behind...
Thank you for the additional information.
Following the provided steps I was able to reproduce a problem with the ajaxify of the AjaxToolKit combobox using RadAjaxManager - the postback occurs only on the first change. Is this the problem that you experience? At this point I am not quite sure why this is happening and we will need some additional time to investigate this problem. I have bookmarked this thread and will write back as soon as we have additional information. Nevertheless, to help us isolate this issue could you please provide the exact AjaxSettings set to the RadAjaxManager and RadAjaxManagerProxy.
In addition, the only attachment allowed to the forums are images. To be able to attach a zip file you need to open a support ticket.
the Telerik team
After further investigation on this issue it seems that the problem is in the AjaxToolkit ComboBox control itself. It seems that the ComboBox need to be updated as well. I have attached a sample page demonstrating this issue using a standard UpdatePanel.
In the attached page you can find 3 different setups for this scenario:
- Non working configuration using UpdatePanel
- Working configuration using UpdatePanel
- Working configuration using RadAjaxManager
the Telerik team