Auto expanding a Splitter on a Masterpage from a Childpage...

9 posts, 0 answers
  1. mark baer
    mark baer avatar
    142 posts
    Member since:
    Sep 2009

    Posted 13 Apr 2011 Link to this post

    I am trying to implement the Splitter as a "Message Center" on my masterpage.  Then on the Child page, you call masterpage.SetErrorMessage().  A label inside the splitter will be populated and the Splitter should Autoexpand.  I found some sample code in the forum for autoexpanding the Splitter and I can get it to work if the code is in the Page Load, but if an error happens somewhere else on the page, when I call masterpage.SetErrorMessage(), the code gets called, but the splitter never expands and the Label inside the splitter does not get set with the error message.  I tried wrapping it in a RadAjaxPanel, but that didn't help.  I'm sure I'm doing something stupid.  Could somebody help me out?  Below is my Splitter HTML and my code behind.

    thanks

    Splitter HTML:
    <telerik:RadSplitter ID="MessageCenter" runat="server" Orientation="Vertical" Skin="WebBlue"<br>                Width="100%"><br>                <telerik:RadPane ID="RadPane1" runat="server"><br>                    <telerik:RadSlidingZone ID="RadSlidingZone1" runat="server" SlideDirection="Top"><br>                        <telerik:RadSlidingPane ID="RadSlidingPane1" EnableDock="false" runat="server" Title="Message Center"<br>                            Height="75" Scrolling="Y" BackColor="Red"><br>                            <asp:Label ID="lblErrorMessage" CssClass="textFields" runat="server" Text="No Messages Currently..."></asp:Label><br>                        </telerik:RadSlidingPane><br>                    </telerik:RadSlidingZone><br>                </telerik:RadPane><br>            </telerik:RadSplitter>

    Code behind to Set the Message and expand the Splitter:

     public void SetAlertMessage(string message, string bgColor)<br>        {<br>           <br>            lblErrorMessage.Text = message;<br>            RadSlidingZone1.ExpandedPaneId = RadSlidingPane1.ID;<br><br>            switch(bgColor)<br>            {<br>                case "green":<br>                    RadSlidingPane1.BackColor = System.Drawing.Color.Green;<br>                    break;<br>                case "yellow":<br>                    RadSlidingPane1.BackColor = System.Drawing.Color.Yellow;<br>                    break;<br>                case "red":<br>                    RadSlidingPane1.BackColor = System.Drawing.Color.Red;<br>                    break;<br>                default:<br>                    RadSlidingPane1.BackColor = System.Drawing.Color.Red;<br>                    break;<br>            }<br>            return;<br>        }
  2. mark baer
    mark baer avatar
    142 posts
    Member since:
    Sep 2009

    Posted 15 Apr 2011 Link to this post

    Nobody can help with this?  Basically, on my Master Page, I have 3 "Panes":  Top Pane(header)....Middle Pane(Content Placeholder for Child Pages) and the Message Center Pane(Slides UP from the bottom)...

    If an error or anything happens on and Child/Content Page, that page can say:  masterPage.SetMessage(string message, string bgColor).

    A Label gets set INSIDE the Message Center Pane and the BGColor changes.  Then I want the Pane to Slide open for 3 seconds, then Collapse(I have this working using Javascript, the Collapse part).

    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?

    thanks
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 18 Apr 2011 Link to this post

    Hi mark,

    I suggest to use simple javascript - you should reference the sliding zone and expand the pane by using the expandPane method listed below:

    http://www.telerik.com/help/aspnet-ajax/splitter-client-side-radslidingzone.html

    If you need to this from the server you can simply execute the script from there as explained below:

    http://blogs.telerik.com/blogs/posts/09-05-05/executing_javascript_function_from_server-side_code.aspx

    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. 

    Greetings,
    Svetlina
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. mark baer
    mark baer avatar
    142 posts
    Member since:
    Sep 2009

    Posted 18 Apr 2011 Link to this post

    I created a stripped down project to upload for you, but it said that a .zip file was an unacceptable format. 

    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!");
                return;
    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.

    I tried the Javascript method you mentioned, but I can't get the Javascript to call the control either.  I tried it a few different ways using the Javascript method, but I couldn't get it to work.  That is when I tried the new Test Project.

    If I need to, I can open up a Support Ticket.

    thanks again.

    mark
  6. mark baer
    mark baer avatar
    142 posts
    Member since:
    Sep 2009

    Posted 18 Apr 2011 Link to this post

    UPDATE to Earlier Post:

    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.

    Also, I am still trying to call the Javascript from Code behind to update the Message Center, but I still can't get that to work either.

    Again, any advice would help greatly.

    Thanks,
    mark
  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3600 posts

    Posted 21 Apr 2011 Link to this post

    Hi Mark,

    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,
    Marin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  8. mark baer
    mark baer avatar
    142 posts
    Member since:
    Sep 2009

    Posted 21 Apr 2011 Link to this post

    Thanks for the project.  Very close, almost...Yes, the Sliding pane works, but I can't get this functionality to work AND Loading Panels(Spinning Ball) on the same page.  I've modified the project a little and tried to upoad it, but I can't upload zipped files in the forum.

    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.

    Thanks

    Mark

    Here is my modified HTML and Code Behind...
     <act:ComboBox runat="server" ID="ACT_ComboBox_Content" 
    AutoPostBack="true" 
    OnSelectedIndexChanged="sel_SelectedIndexChanged"><BR>                
    <asp:ListItem Text="Mild" Value="0" 
    /><BR>                
    <asp:ListItem Text="Medium" Value="1" 
    /><BR>                
    <asp:ListItem Text="Hot" Value="2" 
    /><BR>            
    </act:ComboBox><BR>            
    <asp:Label ID="lblErrorMessage" runat="server" 
    Text="Label"></asp:Label><BR>

    Code Behind:
     protected void sel_SelectedIndexChanged(object sender, EventArgs 
    e)<BR>    {<BR>        
    System.Threading.Thread.Sleep(3000);<BR>        
    lblErrorMessage.Text = 
    DateTime.Now.ToLongTimeString();<BR>        
    lblErrorMessage.BackColor = System.Drawing.Color.Red;<BR>    
    }<BR>
  9. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 26 Apr 2011 Link to this post

    Hello Mark,

    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.

    Regards,
    Dobromir
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  10. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 28 Apr 2011 Link to this post

    Hi Mark,

    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:
    1. Non working configuration using UpdatePanel
    2. Working configuration using UpdatePanel
    3. Working configuration using RadAjaxManager

    Regards,
    Dobromir
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017