How To Refresh Different Controls After AjaxRequest

5 posts, 0 answers
  1. Siingh
    Siingh avatar
    32 posts
    Member since:
    Jul 2012

    Posted 11 Jul 2010 Link to this post

    Hi Telerik
    I want to update particular control e.g <asp:panel /> or any control but only after ajaxrequest.

    Now in this situation i have asp:panel which should rendered ascx page after ajax request executed. can i know the server side code to render / Refresh particular control only, not all controls. only particular?

    and i dont want to handle this inside aspx page with radajaxmanager i want to handle this through code behind after ajaxrequest only.

    ajax request will validate the condition then base on condition it should render or refresh particular control only.

    Kind regards:
  2. Siingh
    Siingh avatar
    32 posts
    Member since:
    Jul 2012

    Posted 13 Jul 2010 Link to this post

    no body knows the answer in telerik?
  3. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 14 Jul 2010 Link to this post

    Hello Siingh,

    I'm not sure if I correctly understand the scenario you need to achieve. However if the desired behavior is to update the <panel> only with Ajax calls you should just add it as updated control into the RadAjaxSettings like this:

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        <AjaxSettings
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
                <UpdatedControls
                 <telerik:AjaxUpdatedControl ControlID="Panel"/> 
                </UpdatedControls
            </telerik:AjaxSetting
        </AjaxSettings
    </telerik:RadAjaxManager>


    Sincerely yours,
    Maria Ilieva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Siingh
    Siingh avatar
    32 posts
    Member since:
    Jul 2012

    Posted 14 Jul 2010 Link to this post

    Hi Telerik
    Thanks for replying but you didnt understand the problem, ill explain using example so please understand and let me know the solution asap thanks


    I have two UserControl Pages and One ASPX page
    e.g
    1. Header.ascx
    2. Panel.ascx
    3. Default.aspx

    Now in main page Default.aspx i have included Header.ascx only

    I'll add Panel.ascx from code behind

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="EmployeeInfo" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="Header" Src="~/Controls/Header.ascx" TagName="HD" %>


    Now in Header.ascx page contains some buttons which i'll perform java script OnClick and Header.ascx does not contain any RadAjaxManager only Default.aspx contain RadAjaxManager

    So i cant use this code from OnClick function in Header.ASCX page
    var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
    ajaxManager.ajaxRequest('Args');

    I have created one function in Default.aspx which is
    Function AjaxRequest (Args){
    var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
    ajaxManager.ajaxRequest('Args');
    }


    Now since i cant call Radajaxmanager from Header.ascx page how do i add button into AjaxManager? from Header.ascx page so what I have done is to call AjaxRequest? I use OnClick AjaxRequest(Args) function in Header.ascx

    Since Header.ascx will be render in Default.aspx so there is no problem calling that function.

    When i click on button from Header.ascx page then it call Code Behind function

    Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
          
    if e.Argument="Something" then
    ....Do Something
      
    Here i'll add new usercontrol into Default.aspx page then i want to update DivPanel so it can refresh or update new rendered control from Panel.ascx page into DivPanel
     
     Dim iPanel As UserControl = LoadControl("~/Controls/Panel.ascx")
                        DivPanel.Controls.Clear()
                        DivPanel.Controls.Add(iPanel)
     
      
     
    Now Here i want to update particular control after Ajax Request.
      
      
    end if
      
    End Sub


    in this code i have added new UserControl into Default.aspx page and want to update DivPanel and also some other control on Default.aspx page after AjaxRequest

    Now you see i cant use RadAjaxManager here because request is made from Header.aspx page and Radajaxmanager is in Default.aspx and i want to Update few controls on Default.aspx and also in Panel.aspx which is another UserControl.

    How do i update this control?


    Please let me know if you understand this example and reply me asap thanks


    Kind Regards:
    Hariindarr Siingh
    McConnell Dowell
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 15 Jul 2010 Link to this post

    Hi Siingh,

    In order to achieve your scenario you could use the RadAjaxManagerProxy control, as it is described in the following help topic. Another option could be to get reference of the main RadAjaxManager in the UserControl, using its GetCurrent () method. Refer to the following help topic for more information on this matter.



    Maria Ilieva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top