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

Ajax not working on window and grid

1 Answer 51 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jocelyn
Top achievements
Rank 1
Jocelyn asked on 28 Sep 2012, 06:19 PM
Hi,

I have a grid and a RadWindow inside a RadWindowManager. I am using RadAjaxManager to ajax my stuffs.

It looks like this:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <ClientEvents OnResponseEnd="OnResponseEnd"></ClientEvents>
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="gridMPA">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="gridMPA" />
                <telerik:AjaxUpdatedControl ControlID="rwDivergence" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="rwDivergence">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="gridMPA" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

I have a GridButtonColumn in my grid that I use to open my RadWindow setting VisibleOnPageLoad to show it.

My window:

<telerik:RadWindow ID="rwDivergence" runat="server" DestroyOnClose="true">
     <ContentTemplate>
                 <GESPHARxLite_2:WinDivergence runat="server" ID="ucDiver" />
     </ContentTemplate>
</telerik:RadWindow>

WinDivergence ASCX:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="WindowDivergence.ascx.vb" Inherits="GESPHARxLite_2.WindowDivergence" %>
 
<div>
    <div>
        <telerik:RadButton runat="server" ID="btnOk" Text="Ok"></telerik:RadButton>
        <telerik:RadButton runat="server" ID="btnAnnuler" Text="Annuler" OnClientClicked="btnOk_OnClick" AutoPostBack="false"></telerik:RadButton>
    </div>
     
</div>
 
<telerik:RadScriptBlock runat="server" ID="sbDivergence">
    <script type="text/javascript">
        function btnOk_OnClick(sender, args)
        {
            var win = $find('<%=Me.NamingContainer.BindingContainer.ClientID %>');
            win.close(null);
        }
    </script>
</telerik:RadScriptBlock>

VB:

Private Sub btnOk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOk.Click
    Dim rw As RadWindow = Me.NamingContainer.BindingContainer
    rw.VisibleOnPageLoad = False
End Sub

When I click on the GridButtonColumn, it works like expected, but when I click on the btnOk inside de UserControl it refresh the entire page, not just the RadGrid.

Am I missing something?

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 03 Oct 2012, 11:58 AM
Hello Jocelyn,

Note that in order to ajaxify the RadWindow content in ContentTemplate you should internally wrap the controls into the ContentTemplate with RadAjaxPanel or add them in RadAjaxManager settings. I would suggest you in your case to get reference of the main RadAjaxManager using its GetCurrent() method in the UserControl and add dynamic settings for the specific controls you need.

Regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Ajax
Asked by
Jocelyn
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or