This is a migrated thread and some comments may be shown as answers.

How To Refresh Different Controls After AjaxRequest

4 Answers 222 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Siingh
Top achievements
Rank 2
Siingh asked on 12 Jul 2010, 04:27 AM
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:

4 Answers, 1 is accepted

Sort by
0
Siingh
Top achievements
Rank 2
answered on 13 Jul 2010, 06:17 AM
no body knows the answer in telerik?
0
Maria Ilieva
Telerik team
answered on 14 Jul 2010, 12:31 PM
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
0
Siingh
Top achievements
Rank 2
answered on 15 Jul 2010, 01:42 AM
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
0
Maria Ilieva
Telerik team
answered on 15 Jul 2010, 02:23 PM
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
Tags
Ajax
Asked by
Siingh
Top achievements
Rank 2
Answers by
Siingh
Top achievements
Rank 2
Maria Ilieva
Telerik team
Share this question
or