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

RadAjaxPanel Blocking RadConfirm

14 Answers 189 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Noor hussain
Top achievements
Rank 1
Noor hussain asked on 08 Mar 2011, 01:58 PM
Dear All,
I am facing this problem whenever I am using RadAjaxPanel my javascript variables are not getting refreshed i.e they are not being initialized with default value. I am also not getting my RadAlert Boxes which I have added from code behind for Save and Delete purpose. Please help me in solving this problem. For your reference I am attaching the form code behind and aspx along with javascript.

Regards,
Noor Hussain
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="frmCurrencies.aspx.vb" Inherits="BNBERP.frmCurrencies" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
     
</head>
<body>
    <form id="form1" runat="server">
     
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        </telerik:RadWindowManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel2">
        <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadToolBar1">
        <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="RadSplitter1"/>       
        </UpdatedControls>
        </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Default">
        </telerik:RadAjaxLoadingPanel>      
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
 
        <script type="text/javascript">
            //KeyDown for Alphabets
            function KeyDownAlphabetsOnly(e) {
 
 
                if (e.keyCode != 8 && e.keyCode != 32 && e.keyCode != 190) {
                    if (e.shiftKey) {
                        if (90 >= e.keyCode && e.keyCode >= 65) {
                            e.returnValue = true;
                        }
                        else {
 
                            e.returnValue = false;
                        }
                    }
                    else if (90 >= e.keyCode && e.keyCode >= 65) {
                        e.returnValue = true;
                    }
                    else {
 
                        e.returnValue = false;
                    }
                }
                else
                    e.returnValue = true;
            }
 
            //Keydown function for numbers only
            function KeyDownForNumbersOnly(e) {
 
                if (e.keyCode != 8) {
 
                    if (e.keyCode < 48 || e.keyCode > 57)
                        return false;
                    else if (e.shiftKey == 1)
                        return false;
                    else
 
                        return true;
                }
                return true;
            }
 
        //KeyPress Function for Alphabets only
            function AlphabetOnly(sender, eventArgs) {
                var c = eventArgs.get_keyCode();
                if ((c < 65) ||
       (c > 90 && c < 97) ||
       (c > 122))
                    eventArgs.set_cancel(true);
            }
 
            //KeyDown Function for Aplhanumeric fields
            function KeyDownAlphaNumeric(e) {
                 if (e.keyCode != 8) {
                    if (e.shiftKey) {
                        if (90 >= e.keyCode && e.keyCode >= 65) {
                            e.returnValue = true;
                        }
                        else {
 
                            e.returnValue = false;
                        }
                    }
                    else if (90 >= e.keyCode && e.keyCode >= 65) {
                        e.returnValue = true;
                    }
                    else if (57 >= e.keyCode && e.keyCode >= 48) {
                        e.returnValue = true;
                    }
                    else {
 
                        e.returnValue = false;
                    }
                }
                else
                    e.returnValue = true;
            }
            //Validation Function
            function OnClientClicking(sender, args) {
                var button = sender.get_text();
                //Closing the form
                if (button == "Ok") {
                    //Cancel the PostBack and return
                    args.set_cancel(true);
                    //Obtain a reference to the  parent window manager
                    var oManager = GetRadWindow().get_windowManager();
                    //Close the window
                    oManager.closeActiveWindow();
                }
 
                //Checking if any text is in the controls before closing the form on cancel event
                if (button == "Cancel") {
                    var button1 = $find("<%= btnAdd.ClientID %>");
                    var txtCurrCode = $find("<%= txtCurrencyCode.ClientID %>");
                    var txtCurrName = $find("<%= txtCurrencyName.ClientID %>");
                    var txtNumericCode = $find("<%= txtNumericCode.ClientID %>");
                    debugger
                    //Check if any text is there in the controls
                    if (txtCurrCode.isEmpty() != true || txtCurrName.isEmpty() != true || txtNumericCode.isEmpty() != true) {
                        if (button1.get_text() == "Add" || button1.get_text() == "Update") {
                            if (!clickCalledAfterRadconfirm) {
                                args.set_cancel(true);
                                lastClickedItem = sender;
                                radconfirm("Any unsaved data will be lost. Do you wish to continue ?", CancelconfirmCallbackFunction, 330, 100, null, 'Currencies');
                            }
                            else {
                                //Cancel the PostBack and return
                                args.set_cancel(true);
                                //Obtain a reference to the  parent window manager
                                var oManager = GetRadWindow().get_windowManager();
                                //Close the window
                                oManager.closeActiveWindow();
                            }
                        }
                        else {
                            //Cancel the PostBack and return
                            args.set_cancel(true);
                            //Obtain a reference to the  parent window manager
                            var oManager = GetRadWindow().get_windowManager();
                            //Close the window
                            oManager.closeActiveWindow();
                        }
                    }
                    else {
                        //Cancel the PostBack and return
                        args.set_cancel(true);
                        //Obtain a reference to the  parent window manager
                        var oManager = GetRadWindow().get_windowManager();
                        //Close the window
                        oManager.closeActiveWindow();
                    }
                }                 
                   
                //Validation Starts here
                if (button == "Add" || button == "Update") {
                    //Check for Currency Code empty
                    var txtCurrCode = $find("<%= txtCurrencyCode.ClientID %>");
                    if (txtCurrCode.isEmpty() == true) {
                        //Set the Focus
                        txtCurrCode.focus();
                        //Show the alert message
                        radalert('Please enter the Currency Code.', 330, 100, 'Currencies');
                        return false;
                         
                    }
 
                    //Check for Currency Name empty
                    var txtCurrName = $find("<%= txtCurrencyName.ClientID %>");
                    if (txtCurrName.isEmpty() == true) {
                        //Show the alert message
                        radalert('Please enter the Currency Name.', 330, 100, 'Currencies');
                        return false;
                        //Set the Focus
                        txtCurrName.focus();
 
                    }
                }
            }
 
 
 
            //Confirmation messagebox function
 
            var lastClickedItem = null;           
            var clickCalledAfterRadconfirm = false;
            function onClientButtonClicking(sender, args) {
            //Confirmation Messagebox for Delete button
                if (args.get_item().get_index() == "3") {
                    if (!clickCalledAfterRadconfirm) {
                        args.set_cancel(true);
                        lastClickedItem = args.get_item();
                        radconfirm("Are you sure you want to delete the currency?", confirmCallbackFunction,330, 100, null, 'Currencies');
                    }
                }
                //Confirmation Messagebox for Browse,Add,Search button
                if (args.get_item().get_index() == "0" || args.get_item().get_index() == "1" || args.get_item().get_index() == "4" || args.get_item().get_index() == "5" || args.get_item().get_index() == "6" || args.get_item().get_index() == "7") {
                    var button = $find("<%= btnAdd.ClientID %>");
                    var txtCurrCode = $find("<%= txtCurrencyCode.ClientID %>");
                    var txtCurrName = $find("<%= txtCurrencyName.ClientID %>");
                    var txtNumericCode = $find("<%= txtNumericCode.ClientID %>");              
                    //Check if any text is there in the controls
                    if (txtCurrCode.isEmpty() != true || txtCurrName.isEmpty() != true || txtNumericCode.isEmpty() != true) {
                        if (button.get_text() == "Add" || button.get_text() == "Update") {
                            if (!clickCalledAfterRadconfirm) {
                                args.set_cancel(true);
                                lastClickedItem = args.get_item();
                                radconfirm("Any unsaved data will be lost. Do you wish to continue ?", confirmCallbackFunction, 330, 100, null, 'Currencies');
                            }
                        }
                     
                    }
                }
            }
 
            //Call Back function for Confirmation Messagebox
            function confirmCallbackFunction(args) {
                         if (args) {
                    clickCalledAfterRadconfirm = true;
                    lastClickedItem.click();
                }
                else
                    clickCalledAfterRadconfirm = false;
                lastClickedItem = null;
            }
 
            //Call Back function for Cancel Confirmation Messagebox
            function CancelconfirmCallbackFunction(args) {
                 
                if (args) {
                    clickCalledAfterRadconfirm = true;
                    //lastClickedItem.click();
                    //Obtain a reference to the  parent window manager
                    var oManager = GetRadWindow().get_windowManager();
                    //Close the window
                    oManager.closeActiveWindow();
                }
                else
                    clickCalledAfterRadconfirm = false;
                lastClickedItem = null;
            }
            
            //Get a reference to existing window
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                return oWindow;
            }          
             
                       
        </script>          
        </telerik:RadCodeBlock>
    <telerik:RadSplitter runat="Server" ID="RadSplitter1" Width="100%" BorderSize="0"
            BorderStyle="Inset" PanesBorderSize="1" Orientation="Horizontal"
            VisibleDuringInit="false">
        <telerik:RadPane ID="RadPane1" runat="server">      
            <%--<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1"> --%>     
             <telerik:RadToolBar ID="RadToolBar1" runat="server" Width="99%"
                Height="22px" style="position:absolute;top:1px; left:1px" OnClientButtonClicking="onClientButtonClicking">
            <Items>
                <telerik:RadToolBarButton ToolTip="NEW" ImageUrl="../Images/add.png" />                       
                        <telerik:RadToolBarButton ToolTip="SEARCH" ImageUrl="../Images/search16.png" />
                        <telerik:RadToolBarButton ToolTip="EDIT" ImageUrl="../Images/edit.png" />
                        <telerik:RadToolBarButton ToolTip="DELETE" ImageUrl="../Images/del.png" />                   
                        <telerik:RadToolBarButton ToolTip="FIRST" ImageUrl="../Images/first16.png" />
                        <telerik:RadToolBarButton ToolTip="PREVIOUS" ImageUrl="../Images/back16.png" />
                        <telerik:RadToolBarButton ToolTip="NEXT" ImageUrl="../Images/play16.png" />
                        <telerik:RadToolBarButton ToolTip="LAST" ImageUrl="../Images/last16.png" />
                        <telerik:RadToolBarButton ToolTip="SAVE AS" ImageUrl="../Images/saveas.gif" />
                        <telerik:RadToolBarButton ToolTip="BASE-DOCUMENT" ImageUrl="../Images/baseDoc.png" />
                        <telerik:RadToolBarButton ToolTip="TARGET-DOCUMENT" ImageUrl="../Images/targetDoc.png" />
                        <telerik:RadToolBarButton ToolTip="PRINT-PREVIEW" ImageUrl="../Images/print_preview.png" />
                        <telerik:RadToolBarButton ToolTip="PRINT" ImageUrl="../Images/Printer.png" />
                        <telerik:RadToolBarButton ToolTip="COPY-TO" ImageUrl="../Images/copyTo.png" />
                        <telerik:RadToolBarButton ToolTip="COPY-FROM" ImageUrl="../Images/copyFrom.png" />                       
                         
            </Items>
             
         </telerik:RadToolBar>
      
         <div style="margin-left:30px; margin-top:50px;font-size:11px;">
            <table>
                           <tr>
                              <td width="110px"><span style="color: #0F3789;">Currency Code</span> </td>
                              <td width="250px">
                                  <telerik:RadTextBox ID="txtCurrencyCode" runat="server" width="200px"
                                      MaxLength="25" onkeydown="return KeyDownAlphaNumeric(event)"></telerik:RadTextBox>
                              </td>                                         
                           </tr>
                           <tr>
                               <td><span style="color: #0F3789;">Currency Name</span></td>
                               <td><telerik:RadTextBox ID="txtCurrencyName" runat="server" width="200px"
                                       MaxLength="100" >
                                       <ClientEvents OnKeyPress="AlphabetOnly" />
                                       </telerik:RadTextBox>                                   
                                      </td>
                           </tr
                            <tr>
                               <td><span style="color: #0F3789;">International Code</span></td>
                               <td><telerik:RadTextBox ID="txtNumericCode" runat="server" width="200px"
                                       MaxLength="50" onkeydown="return KeyDownAlphaNumeric(event)" /></td>
                           </tr>
                           <tr>
                           <td>
                               <telerik:RadButton ID="btnAdd" runat="server" Text="Add" OnClientClicking="OnClientClicking" Width="50px">
                               </telerik:RadButton>
                           </td>
                           <td><telerik:RadButton ID="btnCancel" runat="server" Text="Cancel" OnClientClicking="OnClientClicking" Width="50px">
                               </telerik:RadButton></td>
                           </tr>                                                        
                        </table>
         </div>
         <%--</telerik:RadAjaxPanel>--%>
    </telerik:RadPane>   
  </telerik:RadSplitter>
   
    </div>
 
    </form>
</body>
</html>
Imports BNB.ELL
Imports BNB.BLL
Imports BNB.DAL
Public Class frmCurrencies
    Inherits System.Web.UI.Page
 
#Region "Variable Decleration"
 
    ''' <summary>
    ''' Entity Layer Object Initialisation
    ''' </summary>
    ''' <remarks></remarks>
    Public objELCurrencies As New ELCurrencies
 
    ''' <summary>
    ''' Business Layer Object Initialisation
    ''' </summary>
    ''' <remarks></remarks>
    Public objBLCurrencies As New BLCurrencies
 
    ''' <summary>
    ''' Data Layer Object Initialisation
    ''' </summary>
    ''' <remarks></remarks>
    Public objDLCurrencies As New DLCurrencies
 
    ''' <summary>
    ''' Dataset to hold the browsing data
    ''' </summary>
    ''' <remarks></remarks>
    Public dsBrowse As DataSet
 
 
    Public rowNum As Integer
 
#End Region
 
#Region "Methods"
 
    ''' <summary>
    ''' This method is used to clear the controls
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ClearControls()
        txtCurrencyCode.Text = ""
        txtCurrencyName.Text = ""
        txtNumericCode.Text = ""
    End Sub
 
    ''' <summary>
    ''' This Method is used for enabling or disabling controls
    ''' </summary>
    ''' <param name="enabledisable">True:Enables the controls
    ''' False:Disables the controls</param>
    ''' <remarks>True:Enables the controls
    ''' False:Disables the controls</remarks>
    Private Sub EnableDisableControls(ByVal enabledisable As Boolean)
        txtCurrencyCode.Enabled = enabledisable
        txtCurrencyName.Enabled = enabledisable
        txtNumericCode.Enabled = enabledisable
 
    End Sub
    ''' <summary>
    ''' This Method is used to set the form mode
    ''' </summary>
    ''' <param name="mode">0:New Mode
    ''' 1:Search Mode
    ''' 2:Browse Mode
    ''' 3:Edit Mode</param>
    ''' <remarks>Pass Integer Value</remarks>
    Private Sub FormMode(ByVal mode As Integer)
        Select Case mode
            Case "0" 'Add Mode
                'Disable New Record
                RadToolBar1.Items(0).Enabled = False
                'Disable Save As
                RadToolBar1.Items(8).Enabled = False
                'Disable Base Document
                RadToolBar1.Items(9).Enabled = False
                'Disable Target Document
                RadToolBar1.Items(10).Enabled = False
                'Disable Print Preview Document
                RadToolBar1.Items(11).Enabled = False
                'Disable Print
                RadToolBar1.Items(12).Enabled = False
                'Disable Copy To
                RadToolBar1.Items(13).Enabled = False
                'Disable Copy From
                RadToolBar1.Items(14).Enabled = False
 
                'Disable Delete
                RadToolBar1.Items(3).Enabled = False
 
                'Disable Edit
                RadToolBar1.Items(2).Enabled = False
 
                'Enable the Search
                RadToolBar1.Items(1).Enabled = True
 
                'Change the button text to Add
                btnAdd.Text = "Add"
 
                'Focus the Main Textbox
                txtCurrencyCode.Focus()
 
            Case "1" 'Find Mode
                'Disable the Search
                RadToolBar1.Items(1).Enabled = False
                'Enable the New
                RadToolBar1.Items(0).Enabled = True
                'Disable Save As
                RadToolBar1.Items(8).Enabled = False
                'Disable Base Document
                RadToolBar1.Items(9).Enabled = False
                'Disable Target Document
                RadToolBar1.Items(10).Enabled = False
                'Disable Print Preview Document
                RadToolBar1.Items(11).Enabled = False
                'Disable Print
                RadToolBar1.Items(12).Enabled = False
                'Disable Copy To
                RadToolBar1.Items(13).Enabled = False
                'Disable Copy From
                RadToolBar1.Items(14).Enabled = False
                'Disable the Delete
                RadToolBar1.Items(3).Enabled = False
                'Disable the Edit
                RadToolBar1.Items(2).Enabled = False
 
 
                'Change the text to Search
                btnAdd.Text = "Search"
                'Focus the Main Textbox
                txtCurrencyCode.Focus()
 
 
            Case "2" 'Browse Mode
                'Enable the New
                RadToolBar1.Items(1).Enabled = True
                'Enable the Search
                RadToolBar1.Items(0).Enabled = True
                'Enable the Edit
                RadToolBar1.Items(2).Enabled = True
                'Enable the Save As
                RadToolBar1.Items(8).Enabled = True
                'Disable Print Preview Document
                RadToolBar1.Items(11).Enabled = True
                'Disable Print
                RadToolBar1.Items(12).Enabled = True
                'Enable the Delete
                RadToolBar1.Items(3).Enabled = True
 
                'Change the text to Ok
                btnAdd.Text = "Ok"
 
 
            Case "3" 'Edit Mode
                'Disable Save As
                RadToolBar1.Items(8).Enabled = False
                'Disable Base Document
                RadToolBar1.Items(9).Enabled = False
                'Disable Target Document
                RadToolBar1.Items(10).Enabled = False
                'Disable Print Preview Document
                RadToolBar1.Items(11).Enabled = False
                'Disable Print
                RadToolBar1.Items(12).Enabled = False
                'Disable Copy To
                RadToolBar1.Items(13).Enabled = False
                'Disable Copy From
                RadToolBar1.Items(14).Enabled = False
                'Disable the Delete
                RadToolBar1.Items(3).Enabled = False
                'Disable the Edit
                RadToolBar1.Items(2).Enabled = False
                'Change the text to Ok
                btnAdd.Text = "Update"
 
 
 
        End Select
 
    End Sub
 
#End Region
 
#Region "Properties"
 
 
#End Region
 
#Region "Events"
 
    ''' <summary>
    ''' Event for Page Load
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks>Page Initialisation Code</remarks>
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack = False Then
            Try
                'Set the Form Mode to New
                FormMode(0)
 
                'Enable Controls
                EnableDisableControls(True)
 
                'Set the focus
                txtCurrencyCode.Focus()
 
            Catch ex As Exception
 
            Finally
 
            End Try
        End If
    End Sub
 
    ''' <summary>
    ''' ToolBar Event
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub RadToolBar1_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick
        Try
            Select Case e.Item.Index
 
                Case "0" 'New Button
 
                    'Set The Form Mode
                    FormMode(0)
 
                    'Clear the controls
                    ClearControls()
 
                    'Enable Controls
                    EnableDisableControls(True)
 
                    'Set the focus
                    txtCurrencyCode.Focus()
 
                Case "1" 'Search Button
 
                    FormMode(1)
 
                    'Clear Controls
                    ClearControls()
 
                    'Enable Controls
                    EnableDisableControls(True)
 
                    'Set the Focus
                    txtCurrencyCode.Focus()
 
                Case "2" 'Edit Button
 
                    FormMode(3)
 
                    'Enable Controls
                    EnableDisableControls(True)
 
                    'Disable the Primary key field
                    txtCurrencyCode.Enabled = False
 
                    'Set the Focus
                    txtCurrencyName.Focus()
 
                Case "3" 'Delete Button
                    ' Call the Entity Layer
                    objELCurrencies.CurrencyCode = txtCurrencyCode.Text
                    'Call Business Layer Update Method
                    If objBLCurrencies.Delete(objELCurrencies) = True Then
 
                        'Display the Message to user                      
                        Dim radalertscript As String = "<script language='javascript'>function f(){radalert('Record Deleted Sucessfully', 330, 100,'Currencies'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"
                        Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Deleteradalert", radalertscript)
 
                        'Set the Form mode to search
                        FormMode(1)
 
                        'Clear Controls
                        ClearControls()
 
                        'Enable Controls
                        EnableDisableControls(True)
 
                        'Set the Focus
                        txtCurrencyCode.Focus()
                    Else
 
                    End If
 
 
                Case "4" 'First Record Browse button
 
                    'Enable Controls
                    EnableDisableControls(True)
 
                    'Intialise the DataSet
                    dsBrowse = New DataSet()
 
                    'get the data
                    dsBrowse = objDLCurrencies.GetAllData()
 
                    'Set the first record data
                    txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(0)(0).ToString()
                    txtCurrencyName.Text = dsBrowse.Tables(0).Rows(0)(1).ToString()
                    txtNumericCode.Text = dsBrowse.Tables(0).Rows(0)(2).ToString()
 
                    'Set the form mode
                    FormMode(2)
 
                    'Disable the Controls
                    EnableDisableControls(False)
 
                Case "5" 'Previous record Browse button
                    'Intialise the DataSet
                    dsBrowse = New DataSet()
 
                    'get the data
                    dsBrowse = objDLCurrencies.GetPreviousRecord(txtCurrencyCode.Text)
 
                    txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(0).ToString
                    txtCurrencyName.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(1).ToString
                    txtNumericCode.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(2).ToString
 
                    'Set the form mode
                    FormMode(2)
 
                    'Disable the Controls
                    EnableDisableControls(False)
 
 
                Case "6" 'Next record Browse button
                    'Intialise the DataSet
                    dsBrowse = New DataSet()
 
                    'get data
                    dsBrowse = objDLCurrencies.GetPreviousRecord(txtCurrencyCode.Text)
 
                    txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(0).ToString
                    txtCurrencyName.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(1).ToString
                    txtNumericCode.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(2).ToString
 
                    'Set the form mode
                    FormMode(2)
 
                    'Disable the Controls
                    EnableDisableControls(False)
 
                Case "7" 'Last record Browse button
                    'row Number
                    Dim rowNum As Integer = 0
                    'Intialise the DataSet
                    dsBrowse = New DataSet()
 
                    'get the data
                    dsBrowse = objDLCurrencies.GetAllData()
                    rowNum = dsBrowse.Tables(0).Rows.Count - 1
 
                    'Set the last record data
                    txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(rowNum)(0).ToString()
                    txtCurrencyName.Text = dsBrowse.Tables(0).Rows(rowNum)(1).ToString()
                    txtNumericCode.Text = dsBrowse.Tables(0).Rows(rowNum)(2).ToString()
 
                    'Set the form mode
                    FormMode(2)
 
                    'Disable the Controls
                    EnableDisableControls(False)
 
                Case "8" 'Save As
 
                    'Set the form mode to Add
                    FormMode(0)
 
                    'Enable the Controls
                    EnableDisableControls(True)
 
                    'Clear the Primary Key field and set focus
                    txtCurrencyCode.Text = String.Empty
                    txtCurrencyCode.Focus()
 
            End Select
        Catch ex As Exception
 
        End Try
    End Sub
#End Region
 
 
 
 
 
    Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        Try
            Select Case btnAdd.Text
                Case "Add"
                    'Call the Entity Layer
                    objELCurrencies.CurrencyCode = txtCurrencyCode.Text
                    objELCurrencies.CurrencyName = txtCurrencyName.Text
                    objELCurrencies.CurrencyInternationalCode = txtNumericCode.Text
                    objELCurrencies.UserCode = ""
                    objELCurrencies.URI = ""
                    objELCurrencies.CreateDate = DateTime.Now
                    objELCurrencies.UpdateDate = DateTime.Now
 
                    'Call Business Layer Create Method
                    If objBLCurrencies.Create(objELCurrencies) = True Then
 
 
                        'Display the Message to user
                        Dim radalertscript As String = "<script language='javascript'>function f(){radalert('Record Saved Sucessfully', 330, 100,'Currencies'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"
                        Page.ClientScript.RegisterStartupScript(Me.[GetType](), "radalert", radalertscript)
 
                        'Clear the controls
                        ClearControls()
                        'Set the form mode
                        FormMode(0)
                        'set the form mode
                        txtCurrencyCode.Focus()
                    Else
 
                    End If
                Case "Update"
                    'Call the Entity Layer
                    objELCurrencies.CurrencyCode = txtCurrencyCode.Text
                    objELCurrencies.CurrencyName = txtCurrencyName.Text
                    objELCurrencies.CurrencyInternationalCode = txtNumericCode.Text
                    objELCurrencies.UserCode = ""
                    objELCurrencies.URI = ""
                    objELCurrencies.CreateDate = DateTime.Now
                    objELCurrencies.UpdateDate = DateTime.Now
 
                    'Call Business Layer Update Method
                    If objBLCurrencies.Update(objELCurrencies) = True Then
 
 
 
                        'Display the Message to user                      
                        Dim radalertscript As String = "<script language='javascript'>function f(){radalert('Record Updated Sucessfully', 330, 100,'Currencies'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"
                        Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Updateradalert", radalertscript)
 
                        'Set the Form Mode
                        FormMode(2)
 
                        'Disable Controls
                        EnableDisableControls(False)
 
                    Else
 
                    End If
 
                Case "Ok"
 
                Case "Search"
                    If txtCurrencyCode.Text <> String.Empty Or txtCurrencyName.Text <> String.Empty Or txtNumericCode.Text <> String.Empty Then
                        'Intialise the DataSet
                        dsBrowse = New DataSet()
 
                        'get the data
                        dsBrowse = objDLCurrencies.SearchRecord(txtCurrencyCode.Text, txtCurrencyName.Text, txtNumericCode.Text)
 
                        'Set the first record data
                        txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(0)(0).ToString()
                        txtCurrencyName.Text = dsBrowse.Tables(0).Rows(0)(1).ToString()
                        txtNumericCode.Text = dsBrowse.Tables(0).Rows(0)(2).ToString()
                        txtCurrencyCode.Enabled = False
 
                        'Set the form mode
                        FormMode(2)
 
                        'Disable Controls
                        EnableDisableControls(False)
 
                    End If
 
            End Select
        Catch ex As Exception
        Finally
        End Try
    End Sub
 
 
End Class

14 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 11 Mar 2011, 01:07 PM
Hello Noor,

Cold you pleas let me know if the application works correctly when the Ajax is disabled on the page.
Also pleas note that it is not supported scenario to have RadAjaxManager and RadAjaxPanel on the same page for updating the same controls from the page. Please remove the RadAjaxManager and verify if this makes any difference. Also I would suggest you to review the following online demo which elaborates on RadConfirm with Ajax.



Best wishes,
Maria Ilieva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Noor hussain
Top achievements
Rank 1
answered on 12 Mar 2011, 05:58 AM
Hi Maria,

Thanks a lot for your time. I have tried your suggestions. The page works fine when I disable Ajax. I get my radalerts and radconfirms properly and my javascript variables are also refreshed. However when I apply Ajax using Radpanel or RadAjaxManager the page is not working properly. I am using the radconfirm for radtoolbar onclientclicking event. Please let me know where I am going wrong.

Regards,
Noor Hussain
0
Maria Ilieva
Telerik team
answered on 16 Mar 2011, 03:35 PM
Hello Noor,

From the provided information it is rather difficult to isolate the root cause of the issue you are facing. Please suggest opening a regular support ticket and send us sample runnable project which replicates the issue. Thus we will be able to test it locally and advise you further.


All the best,
Maria Ilieva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Noor hussain
Top achievements
Rank 1
answered on 17 Mar 2011, 07:26 AM
Hi maria

I have a trial download license for asp.Net radcontrols, hence unable to upload my entire solution. Please let me know if there is any other alternative to upload the solution.

regards,
Noor Hussain
0
Maria Ilieva
Telerik team
answered on 22 Mar 2011, 02:57 PM
Hello Noor,

I further review the code you have sent me and noticed that the RadSplitter and RadToolBar controls are added into RadAjaxManager settings and also the RadSplitter contains RadAjaxPanel in it which wraps the RadToolBar control. Note that using both the RadAjaxManager and RadAjaxPanel into the same page for updating the same controls is not supported scenario and may lead to a lot of different issue. Therefore I would suggest you to use just one of these controls to ajaxify the needed page content and verify of the problems still persist.



Kind regards,
Maria Ilieva
the Telerik team
0
Noor hussain
Top achievements
Rank 1
answered on 25 Mar 2011, 08:18 AM
Hi Maria,
Thanks a lot for your time. I tried your suggestions by using only RadAjaxPanel in my page, but the problem still persists. i also tried using only radajaxmanager also but the problems still persist.  My Radconfirm and radalerts  don't work that is my javascript variables are not getting refreshed.  I want to ajaxify my whole page. Please let me know what is the correct way to do it.

Regards,
Noor Hussain
0
Maria Ilieva
Telerik team
answered on 30 Mar 2011, 12:56 PM
Hello Noor,

The best practice in this case is to wrap the whole content of the page into single RadAjaxPanel control. Could you please test the same approach but using regular asp UpdatePanel and verify of the problem still persists?


Best wishes,
Maria Ilieva
the Telerik team
0
Noor hussain
Top achievements
Rank 1
answered on 31 Mar 2011, 12:57 PM
Hello maria,

I tried your suggestion to wrap my whole page in RadAjaxPanel, but the problem still persists. I tried using the asp updatepanel but i am getting the below error. Does the asp updatepanel support telerik controls ? Please let me know where I am going wrong ?
Server Error in '/' Application.
--------------------------------------------------------------------------------
 
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
 
Parser Error Message: Type 'System.Web.UI.UpdatePanel' does not have a public property named 'RadWindowManager'.
 
Source Error:
 
 
Line 18:     <div>
Line 19:          <asp:UpdatePanel ID="UpdatePanel1" runat="server">      
Line 20:         <telerik:RadWindowManager ID="RadWindowManager1" runat="server">       
Line 21:         </telerik:RadWindowManager>       
Line 22:        
  
 
Source File: /manage/frmCurrencies.aspx    Line: 20
 
 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Regards,
Noor Hussain
0
Maria Ilieva
Telerik team
answered on 31 Mar 2011, 02:17 PM
Hello Noor,

For testing with asp |UpdatePanel you should set it like this:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">      
<ContentTemplate>
.
.
//Your controls here
.
.
</ContentTemplate>
</asp:UpdatePanel>


Regards,
Maria Ilieva
the Telerik team
0
Noor hussain
Top achievements
Rank 1
answered on 02 Apr 2011, 08:41 AM
Hello maria,

Thanks for your time, I tried using asp update panel, but the problem still persists.  I am unable to get the serverside radalerts and clientside radprompt messages.  Please let me know if there is any other alternative.

Regards,
Noor Hussain
0
Maria Ilieva
Telerik team
answered on 06 Apr 2011, 01:56 PM
Hello Noor,

As the problem appears with UpdatePanel also it seems the issue is general to the Ajax framework and not directly related to Telerik RadAjax controls. The problematic behavior could be caused by the way you are showing and hiding the corresponding windows. However without having a project to debug locally it will be rather difficult to isolate the root cause of the issue. Please try to register the "radalertscript" by using the ScriptManager.RegisterStartupScript Method and let me know if this makes any difference.


Best wishes,
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
Noor hussain
Top achievements
Rank 1
answered on 13 Apr 2011, 11:03 AM
Hello maria,

Thanks for your suggestion. I am using the below script to generate radalert from serverside.
'Display the Message to user
                        Dim radalertscript As String = "<script language='javascript'>function f(){radalert('Record Saved Sucessfully', 330, 100,'Currencies'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"
                        Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Newradalert", radalertscript)
Please let me know if I am making a mistake anywhere. I will try to upload the Project.

Regards,
Noor Hussain
0
Maria Ilieva
Telerik team
answered on 18 Apr 2011, 11:30 AM
Hello Noor,

The presented script registration looks totally correct to me. As I previously mentioned it seems that the issue is general problem in the MS Ajax which is not directly related to our controls. Please let me know if you are able to upload an application so we could debug it locally and advise you further.


All the best,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Noor hussain
Top achievements
Rank 1
answered on 27 Apr 2011, 02:20 PM
Hi Maria,
We are planning to procure the license by next month. i will upload the application once we procure the Telerik license. thanks for your help.
Regards,
Noor hussain
Tags
Ajax
Asked by
Noor hussain
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Noor hussain
Top achievements
Rank 1
Share this question
or