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

loading pannel with RadConfirm thread blocking

2 Answers 72 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 21 Jul 2008, 01:22 PM
Hi,

I cant get the loading pannel to work in conjunction with the radconfirm (Thread blocking)  bacially what happens is:

1. I click the button
2. The radconfirm shows
3. Click ok
4. No code behind is called and no loading pannel is shown

if i remove either the loading pannel or the rad confirm and everything works

2 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 23 Jul 2008, 01:14 PM
Hi Paul,

We are not able to replicate the described behaviour.
Could you please post your code so we could further research and provide accurate solution for your issue.

Best wishes,
Maria Ilieva
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Paul
Top achievements
Rank 1
answered on 23 Jul 2008, 01:47 PM
This is the HTML and code behind


<
asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_Main" runat="Server"
 
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server"
    </telerik:RadStyleSheetManager> 
 
    <telerik:RadScriptManager ID="ScriptManager1" runat="server"  
        EnableTheming="True"
    </telerik:RadScriptManager> 
 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
    </telerik:RadWindowManager> 
  <script type="text/javascript"
        //MAKE SURE THAT THE FOLLOWING SCRIPT IS PLACED AFTER THE RADWINDOWMANAGER DECLARATION 
        //Replace old radconfirm with a changed version.    
        var oldConfirm = radconfirm;    
         //TELERIK 
         //window.radconfirm = function(text, mozEvent) 
         //We will change the radconfirm function so it takes all the original radconfirm attributes 
        window.radconfirm = function(text, mozEvent, oWidth, oHeight, callerObj, oTitle)    
        {    
            var ev = mozEvent ? mozEvent : window.event; //Moz support requires passing the event argument manually    
            //Cancel the event    
            ev.cancelBubble = true;    
            ev.returnValue = false;    
            if (ev.stopPropagation) ev.stopPropagation();    
            if (ev.preventDefault) ev.preventDefault();    
                
            //Determine who is the caller    
            var callerObj = ev.srcElement ? ev.srcElement : ev.target;    
   
            //Call the original radconfirm and pass it all necessary parameters    
            if (callerObj)     
            {    
                //Show the confirm, then when it is closing, if returned value was true, automatically call the caller's click method again.    
                var callBackFn = function (arg)    
                {               
                    if (arg)    
                    {               
                        callerObj["onclick"] = "";              
                        if (callerObj.click) callerObj.click(); //Works fine every time in IE, but does not work for links in Moz    
                        else if (callerObj.tagName == "A") //We assume it is a link button!    
                        {                                                           
                            try   
                            {    
                                eval(callerObj.href)    
                            }    
                            catch(e){}    
                        }    
                    }    
                }    
                //TELERIK 
                //oldConfirm(text, callBackFn, 300, 100, null, null);        
                //We will need to modify the oldconfirm as well                 
                oldConfirm(text, callBackFn, oWidth, oHeight, callerObj, oTitle);  
            }    
            return false;    
        }   
            </script> 
  <script type="text/javascript">  
            //cancel all select/deselect operation triggered by non-checkbox row clicks 
            function CancelNonInputSelect(sender, args)  
            {  
                var e = args.get_domEvent(); 
                //IE - srcElement, Others - target 
                var targetElement = e.srcElement || e.target; 
                 
                //is the clicked element an input checkbox? <input type="checkbox"...> 
                if(targetElement.tagName.toLowerCase() != "input" &&  
                    (!targetElement.type || targetElement.type.toLowerCase() != "checkbox"))// && currentClickEvent) 
                {                     
                 
                    //cancel the event 
                    args.set_cancel(true); 
                } 
            }  
 
    
          </script>          
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
<script type="text/javascript"
var currentLoadingPanel = null
var currentUpdatedControl = null
function RequestStart(sender, args) 
currentLoadingPanel = $find("RadAjaxLoadingPanel1"); 
if (args.get_eventTarget() == "Button3") 
currentUpdatedControl = "Panel1"
else 
currentUpdatedControl = "Panel2"
//show the loading panel over the updated control 
currentLoadingPanel.show(currentUpdatedControl); 
function ResponseEnd() 
//hide the loading panel and clean up the global variables 
if (currentLoadingPanel != null) 
currentLoadingPanel.hide(currentUpdatedControl); 
currentUpdatedControl = null
currentLoadingPanel = null
 
 
 
 
</script> 
</telerik:RadCodeBlock> 
 
 
    <div> 
    <fieldset> 
    <legend>SAP Import Staging Area</legend> 
    
        <br /> 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  
            DefaultLoadingPanelID="RadAjaxLoadingPanel1"
<ClientEvents OnRequestStart="RequestStart" 
OnResponseEnd="ResponseEnd" /> 
<AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="Button3" EventName="onclick"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="rgResults"  
                            LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
             
             
<%--                <telerik:AjaxSetting AjaxControlID="RadComboBox1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="rgResults"  
                            LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            --%> 
            </AjaxSettings> 
 
</telerik:RadAjaxManager> 
        <table width="100%"
        <td style="vertical-align: middle" class="style1"
           
        <asp:Label ID="Label1" runat="server" Text="Feeds ready to be processed:"></asp:Label> 
         </td> 
         <td style="vertical-align: middle"><telerik:RadComboBox ID="RadComboBox1" Runat="server" AutoPostBack="True"  
            OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged" 
            Skin="Vista" Width="218px" > 
            <CollapseAnimation Type="OutElastic" Duration="200"></CollapseAnimation> 
        </telerik:RadComboBox> 
             &nbsp;<br /></td
          </table> 
        </fieldset> 
 
                <telerik:RadGrid ID="rgResults" AllowMultiRowSelection="true" 
            runat="server" AllowSorting="false" GridLines="None" Width="95%"  
            Skin="Vista"  > 
            <MasterTableView Width="100%" DataKeyNames="HRID"
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
                <Columns> 
      
                </Columns> 
            </MasterTableView> 
            <ClientSettings> 
                <Selecting AllowRowSelect="true"></Selecting> 
                <ClientEvents  OnRowSelecting="CancelNonInputSelect" OnRowDeselecting="CancelNonInputSelect" /> 
            </ClientSettings> 
        </telerik:RadGrid> 
 
         
        <table style="width: 100%; text-align: right"
            <TD>         
                <asp:Button ID="Button2" runat="server" Text="Remove Selected People"  
                    onclick="Button2_Click"  OnClientClick="return radconfirm('Are you sure you wish to remove people form this load?', event, 300,150,'','Process SAP Data');" /> 
           <asp:Button ID="Button3" runat="server" Text="Process Selected People" OnClientClick="return radconfirm('Are you sure you want to insert new people in the system?', event, 300,150,'','Process SAP Data');"  onclick="Button3_Click"/> 
        </table> 
 
 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"  
         Width="100%"  Height="100%" Transparency="15" BackColor="#E0E0E0"  
        MinDisplayTime="10"
        <img alt="Loading..." src="App_Images/AJAX/loading1.gif" style="border:0px; text-align:center; vertical-align:middle " /> 
    </telerik:RadAjaxLoadingPanel> 
 
 
 
 
        <br /> 
 
        <br /> 
        <br /> 
    </div> 
 
</asp:Content> 

And the code behind
using System; 
using System.Collections; 
using System.Configuration; 
using System.Data; 
using System.Linq; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.HtmlControls; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Xml.Linq; 
using Oxygen; 
using System.Collections.Generic; 
using Telerik.Web.UI; 
using System.Xml.XPath; 
using System.IO; 
 
public partial class gridtest : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        AMUser amUser; 
 
        try 
        { 
            if (!IsPostBack) 
            { 
 
                amUser = new AMUser(); 
                int userId = Convert.ToInt32(Session["UserId"].ToString()); 
                if (!amUser.GetFormAccess(userId, this.AppRelativeVirtualPath)) 
                { 
                    Response.Redirect("~/NoAccessToThisPage.aspx"); 
                } 
            } 
        } 
 
        catch (Exception ex) 
        { 
 
            ErrorLogging.log4NetError(ex.Message, this.GetType()); 
           // DisplayMessage(true, ex.Message); 
        } 
        finally 
        { 
            amUser = null
        } 
 
 
 
        if (!IsPostBack) 
        { 
            AMSource db = new AMSource(); 
            List<objSource> l1 = db.GetSources(); 
 
 
 
            RadComboBox1.DataSource = l1; 
            RadComboBox1.DataValueField = "sourceid"
            RadComboBox1.DataTextField = "filename"
            RadComboBox1.DataBind(); 
 
            FormatGrid(); 
           rgResults.Visible = false
           Button3.Visible = false
           Button2.Visible = false
 
        } 
 
    } 
    protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    { 
        if (!IsPostBack) 
        { 
            int selval = Convert.ToInt32(RadComboBox1.SelectedItem.Value.ToString()); 
 
            AMStaging db = new AMStaging(); 
            List<objHRUpload> l1 = db.GetUploadData(selval); 
 
            rgResults.DataSource = l1; 
            rgResults.Visible = true
            //rgResults.DataBind(); 
            //  rgResults.Width = Unit.Percentage(80); 
            // rgResults.MasterTableView.Width = Unit.Percentage(80); 
            rgResults.Visible = true
            Button3.Visible = true
            Button2.Visible = true
 
        } 
 
    } 
 
    protected void RadComboBox1_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) 
    { 
        int selval = Convert.ToInt32(RadComboBox1.SelectedItem.Value.ToString()); 
 
        AMStaging db = new AMStaging(); 
        List<objHRUpload> l1 = db.GetUploadData(selval); 
 
        rgResults.DataSource = l1; 
        rgResults.Visible = true
        rgResults.DataBind(); 
        rgResults.Width = Unit.Percentage(100); 
        rgResults.MasterTableView.Width = Unit.Percentage(100); 
        rgResults.Visible = true
        Button3.Visible = true
        Button2.Visible = true
 
 
 
    } 
 
    private void FormatGrid() 
    { 
 
        rgResults.AllowPaging = false
        rgResults.PageSize = 10; 
        rgResults.AutoGenerateColumns = false
        rgResults.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; 
        rgResults.AllowMultiRowSelection = false
 
        rgResults.AllowSorting = false
        rgResults.ForeColor = System.Drawing.Color.Black; 
        rgResults.ClientSettings.Selecting.AllowRowSelect = true
        rgResults.ClientSettings.Selecting.AllowMultiCellSelect = false
        rgResults.ClientSettings.Scrolling.UseStaticHeaders = true
        rgResults.ClientSettings.Scrolling.AllowScroll = true
        rgResults.AllowMultiRowSelection = true
        rgResults.EnableViewState = true
        rgResults.Width = Unit.Percentage(100); 
        rgResults.MasterTableView.Width = Unit.Percentage(100); 
         
 
 
 
 
        GridClientSelectColumn col2 = new GridClientSelectColumn(); 
        rgResults.MasterTableView.Columns.Add(col2); 
        col2.HeaderText = "Y/N"
 
 
 
 
 
 
        GridBoundColumn col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "HRID"
        col.HeaderText = "HRID"
         
        col.Visible = false
 
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Country"
        col.HeaderText = "Country"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "OrganizationalUnit"
        col.HeaderText = "Unit"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "IDNOZERO"
        col.HeaderText = "SAP"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Firstname"
        col.HeaderText = "First Name"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Lastname"
        col.HeaderText = "Lastname"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "WorkContract"
        col.HeaderText = "WorkContract"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Position"
        col.HeaderText = "Role"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Startdate"
        col.HeaderText = "Start Date"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "changedate"
        col.HeaderText = "Change Date"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Enddate"
        col.HeaderText = "End Date"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Supnum"
        col.HeaderText = "Supervisor SAP"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Supv_name"
        col.HeaderText = "Supervisor Name"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "House"
        col.HeaderText = "House Number"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Streetnum"
        col.HeaderText = "Street"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "District1"
        col.HeaderText = "District"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "City1"
        col.HeaderText = "City"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Postalcode"
        col.HeaderText = "Post Code"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Gender"
        col.HeaderText = "Gender"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "Email"
        col.HeaderText = "Email Address"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "WorkHours"
        col.HeaderText = "Work Hours"
 
        col = new GridBoundColumn(); 
        rgResults.MasterTableView.Columns.Add(col); 
        col.DataField = "PersonID"
        col.HeaderText = "Person ID"
        col.Visible = false
 
    } 
 
 
 
    protected void Button2_Click(object sender, EventArgs e) 
    { 
        DataTable a = new DataTable(); 
        DataColumn b = new DataColumn(); 
 
        b.ColumnName = "Item"
        a.TableName = "Row"
        a.Columns.Add(b); 
 
 
 
        foreach (GridDataItem r in rgResults.SelectedItems) 
        { 
            DataRow newRow = a.NewRow(); 
            newRow["Item"] = r.GetDataKeyValue("HRID"); 
            a.Rows.Add(newRow); 
        } 
 
 
        string result; 
        using (StringWriter sw = new StringWriter()) 
        { 
            a.WriteXml(sw); 
            result = sw.ToString(); 
        } 
 
 
        AMStaging db = new AMStaging(); 
        db.SetDeleteStagingData (result, 1); 
 
 
        a.Dispose(); 
        Refeshdata(); 
 
 
 
 
    } 
    protected void Button3_Click(object sender, EventArgs e) 
    { 
 
        
        RadAjaxLoadingPanel1.Visible = true
        DataTable a = new DataTable(); 
        DataColumn b = new DataColumn(); 
 
        b.ColumnName = "Item"
        a.TableName = "Row"
        a.Columns.Add(b); 
 
 
 
        foreach (GridDataItem r in rgResults.SelectedItems) 
        { 
            DataRow newRow = a.NewRow(); 
            newRow["Item"] = r.GetDataKeyValue("HRID"); 
            a.Rows.Add(newRow); 
        } 
 
 
        string result; 
        using (StringWriter sw = new StringWriter()) 
        { 
            a.WriteXml(sw); 
            result = sw.ToString(); 
        } 
 
 
        AMStaging db = new AMStaging(); 
        db.SetPromotetolive(result, 1); 
 
 
        a.Dispose(); 
        Refeshdata(); 
        RadAjaxLoadingPanel1.Visible = false
 
    } 
 
    private void Refeshdata() 
    { 
        int selval = Convert.ToInt32(RadComboBox1.SelectedItem.Value.ToString()); 
 
        AMStaging db1 = new AMStaging(); 
        List<objHRUpload> l1 = db1.GetUploadData(selval); 
 
        rgResults.DataSource = l1; 
        rgResults.Visible = true
        rgResults.DataBind(); 
        rgResults.Width = Unit.Percentage(100); 
        rgResults.MasterTableView.Width = Unit.Percentage(100); 
        rgResults.Visible = true
        Button3.Visible = true
        Button2.Visible = true
    } 
 

One thing i did notice is that I had to write the code for the ajax manager as the wizzard would not show any controls in its dialogue


Thanks

Paul




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