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

Loading Panel Doesn't Appear when updating Usercontrol inside content template in a radwindow

12 Answers 220 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Mohammed
Top achievements
Rank 1
Mohammed asked on 17 Feb 2014, 11:12 AM
hi .

i have a complected scenario , i am building a user control With a content template rad window , and there is a another user control inside the content template ,
 so the issue is that  when updating  the user control inside rad window by ajax request ,but  the loading panel appear while updating the inner user control if i removed the rad window and left the inner user control .

note : i am Rendering the inner user control to Div Element .

 Server Side Code :
 
Private Sub ParentPageAjaxManagerHandling()
       Dim ParentPageAjaxManager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)
        
       ParentPageAjaxManager.AjaxSettings.AddAjaxSetting(ParentPageAjaxManager, Me.EditCountryRegionWebUserControl)
       
AddHandler ParentPageAjaxManager.AjaxRequest, AddressOf ParentPageAjaxManager_AjaxRequest
 
   End Sub
 
   Private Sub ParentPageAjaxManager_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs)
       
If e.Argument.Contains("LoadCountryRegionByID_") Then
 
           Dim NewIDString As String = e.Argument.Replace("LoadCountryRegionByID_", "")
           Me.EditCountryRegionWebUserControl.
           LoadCountryRegionByID(If(NewIDString <> "" And NewIDString <> "null" And NewIDString <> "undefined",
                                    Guid.Parse(NewIDString), Guid.Empty))
 
       ElseIf e.Argument = "DeleteSelectedItem_In_" + Me.CountryRegionsListRadGrid.MasterTableView.ClientID Then
 
           DeleteSelectedCountryRegion()
       End If
   End Sub



Html :


<telerik:RadButton ID="NewCountryRegionRadButton" runat="server" AutoPostBack="False" Text="" OnClientClicked="NewCountryRegionRadButton_Clicked"

<
telerik:RadWindow ID="AddOrEditCountryRegionRadWindow" runat="server" Behavior="Close, Move, Reload" Behaviors="Close, Move, Reload" KeepInScreenBounds="True" ReloadOnShow="True" Height="135px"  Width="600px" VisibleStatusbar="False" Modal="True" DestroyOnClose="True" ShowContentDuringLoad="False">
     
    <ContentTemplate>
     
        <table style="width: 100%;">
            <tr>
                <td colspan="2">
                    <uc1:CountryRegionWebUserControl runat="server" ID="EditCountryRegionWebUserControl" />
                </td>
                 
            </tr>
            <tr>
                <td style="width: 45px"></td>
                <td>
                    <asp:Label ID="EditCountryRegionWindowErrorLabel" runat="server" ForeColor="Red"></asp:Label>
                </td>
                 
            </tr>
            <tr>
                <td></td>
                <td>
                    <telerik:RadButton ID="EditCountryRegionWindowOkRadButton" runat="server" Text="موافق">
                    </telerik:RadButton>
                    <telerik:RadButton ID="EditCountryRegionWindowCancelRadButton" runat="server" AutoPostBack="False" CausesValidation="False" OnClientClicked="EditCountryRegionWindowCancelRadButton_Clicked" Text="">
                    </telerik:RadButton>
                </td>
                 
            </tr>
        </table>
         
    </ContentTemplate>
     
</telerik:RadWindow>

javascript :
function NewCountryRegionRadButton_Clicked(sender, args) {
          
   var AddCountryWindow = $find("<%= AddOrEditCountryRegionRadWindow.ClientID %>");
          
          $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").
         ajaxRequest("LoadCountryRegionByID_" + "<%= Guid.Empty %>");
          
          
         AddCountryWindow.show();
     }

12 Answers, 1 is accepted

Sort by
0
Mohammed
Top achievements
Rank 1
answered on 17 Feb 2014, 11:19 AM
i am sorry i made a mistake 

so the issue is that the loading panel doesn't appear when updating  the user control inside rad window by ajax request ,but  the loading panel appear while updating the inner user control if i removed the rad window and left the inner user control .
0
Shinu
Top achievements
Rank 2
answered on 18 Feb 2014, 05:01 AM
Hi Mohammed,

Please have a look into the sample code snippet which works fine at my end.

ASPX:
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Web20">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadButton1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadTextBox1" LoadingPanelID="RadAjaxLoadingPanel1">
                </telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="RadButton2">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadTextBox2" LoadingPanelID="RadAjaxLoadingPanel1">
                </telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadWindow ID="RaWindow1" runat="server" VisibleOnPageLoad="true">
    <ContentTemplate>
        <uc1:Usercontrol1 ID="Usercontrol11" runat="server" />
    </ContentTemplate>
</telerik:RadWindow>

UserControl1.ascx :
<telerik:RadTextBox ID="RadTextBox1" runat="server" Text="UserControl1">
</telerik:RadTextBox>
<telerik:RadButton ID="RadButton1" runat="server" Text="Loading Panel" OnClick="RadButton1_Click">
</telerik:RadButton>
<br />
<br />
<uc1:UserControl2 ID="UserControl21" runat="server" />

UserControl1.ascx.cs :
Protected Sub RadButton1_Click(sender As Object, e As EventArgs)
    Thread.Sleep(1000)
End Sub

UserControl2.ascx:
<telerik:RadTextBox ID="RadTextBox2" runat="server" Text="UserControl2">
</telerik:RadTextBox>
<telerik:RadButton ID="RadButton2" runat="server" Text="Loadng Panel" OnClick="RadButton2_Click">
</telerik:RadButton>

UserControl2.ascx.cs:
Protected Sub RadButton2_Click(sender As Object, e As EventArgs)
    Thread.Sleep(1000)
End Sub

Let me know if you have any concern.
Thanks,
Shinu.
0
Mohammed
Top achievements
Rank 1
answered on 18 Feb 2014, 06:13 AM
hi shinu ,
first thanks for your replay 

and second ,i am developing User Controls To user in other projects so i can't use Rad ajax manager and i am surly not gonna set ajax setting to update controls inside user control 1
0
Maria Ilieva
Telerik team
answered on 20 Feb 2014, 04:26 PM
Hi,

Could you please try wrapping the inner UserControl into a regular asp Panel and add this container Panel into the RadAjaxManager settings instead of directly adding the UserControl? Give this suggestion a try and verify if it helps.

Regards,
Maria Ilieva
Telerik
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 UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Mohammed
Top achievements
Rank 1
answered on 22 Feb 2014, 10:46 AM
hi Maria,

thanks for your replay .

i tried to use the asp Panel and i had the same issue .

i am working on VS2013 and Q3 2013 Controls .
0
Maria Ilieva
Telerik team
answered on 24 Feb 2014, 03:15 PM
Hi Mohammed,

Could I kindly ask you to post the exact page markup and related code behind you have as well as detailed description of the issue that appear when Ajax is enabled?

Regards,
Maria Ilieva
Telerik
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 UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Mohammed
Top achievements
Rank 1
answered on 25 Feb 2014, 06:40 AM
Hi Maria ,

Thanks For Tour Replay ,

ascx :

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="CountryRegionsListWebUserControl.ascx.vb" Inherits="AlFajerSoft.Contacts.WebUI.CountryRegionsListWebUserControl" %>
<%@ Register Src="~/CountryRegions/CountryRegionWebUserControl.ascx" TagPrefix="uc1" TagName="CountryRegionWebUserControl" %>
 
 
 
<telerik:RadAjaxManagerProxy ID="CountryRegionsListRadAjaxManagerProxy" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="FilterRadTextBox">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="CountryRegionsListRadGrid" UpdatePanelCssClass="" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="EditCountryRegionWindowOkRadButton">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="CountryRegionsListRadGrid" UpdatePanelCssClass="" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadWindow ID="AddOrEditCountryRegionRadWindow" runat="server" Behavior="Close, Move, Reload" Behaviors="Close, Move, Reload" KeepInScreenBounds="True" ReloadOnShow="True" Height="135px" Title="يجب تعديله في الشيفرة" Width="600px" VisibleStatusbar="False" Modal="True" DestroyOnClose="True" ShowContentDuringLoad="False">
    <Localization Cancel="إلغاء الأمر" Close="إغلاق" Maximize="تكبير" Minimize="تصغير" No="لا" OK="موافق" PinOff="إلغاء التثبيت" PinOn="التثبيت" Reload="إعادة التحميل" Restore="استعادة" Yes="نعم" />
    <ContentTemplate>
     
        <table style="width: 100%;">
            <tr>
                <td colspan="2">
                    <uc1:CountryRegionWebUserControl runat="server" ID="EditCountryRegionWebUserControl" />
                </td>
                 
            </tr>
            <tr>
                <td style="width: 45px"></td>
                <td>
                    <asp:Label ID="EditCountryRegionWindowErrorLabel" runat="server" ForeColor="Red"></asp:Label>
                </td>
                 
            </tr>
            <tr>
                <td></td>
                <td>
                    <telerik:RadButton ID="EditCountryRegionWindowOkRadButton" runat="server" Text="موافق">
                    </telerik:RadButton>
                    <telerik:RadButton ID="EditCountryRegionWindowCancelRadButton" runat="server" AutoPostBack="False" CausesValidation="False" Text="إلغاء الأمر">
                    </telerik:RadButton>
                </td>
                 
            </tr>
        </table>
         
    </ContentTemplate>
      
</telerik:RadWindow>
 
<table>
    <tr>
        <td style="width: 85px">
            <asp:Label ID="Label1" runat="server" Text="نص البحث :"></asp:Label>
        </td>
        <td style="width: 250px">
            <telerik:RadTextBox ID="FilterRadTextBox" runat="server" Width="100%" AutoPostBack="True">
            </telerik:RadTextBox>
        </td>
    </tr>
</table>
 
<telerik:RadGrid ID="CountryRegionsListRadGrid" runat="server" CellSpacing="0" Culture="(Default)" DataSourceID="CountryRegionsListObjectDataSource" GridLines="None" AutoGenerateColumns="False">
    <ClientSettings>
        <Selecting AllowRowSelect="True" />
        <ClientEvents OnRowDblClick="CountryRegionsListRadGrid_OnRowDblClick" OnRowContextMenu="CountryRegionsListRadGrid_OnRowContextMenu" />
    </ClientSettings>
    <MasterTableView DataSourceID="CountryRegionsListObjectDataSource" ClientDataKeyNames="ID">
        <Columns>
            <telerik:GridBoundColumn DataField="ID" DataType="System.Guid" FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID" Visible="False">
                <ColumnValidationSettings>
                    <ModelErrorMessage Text="" />
                </ColumnValidationSettings>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CountryRegionName" FilterControlAltText="Filter CountryRegionName column" HeaderText="الاسم" ReadOnly="True" SortExpression="CountryRegionName" UniqueName="CountryRegionName">
                <ColumnValidationSettings>
                    <ModelErrorMessage Text="" />
                </ColumnValidationSettings>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CountryRegionCode" FilterControlAltText="Filter CountryRegionCode column" HeaderText="الرمز" ReadOnly="True" SortExpression="CountryRegionCode" UniqueName="CountryRegionCode">
                <ColumnValidationSettings>
                    <ModelErrorMessage Text="" />
                </ColumnValidationSettings>
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
 
<telerik:RadButton ID="NewCountryRegionRadButton" runat="server" AutoPostBack="False" Text="إضافة" OnClientClicked="NewCountryRegionRadButton_Clicked">
</telerik:RadButton>
<telerik:RadButton ID="EditSelectedCountryRegionRadButton" runat="server" AutoPostBack="False" Text="تعديل" OnClientClicked="EditSelectedCountryRegionRadButton_Clicked">
</telerik:RadButton>
<telerik:RadButton ID="DeleteSelectedCountryRegionRadButton" runat="server" AutoPostBack="False" Text="حذف" OnClientClicked="DeleteSelectedCountryRegionRadButton_Clicked">
</telerik:RadButton>
 
<telerik:RadContextMenu ID="CountryRegionsListRadContextMenu" runat="server" EnableRoundedCorners="True" EnableShadows="True" OnClientItemClicked="CountryRegionsListRadContextMenu_ItemClicked">
 
    <Items>
        <telerik:RadMenuItem runat="server" Text="تعديل" Value="Edit">
        </telerik:RadMenuItem>
        <telerik:RadMenuItem runat="server" Text="حذف" Value="Delete">
        </telerik:RadMenuItem>
    </Items>
</telerik:RadContextMenu>
 
<asp:ObjectDataSource ID="CountryRegionsListObjectDataSource" runat="server" SelectMethod="GetCountryRegionsBySearchText" TypeName="AlFajerSoft.Contacts.Library.CountryRegionsList">
    <SelectParameters>
        <asp:ControlParameter ControlID="FilterRadTextBox" ConvertEmptyStringToNull="False" DefaultValue="" Name="searchtext" PropertyName="Text" Type="Object" />
    </SelectParameters>
</asp:ObjectDataSource>



VB :
Imports Telerik.Web.UI
Imports AlFajerSoft.Contacts.Library
  
Public Class CountryRegionsListWebUserControl
Inherits System.Web.UI.UserControl
 
   
      
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
 
 
        'فحص وجود المكونات المحتاج إليها في الصفحة الأب للكونترول
        If RadScriptManager.GetCurrent(Page) Is Nothing Then
 
            Throw New Exception("CountryRegionsListWebUserControl تحتاج إلى RadScriptManager في الصفحة .")
              
        ElseIf RadAjaxManager.GetCurrent(Page) Is Nothing Then
 
            Throw New Exception("CountryRegionsListWebUserControl تحتاج إلى RadAjaxManager في الصفحة .")
 
        End If
 
        ExternalJavaScriptFileRegistering()
 
        ParentPageAjaxManagerHandling()
 
    End Sub
 
    Private Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender
          
        HandleEventsToFunInExternalJavaScriptFile()
 
    End Sub
 
    ''' <summary>
    ''' تقديم الكونترول كـ Div
    ''' </summary>
    ''' <param name="writer"></param>
    ''' <remarks></remarks>
    Protected Overrides Sub Render(writer As HtmlTextWriter)
        'Div Element Start Tag With ClientID
        writer.Write(String.Format("<div id={0}>", Me.ClientID))
        'Control Rendering
        MyBase.Render(writer)
        'Div Element End Tag
        writer.Write("</div>")
    End Sub
 
    ''' <summary>
    ''' الحصول على مدير الأجاكس الخاص بالصفحة الأب للكونترول وتسليمه طلبات الأجاكس
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ParentPageAjaxManagerHandling()
        Dim ParentPageAjaxManager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)
        ParentPageAjaxManager.AjaxSettings.AddAjaxSetting(ParentPageAjaxManager, Me.EditCountryRegionWebUserControl)
        ParentPageAjaxManager.AjaxSettings.AddAjaxSetting(ParentPageAjaxManager, Me.CountryRegionsListRadGrid)
        AddHandler ParentPageAjaxManager.AjaxRequest, AddressOf ParentPageAjaxManager_AjaxRequest
 
    End Sub
 
    Private Sub ParentPageAjaxManager_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs)
        'أمر تحميل بلد معين لأداة إضافة أو تعديل بلد
        If e.Argument.Contains("LoadCountryRegionByID_") Then
 
            Dim NewIDString As String = e.Argument.Replace("LoadCountryRegionByID_", "")
            Me.EditCountryRegionWebUserControl.
            LoadCountryRegionByID(If(NewIDString <> "" And NewIDString <> "null" And NewIDString <> "undefined",
                                     Guid.Parse(NewIDString), Guid.Empty))
 
        ElseIf e.Argument = "DeleteSelectedItem_In_" + Me.CountryRegionsListRadGrid.MasterTableView.ClientID Then
 
            DeleteSelectedCountryRegion()
        End If
    End Sub
 
    ''' <summary>
    ''' تسجيل ملف الجافا السكريب الخاص بالكونترول
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ExternalJavaScriptFileRegistering()
 
        'تسجيل ملف شيفرة الجافاسكريبت الخاص  بالكونترول إليها
        If Page.ClientScript.IsClientScriptIncludeRegistered("CountryRegionsListWebUserControlJavaScriptExternalFile") = False Then
            Page.ClientScript.RegisterClientScriptInclude("CountryRegionsListWebUserControlJavaScriptExternalFile",
                                                          ResolveClientUrl("../CountryRegions/CountryRegionsListWebUserControl.js"))
        End If
 
    End Sub
 
    ''' <summary>
    ''' تسليم الأحداث للاجرائيات في ملف الجافا سكريبت
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub HandleEventsToFunInExternalJavaScriptFile()
 
        Me.Page.SetPageRadAjaxManageClientIDScriptBlockRegistering()
 
        'تسليم الأحداث الخاصة بالادوات إلى اجرائيات الجافا السكريبت
        ' مع تسليم المعرفات للكائنات المحتاج إليها
        Me.NewCountryRegionRadButton.OnClientClicked =
            "function (button,args){NewCountryRegionRadButton_Clicked(button,args, '" &
            Me.AddOrEditCountryRegionRadWindow.ClientID.ToString & "');}"
 
        Me.EditSelectedCountryRegionRadButton.OnClientClicked =
            "function (button,args){EditSelectedCountryRegionRadButton_Clicked(button,args,'" &
            Me.CountryRegionsListRadGrid.MasterTableView.ClientID.ToString & "', '" &
            Me.AddOrEditCountryRegionRadWindow.ClientID.ToString & "');}"
 
        Me.DeleteSelectedCountryRegionRadButton.OnClientClicked =
            "function (button,args){DeleteSelectedCountryRegionRadButton_Clicked(button,args,'" &
            Me.CountryRegionsListRadGrid.MasterTableView.ClientID.ToString & "');}"
 
        Me.CountryRegionsListRadGrid.ClientSettings.ClientEvents.OnRowDblClick =
            "function (grid,args){CountryRegionsListRadGrid_OnRowDblClick(grid, args, '" &
            Me.AddOrEditCountryRegionRadWindow.ClientID.ToString & "');}"
 
        Me.EditCountryRegionWindowCancelRadButton.OnClientClicked =
            "function (button,args){EditCountryRegionWindowCancelRadButton_Clicked(button,args, '" &
            Me.AddOrEditCountryRegionRadWindow.ClientID.ToString & "');}"
 
        Me.CountryRegionsListRadGrid.ClientSettings.ClientEvents.OnRowContextMenu =
            "function (grid,args){CountryRegionsListRadGrid_OnRowContextMenu(grid, args, '" &
            Me.CountryRegionsListRadContextMenu.ClientID.ToString & "');}"
 
        Me.CountryRegionsListRadContextMenu.OnClientItemClicked =
            "function (menu,args){CountryRegionsListRadContextMenu_ItemClicked(menu,args,'" &
            Me.CountryRegionsListRadGrid.MasterTableView.ClientID.ToString & "', '" &
            Me.AddOrEditCountryRegionRadWindow.ClientID.ToString & "');}"
 
    End Sub
 
    ''' <summary>
    ''' إعادة تعبئة الداتاسورس وربط الشبكة من جديد لتحديث البيانات
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ReBindCountryRegionsListRadGrid()
        Me.CountryRegionsListObjectDataSource.Select()
        Me.CountryRegionsListRadGrid.Rebind()
    End Sub
     
    ''' <summary>
    ''' إظهار نافذة تنبيه من طرف المستخدم
    ''' </summary>
    ''' <param name="text">النص</param>
    ''' <param name="width">العرض</param>
    ''' <param name="height">الارتفاع</param>
    ''' <param name="title">العنوان</param>
    ''' <param name="callBackFunctionName">اجرائية الجافا سكريب التي ستنفذ بعد الإغلاق</param>
    ''' <param name="imageUrl">رابط الصورة</param>
    ''' <remarks></remarks>
    Private Sub clientSideRadAlert(text As String, width As Integer, height As Integer, title As String, callBackFunctionName As String, imageUrl As String)
        ScriptManager.RegisterStartupScript(Page, GetType(String), "mykey", "ParentPageRadAlert('" & text & "', '" & width.ToString & "', '" & height.ToString & "','" & title & "'," & If(callBackFunctionName IsNot Nothing, callBackFunctionName, "null") & "," & If(imageUrl IsNot Nothing, "'" & imageUrl & "'", "null") & ");", True)
 
    End Sub
 
    ''' <summary>
    ''' اجرائة ضغط زر موافق في نافذة إضافة أو تعديل بلد
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Protected Sub EditCountryRegionWindowOkRadButton_Click(sender As Object, e As EventArgs) Handles EditCountryRegionWindowOkRadButton.Click
 
        'محاولة الحفظ
        Try
            Me.EditCountryRegionWebUserControl.SaveCountryRegion()
 
            'تحديث الشبكة
            ReBindCountryRegionsListRadGrid()
 
 
            'استدعاء اجرائية الجافا في طرف المستخدم
            ' الخاصة بإغلاق النافذة
            ScriptManager.RegisterStartupScript(Page, GetType(String), "mykey", "$find('" + Me.AddOrEditCountryRegionRadWindow.ClientID + "').close();", True)
 
        Catch ex As Exception
            Me.EditCountryRegionWindowErrorLabel.Text = ex.Message
        End Try
 
 
    End Sub
 
    ''' <summary>
    ''' حذف البلد المحدد في الشبكة
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub DeleteSelectedCountryRegion()
 
        If Me.CountryRegionsListRadGrid.SelectedItems.Count > 0 Then
 
            'السطر المحدد
            Dim SelectedRow As GridItem = Me.CountryRegionsListRadGrid.SelectedItems.Item(0)
 
            'المعرف الأساسي للبلد المراد حذفه
            Dim CountryRegionToDeleteID As Guid = CType(Me.CountryRegionsListObjectDataSource.Select(), CountryRegionsList).Item(SelectedRow.ItemIndex).ID
 
            'التحقق من البلد قبل حذفه
            If AddressesList.GetAddressesByCountryRegionID(CountryRegionToDeleteID).Count > 0 Then
 
                clientSideRadAlert("لا يمكن حذف البلد المحدد لأنه هنالك عناوين به .", 400, 100,
                                   "حذف البلد", Nothing, Nothing)
 
                'إن كان البلد قابل للحذف
            Else
 
                'محاولة الحذف
                Try
                    CountryRegion.DeleteCountryRegionByID(CountryRegionToDeleteID)
 
                    'جلب البيانات
                    ReBindCountryRegionsListRadGrid()
 
                    'تحديد العنصر السابق
                    If SelectedRow.OwnerTableView.Items.Count <> 0 Then
                        If SelectedRow.ItemIndex < SelectedRow.OwnerTableView.Items.Count Then
                            SelectedRow.OwnerTableView.Items(SelectedRow.ItemIndex).Selected = True
                        Else
                            SelectedRow.OwnerTableView.Items(SelectedRow.ItemIndex - 1).Selected = True
                        End If
 
                    End If
 
                Catch ex As Exception
 
                    clientSideRadAlert("لم يتم الحذف لحدوث خطأ . تفاصيل الخطأ :" &
                                       ex.Message.Replace("'", "").Replace(vbCrLf, ""), 400, 100,
                                       "حذف البلد", Nothing, Nothing)
 
                End Try
 
            End If
        End If
 
    End Sub
 
End Class


JS :

//اجرائية الحصول على النافذة
function GetRadWindow() {
    var oWindow = null;
    if ((typeof (window) !== "undefined") && (window.frameElement !== null)) {
        if (window.radWindow)
            oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
        else if (window.frameElement.radWindow)
            oWindow = window.frameElement.radWindow; //IE (and Moz as well)
    }
    return oWindow;
}
 
//اجرائية الحصول على الصفحة الأب
function GetParentPage() {
    //متغير لجلب النافذة إن كانت الصفحة تظهر في نافذة
    var ParentPage = GetRadWindow();
 
    //إن كانت الصفحة تظهر في نافذة
    if (ParentPage) {
        //نقوم بجلب الأب الأعلى للنافذة
        while (typeof (ParentPage.BrowserWindow) !== "undefined") {
            ParentPage = ParentPage.BrowserWindow;
        }
    }
    else { //وإلا يكون الأب هو الصفحة الحالية
        ParentPage = this;
    }
 
    return ParentPage;
}
 
//اجرائية اظهار نافذة تنبيه من مدير النوافذ في النافذة الأب
function ParentPageRadAlert(text, width, height, title, callBackFun, imageUrl) {
    GetParentPage().radalert(text, width, height, title, callBackFun, imageUrl);
}
 
function NewCountryRegionRadButton_Clicked(sender, args , AddOrEditCountryRegionRadWindowClientID) {
    //جلب نافذة إضافة أو تعديل بلد
    var AddCountryWindow = $find(AddOrEditCountryRegionRadWindowClientID);
    //تعيين العنوان للنافذة
    AddCountryWindow.set_title("إضافة بلد جديد");
 
    //إرسال أمر تحميل بلد إلى الكونترول داخل النافذة بحسب معرفه الأساسي
    //وهنا بما أن النافذة للإضافة يرسل معرف أساسي فارغ
    $find(PageRadAjaxManageClientID).ajaxRequest("LoadCountryRegionByID_" +
                                                 "00000000-0000-0000-0000-000000000000");
 
    //إظهار النافذة
    AddCountryWindow.show();
}
 
function EditSelectedCountryRegionRadButton_Clicked(
    sender, args, CountryRegionsListRadGridMasterTableViewClientID,
    AddOrEditCountryRegionRadWindowClientID) {
    //الأسطر المحددة في الشبكة
    var SelectedRows = $find(CountryRegionsListRadGridMasterTableViewClientID).get_selectedItems();
 
    //إن كان عدد الأسطر المحدد صفرا
    if (SelectedRows.length === 0) {
        ParentPageRadAlert("الرجاء اختيار البلد الذي ترغب بتعديله ثم قم بالمحاولة من جديد .", 400, 100,
                           "تعديل البلد", null, null);
    }
    else {
        //السطر المحدد
        var SelectedCountryRegionID = SelectedRows[0].getDataKeyValue("ID");
 
        //جلب نافذة إضافة أو تعديل بلد
        var EditCountryWindow = $find(AddOrEditCountryRegionRadWindowClientID);
        //تعيين العنوان للنافذة
        EditCountryWindow.set_title("تعديل البلد");
 
        //إرسال أمر تحميل بلد إلى الكونترول داخل النافذة بحسب معرفه الأساسي
        $find(PageRadAjaxManageClientID).ajaxRequest("LoadCountryRegionByID_" +
                                                     SelectedCountryRegionID);
 
        //إظهار النافذة
        EditCountryWindow.show();
    }
}
 
function CountryRegionsListRadGrid_OnRowDblClick(sender, args , AddOrEditCountryRegionRadWindowClientID) {
    EditSelectedCountryRegionRadButton_Clicked(null, null,
                                               sender.get_masterTableView().get_id(),
                                               AddOrEditCountryRegionRadWindowClientID);
}
 
function DeleteSelectedCountryRegionRadButton_Clicked(sender, args, CountryRegionsListRadGridMasterTableViewClientID) {
    //الأسطر المحددة في الشبكة
    var SelectedRows = $find(CountryRegionsListRadGridMasterTableViewClientID).get_selectedItems();
 
    //إن كان عدد الأسطر المحدد صفرا
    if (SelectedRows.length === 0) {
        ParentPageRadAlert("الرجاء اختيار البلد الذي ترغب بحذفه ثم قم بالمحاولة من جديد .", 400, 100,
                           "حذف البلد", null, null);
    }
    else {
        //إظهار نافذة رسالة للمستخدم وتنفيذ اجرائية طلب الحذف عند كون نتيجة النافذة موافق
        GetParentPage().radconfirm("لا يمكن التراجع عن هذ الإجراء . هل تود بالتأكيد حذف البلد المحدد ؟",
                                   function (arg) {
                                       if (arg === true) {
                                           $find(PageRadAjaxManageClientID).ajaxRequest("DeleteSelectedItem_In_" +
                                                                                        CountryRegionsListRadGridMasterTableViewClientID);
                                       }
                                   }, 450, 100, null, "حذف البلد", null);
    }
}
 
/// <summary>اجرائية ضغط زر إلغاء الأمر في نافذة تعديل بلد</summary>
function EditCountryRegionWindowCancelRadButton_Clicked(sender, args, AddOrEditCountryRegionRadWindowClientID) {
    //استدعاء اجرائية إغلاق النافذة
    $find(AddOrEditCountryRegionRadWindowClientID).close()
}
 
/// <summary>اجرائية إظهار قائمة الخيارات عند ضغط زرالماوس اليسار على أحد أسطر الشبكة</summary>
function CountryRegionsListRadGrid_OnRowContextMenu(sender, args, CountryRegionsListRadContextMenuClientID) {
    var menu = $find(CountryRegionsListRadContextMenuClientID);
    var evt = args.get_domEvent();
 
    if (evt.target.tagName === "INPUT" || evt.target.tagName === "A") {
        return;
    }
 
    //تحديد السطر الذي ضغط عليه
    args.get_tableView().selectItem(args.get_tableView().get_dataItems()[args.get_tableView().
                                    get_dataItems().indexOf(args.get_gridDataItem())].get_element(), true);
 
    //إظهار القائمة
    menu.show(evt);
 
    evt.cancelBubble = true;
    evt.returnValue = false;
 
    if (evt.stopPropagation) {
        evt.stopPropagation();
        evt.preventDefault();
    }
}
 
/// <summary>اجرائية الضغط على أزرار القائمة المنبثقة</summary>
function CountryRegionsListRadContextMenu_ItemClicked(
    sender, args, CountryRegionsListRadGridMasterTableViewClientID,
    AddOrEditCountryRegionRadWindowClientID) {
    switch (args.get_item().get_value()) {
        //استدعاء الاجرائية الخاصة بالتعديل عند الضغط على زر التعديل في القائمة المنبقة
        case "Edit":
 
            return EditSelectedCountryRegionRadButton_Clicked(null, null , CountryRegionsListRadGridMasterTableViewClientID, AddOrEditCountryRegionRadWindowClientID);
            break;
            //استدعاء الاجرائية الخاصة بالحذف عند الضغط على زر الحذف في القائمة المنبقة
        case "Delete":
 
            DeleteSelectedCountryRegionRadButton_Clicked(null, null, CountryRegionsListRadGridMasterTableViewClientID);
            break;
        default:
    }
}

and thanks For Your Help ...
0
Maria Ilieva
Telerik team
answered on 28 Feb 2014, 01:53 PM
Hi Mohammed,

Could you please let me know how the mentioned outer user control is load? Is it dynamically load with Ajax on the content page? If you are loading it with Ajax try to disable it and verify how it goes. Also try inspecting the response from the server when the problematic request is made and verify if any error appears? Also please send us a detailed movie that presents the exact problem you are currently facing.

Regards,
Maria Ilieva
Telerik
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 UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Mohammed
Top achievements
Rank 1
answered on 01 Mar 2014, 06:31 AM
Hi maria ,
the issue is with the content template of radwindow because the ajax loading panel appeared when it outside  the window ...
and there is NO errors , and the inner user control updated just the way it should be , if it is inside the window or outside the window .

so just try to update a usercontrol inside content template of a rad Window . 

and i am sorry i don't have the time go take a movie .

thanks
0
Maria Ilieva
Telerik team
answered on 06 Mar 2014, 12:04 PM
Hello,

In case you are loading the UserControl with Ajax and the inner for the UserControl Window content is also ajaxified it is expected to have Ajax issue when Ajax bubbles from the inner content as the outer panel that contains the UserControl is not updated.
However in your case if you are only experiencing issue with the RadAjaxLoadingPanel and the Ajax is properly working I would suggest you again to wrap the inner UserControl into a regular asp Panel and add this container Panel into the RadAjaxManager settings instead of directly adding the UserControl.
 Also please make sure that this Panel has some Height set so that the RadAjaxLoadingPanel could locate the sizable container to appear.


Regards,
Maria Ilieva
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

0
Mohammed
Top achievements
Rank 1
answered on 06 Mar 2014, 01:53 PM
hi Maria ,

first thanks for your replay .
 
 i tried  warp the inner user control into a asp panel and i set the asp panel height and the loading panel didn't appear when the asp panel updated .
 
0
Maria Ilieva
Telerik team
answered on 11 Mar 2014, 11:41 AM
Hello,

Could you please send us a movie that presents the correct fire of the ajax request (using the browser console) and the missing LoadingPanel?
Also you could provide live url if possible for further testing the issue.

Regards,
Maria Ilieva
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Tags
Ajax
Asked by
Mohammed
Top achievements
Rank 1
Answers by
Mohammed
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Maria Ilieva
Telerik team
Share this question
or