More in this section

Forums / Developing with Sitefinity / Issue with simple AJAX UpdatePanel in user control

Issue with simple AJAX UpdatePanel in user control

6 posts, 0 answered
  1. Christopher
    Christopher avatar
    22 posts
    Registered:
    09 Jun 2008
    01 Oct 2008
    Link to this post
    I'm having trouble trying to use the updatepanel in my custom user controls. The events don't seem to be firing. Just to test I'm trying to use a dropdownlist in an update panel to change a label from non-visible to visible.  If i add this code to page in a non sitefinity web project it works correctly so I think it has something to do with settings in Sitefinity.

    I found some documentation here: http://www.sitefinity.com/support/knowledge-base/kb-article/b1154K-bama-b1154T-cmm.aspx  that states i need to add a RadAjaxManager - is this required to use ajax? Or is it specific to particular case?

    I also added the web.config entry <add name="RadEditor" section="RadControls for ASP.Net AJAX" type="Telerik.Web.UI.RadEditor, Telerik.Web.UI"  />
           
    I don't think either of these things should be necessary when I'm attempting to use standard updatepanel with asp controls.

    If anyone could help it would be greatly appreciated.

    -Chris
    <asp:UpdatePanel ID="UpdatePanel2" runat="server"
     
    <Triggers><asp:AsyncPostBackTrigger ControlID="DropDownList2" EventName="SelectedIndexChanged" /></Triggers
            <ContentTemplate> 
                <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" Visible="true"
                    <asp:ListItem>Item 1</asp:ListItem> 
                    <asp:ListItem>Item 2</asp:ListItem> 
                </asp:DropDownList> 
                <asp:Label ID="Label3" runat="server" Text="I got called." Visible="False"></asp:Label> 
    </ContentTemplate> 
    </asp:UpdatePanel> 
     
     

     
    Partial Class TestControls_TestUpdatePanel 
        Inherits System.Web.UI.UserControl 
     
        Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As ObjectByVal e As System.EventArgs) Handles DropDownList2.SelectedIndexChanged 
            Label3.Visible = True 
        End Sub 
    End Class



  2. Christopher
    Christopher avatar
    22 posts
    Registered:
    09 Jun 2008
    02 Oct 2008
    Link to this post
    I may not have been that clear in my previous post. Basically I'm just wondering if there are any known issues with using standard updatepanel with an asp dropdownlist. Is this possible or do i need to use sitefinity related controls to accomplish this?

    Thanks,
    Chris


  3. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    02 Oct 2008
    Link to this post
    I think as long as you have the scriptmanager on the master page you should be fine to use the standard update panel in your controls. I use it in a few of my own controls, but am starting to replace them with radajaxpanels and radmanagers as my needs grow. remember that using sitefinity you get access to the telerik tools which if I may say are SWEET
  4. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    03 Oct 2008
    Link to this post
    Hi Christopher,

    You need to make the following changes in the example:
    1. Set EnablePartialRendering property of the ScriptManager to true:

    .master
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"
    </asp:ScriptManager> 

    2. Declare DropDownList outside the UpdatePanel:

    .ascx
    <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" Visible="true">  
        <asp:ListItem>Item 1</asp:ListItem>  
        <asp:ListItem>Item 2</asp:ListItem>  
    </asp:DropDownList>  
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">  
        <Triggers> 
            <asp:AsyncPostBackTrigger ControlID="DropDownList2" EventName="SelectedIndexChanged" /> 
        </Triggers>  
        <ContentTemplate>  
            <asp:Label ID="Label3" runat="server" Text="I got called." Visible="False"></asp:Label>  
        </ContentTemplate>  
    </asp:UpdatePanel> 

    Do let us know if this helps.

    Sincerely yours,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Christopher
    Christopher avatar
    22 posts
    Registered:
    09 Jun 2008
    04 Oct 2008
    Link to this post
    Thanks for your help on this. That did help, but I also found that a third party menu bar had some javascript errors that were affecting the ability to use updatepanel. Once I got a new version of the dll it worked with your suggestion below.

    Also - I'll look into using your radajaxpanels as well I just wanted to get the basics working first.

    Thanks again,
    Chris
  6. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    06 Oct 2008
    Link to this post
    Hi Christopher,

    I would recommend you use Telerik RadMenu control which is shipped with Sitefinity instead of third party menu bar. Also, Sirefinity provides a user control (SiteMenu) that represents a wrapper for RadMenu and SitemapDataSource and is specifically configured for representing sitemap data.

    Do let us know if you need any further assistance.

    Best wishes,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
6 posts, 0 answered