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

Telerik.Web.UI.Orientation has already been registered with RadDock as a Popup

7 Answers 147 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Hemika
Top achievements
Rank 1
Hemika asked on 22 Dec 2012, 06:52 AM
Hello,
I have 2 developing environments. I have developed a sharepoint project where I include the drag and drop feature from the RadGrid to RadSchdeuler. When I drag and drop an item to the schdeuler, I am showing a RadDock as a Popup from client side using

Sys.Application.add_load(openForm);

So that it will show my appointment editing window. In one environment it is working and in the other one when I drag and drop it is giving me a script exception.

"Error: Sys.InvalidOperationException: Type Telerik.Web.UI.Orientation has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded."

If I remove that Sys.Application.add_load(openForm); then it wont give me an error, but it wont load the dock.

The Dock

<asp:Panel runat="server" ID="panelAlert">
    <telerik:RadDock runat="server" ID="RadDockAlert" Width="350px" Height="120px" Closed="true"
        Style="z-index: 2000;" Title="Alert">
        <Commands>
            <telerik:DockCloseCommand></telerik:DockCloseCommand>
        </Commands>
        <ContentTemplate>
            <div align="center">
                <asp:Label ID="lbAlertMsg" runat="server"></asp:Label>
            </div>
            <br />
            <div align="center">
                <a onclick="hideAlertForm();" id="aAlertOK" runat="server">
                    <asp:Label ID="Label3" CssClass="spriteButtons popUpOkButton" runat="server">Ok</asp:Label>
                </a>
            </div>
        </ContentTemplate>
    </telerik:RadDock>
</asp:Panel>


The function to show the popup
function openAlertForm() {
 
    var dock = $find("<%= RadDockAlert.ClientID %>");
    // Center the RadDock on the screen
    var viewPort = $telerik.getViewPortSize();
    var xPos = Math.round((viewPort.width - parseInt(dock.get_width())) / 2);
    var yPos = Math.round((viewPort.height - parseInt(dock.get_height())) / 2);
    $telerik.setLocation(dock.get_element(), { x: xPos, y: yPos });
 
    dock.set_closed(false);
 
    Sys.Application.remove_load(openAlertForm);
}


Drag-n-Drop function
function rowDropping(sender, eventArgs) {
            // Fired when the user drops a grid row
            var htmlElement = eventArgs.get_destinationHtmlElement();
            var scheduler = $find('<%= RadScheduler1.ClientID %>');
            if (isPartOfSchedulerAppointmentArea(htmlElement)) {
                // The row was dropped over the scheduler appointment area
                // Find the exact time slot and save its unique index in the hidden field
 
                var timeSlot = scheduler._activeModel.getTimeSlotFromDomElement(htmlElement);
                startDateTime = timeSlot.get_startTime();
 
                Sys.Application.add_load(openForm);
 
                $get('<%= TargetSlotHiddenField.ClientID %>').value = timeSlot.get_index();
 
                // The HTML needs to be set in order for the postback to execute normally
                eventArgs.set_destinationHtmlElement('<%= TargetSlotHiddenField.ClientID %>');
            }
            else {
                // The node was dropped elsewhere on the document
                eventArgs.set_cancel(true);
            }
        }


I am also doing this on the OnInit of the function of the page.

http://www.telerik.com/community/forums/aspnet-ajax/scheduler/asp-updatepanel-and-radscheduler-issues.aspx

I did this because the navigation from day to week etc in the RadSchdeuler.

Any help on this would be gladly accepted.

7 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 25 Dec 2012, 03:55 PM
Hi Hemika,

You can try replacing RadDock with a RadWindow. It offers a ContentTemplate as well and has a built-in center() client-side method you can use. All in all, it may provide the same popup functionality without the error in case you do not use other specific features of the Dock control. Moreover, if you only show an informationl alert you may find useful the RadWindowManager's server method for that.

Such an error can happen if our main scripts are registered twice, so you can try removing some other registrations you may have or debugging through your code to see if something is called twice instead of once.

Another thing you can try is using RadScriptManager instead of ASP ScriptManager.


All the best,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Hemika
Top achievements
Rank 1
answered on 26 Dec 2012, 09:52 AM
Thank you for your reply.

I am also using the RadDock as a popup to show the 'appointment editing' and 'creating new recurring appointment' window in the RadScheduler. What is the best way to implement it? I am not using the inbuilt appointment editing window, I have already customized it to my need. It is also giving me the same error as I mentioned earlier when I drag and drop and item to the radschduler from radgrid.
0
Slav
Telerik team
answered on 02 Jan 2013, 08:31 AM
Hello Hemika,

The online demo Scheduler / External Edit in RadDock shows a possible approach for using the RadDock as an appointment editing and inserting form for the RadScheduler.

As for the scripts registration error, have you tried the suggestions of Marin from the previous post? If you have and the problem persists I will need a fully working project and step by step instructions for replicating it in order to help you accordingly.

Regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Hemika
Top achievements
Rank 1
answered on 03 Jan 2013, 04:30 AM
I got to know that this script error is coming because of the ajax calls that I call on the controllers. My RadGrid is also giving me the same script error when I fire an event from it. It is similar to this question(link below).

http://www.telerik.com/community/forums/aspnet-ajax/scriptmanager-and-stylesheetmanager/radscriptmanager-radcontrols-and-obout-controls.aspx 

I have posted a another thread for some other problem. In that thread I have mentioned my implementations. The link to that thread is mentioned below.

http://www.telerik.com/community/forums/aspnet-ajax/scheduler/update-recurenceeditor-using-ajax.aspx

You can go through the coding of it for reference. 

I have the same solution in 3 environments. 1 is for my developing purposes and other 2 are for testing reasons. Only the environments made for testing are giving me the script error when ever I fire an event.

Note : I have no asp ScriptManager in my Master Page. I only have the Telerik RadScriptManager . This is also a SharePoint project as I mentioned earlier.

Thanks.
0
Slav
Telerik team
answered on 04 Jan 2013, 04:43 PM
Hello Hemika,

I have examined the code samples in the forum thread, however they are not enough to determine the cause of the problem.

As mentioned before such error occurs in scenarios where some scripts are registered twice. There are many possible reasons for this issue. I recommend you to start checking these ones:
  • If you manually disable embedded scripts (EnableEmbeddedScripts="false") for some RadControls. In such case, please make sure that you have included the scripts properly as shown in this help article.
  • If you use Telerik CDN and if you manually register some of the scripts
  • You add controls during AJAX request and it registers its scripts twice

In case the problem persists after trying the suggestions above, please provide a fully working project and step by step instructions for replicating the scenario so that we can examine it locally.

Kind regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Hemika
Top achievements
Rank 1
answered on 07 Jan 2013, 05:47 AM
Hello Slav and Marin
Thank you for your reply. As you said, I disabled the 'EnableEmbeddedScripts' tag (as in removed it) and removed all the manual script adding on my OnInit function. Then everything started working fine in my testing environments. Which was a big relief. :) . Now there are no script errors in my testing environments. 

The reason for registering script manually was that I was having a script error popping up when I navigate on my RadScheduler within Day, Week and Month. This problem still exists on my developing environment, but on my testing environments everything is fine as I mentioned earlier.

The script error...
SCRIPT5007: Unable to get value of the property 'Model': object is null or undefined 

Thank you for all your kind support. If you are able to solve this issue, I will be very glad. :)

0
Slav
Telerik team
answered on 09 Jan 2013, 03:34 PM
Hello Hemika,

I am afraid that the provided information is not enough to determine what the exact problem is and what is causing the script error in RadScheduler. I would suggest checking if the problem can be reproduced with the example in the online demo Scheduler / Drag-and-drop and if it cannot, how should it be modified in order to match your scenario. This will be useful for reproducing the problem locally and inspecting it.

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