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

javascript problem

3 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 1
Michele asked on 10 Nov 2010, 11:00 AM
Hello everyone, I have a problem with the javarscript in the grid :

if I put the grid inside an <ASP:Panel> to bring up a screen of data loading:

<telerik:RadAjaxManager ID="RadAjaxManager2" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <ClientEvents OnRequestStart="RequestStart" OnResponseEnd="RequestEnd"></ClientEvents>
        <AjaxSettings>
                  <telerik:AjaxSetting AjaxControlID="Panel1">
                         <UpdatedControls>
                              <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        </UpdatedControls>
                 </telerik:AjaxSetting>
      </AjaxSettings>
</telerik:RadAjaxManager>
<asp:Panel ID="Panel1" runat="server"
        <telerik:RadGrid ID="GriEleRec" runat="server"
            AllowAutomaticUpdates="True" AllowPaging="True"
            AutoGenerateEditColumn="True" DataSourceID="MySQLDataSource"
            GridLines="None" Skin="Web20" PageSize="12"
            AllowAutomaticDeletes="True" AutoGenerateColumns="False"
            style="margin-right: 23px"
            Width="100%"
            OnInsertCommand="InsRep"
            OnDeleteCommand="DelRep"
            OnUpdateCommand="UpdRep"
            AutoGenerateDeleteColumn="True"
            AllowSorting="True">
 
             .......
             ......
 
     </telerik:RadGrid>
 
 
<script language="javascript" type="text/javascript">
         var currentLoadingPanel = null;
 
         function RequestStart(sender, eventArgs) {
             check = InStr(eventArgs.EventTarget, "btnEli");
             //alert(check);
             if (check > 0) {
                 eventArgs.EnableAjax = false;
             }
             else {
                 eventArgs.EnableAjax = true;
                 centerElementOnScreen($get("<%= RadAjaxLoadingPanel1.ClientID %>"));
                 HideFrame();
             }
 
         }
 
         function RequestEnd(sender, eventArgs) {
             ShowFrame();
         }
 
         function centerElementOnScreen(element) {
             var scrollTop = document.body.scrollTop;
             var scrollLeft = document.body.scrollLeft;
             var viewPortHeight = document.body.clientHeight;
             var viewPortWidth = document.body.clientWidth;
             if (document.compatMode == "CSS1Compat") {
                 viewPortHeight = document.documentElement.clientHeight;
                 viewPortWidth = document.documentElement.clientWidth;
                 scrollTop = document.documentElement.scrollTop;
                 scrollLeft = document.documentElement.scrollLeft;
             }
             var topOffset = Math.ceil(viewPortHeight / 2 - element.offsetHeight / 2);
             var leftOffset = Math.ceil(viewPortWidth / 2 - element.offsetWidth / 2);
             var top = scrollTop + topOffset - 40;
             var left = scrollLeft + leftOffset - 70;
             element.style.position = "absolute";
             element.style.top = top + "px";
             element.style.left = left + "px";
         }   
     </script></telerik:RadCodeBlock>


in which case the grid to do an javascript windows.open or an export to excel gives me a runtime error and I reload the same page

I do something wrong?

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 10 Nov 2010, 01:32 PM
Hi Michele,

Remove RadAjaxManager or disable AJAX on the page to get the exception page with the stack trace. It will give you more info on what caused the exception.

Veli
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
Michele
Top achievements
Rank 1
answered on 10 Nov 2010, 02:04 PM
If Ajax id disabled or if I'll delete RadAjaxManager the windows.open javascript work fine, but the loading panel don't work.

If Ajax is active like my precedent post i have this error:

0
Veli
Telerik team
answered on 10 Nov 2010, 03:37 PM
Hello Michele,

Are you using Response.Write() in your code? Or are you using both RadAjaxManager and RadAjaxPanel to AJAX-ify one and the same content? Note that the latter scenario is not supported, as discussed in the following help topic.

Best wishes,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Michele
Top achievements
Rank 1
Answers by
Veli
Telerik team
Michele
Top achievements
Rank 1
Share this question
or