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

RADAjax Manager does not load JS files in dynamically loaded user control

65 Answers 1343 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
zaphod94
Top achievements
Rank 1
zaphod94 asked on 12 Nov 2007, 08:56 PM
Looks like this is a bug in RADAjaxManager and I havent been able to find a suitable workaround

1. I have a page with a button and a asp panel control.
2. The page has been Ajaxified using the RADPrometheus Ajax Manager.
3. Click of button triggers dynamic load of a user control into the panel
4. The user control includes webusercontrol.js file via Script Manager Proxy.
5. User control has a button and a text box
6. Button click has been wired to call a setTest() js function defined in webusercontrol.js
7. When the page renders, I click the button to dynamically load the user control into the panel.
8. Clicking the button on the user control to set the text results in "Object required" error. What is happening is that the setText() function defined in the included script file is not visible.

//// Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TelerikAjaxTest._Default" EnableEventValidation="false" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Telerik Prometheus RADAjaxManager Text</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"
        EnablePartialRendering="true"
        EnablePageMethods="true"
        LoadScriptsBeforeUI="true">
        <Scripts></Scripts>
    </asp:ScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnLoadControl">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlContent" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
       
    </telerik:RadAjaxManager>
    <div>
        <asp:Button ID="btnLoadControl" runat="server" Text="Load Control" />
    </div>
    <div>
        <asp:Panel ID="pnlContent" runat="server"></asp:Panel>
    </div>
    </form>
</body>
</html>

////// Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace TelerikAjaxTest {
    public partial class _Default:System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            this.btnLoadControl.Click += new EventHandler(btnLoadControl_Click);
        }

        void btnLoadControl_Click(object sender, EventArgs e) {
            this.pnlContent.Controls.Clear();
            UserControl uc;
            uc = Page.LoadControl("WebUserControl1.ascx") as UserControl;

            if (uc != null) {
                this.pnlContent.Controls.Add(uc);
            }

        }
    }
}

//// WebUserControl1.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="TelerikAjaxTest.WebUserControl1" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    <Scripts>
        <asp:ScriptReference Path="WebUserControl.js" NotifyScriptLoaded="true" />
    </Scripts>
</asp:ScriptManagerProxy>
<div>
    Web User Control with Script Manager Proxy
    This controls is loaded dynamically via the click of the button on
    the main page
</div>
<div>
    <button id="btnAddText" runat="server" onclick="setText">Set Text</button>
</div>
<div>
    <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
</div>
<script type="text/javascript">
    var txtNameId=<%= txtName.ClientID %>;
   
    alert('WebUserControl1.ascx');
</script>

////// WebUserControl.js
// WebUserControl.js

function setText(){
    var oTxt=$get(txtNameId);
    if((oTxt!=null)&&(typeof(oTxt)!='undefined')){
        oTxt.value=oTxt.value+'Some Text';
    }
}

// Notify the AJAX framework that this script has completed loading.
// Making this the last line in the file ensures that this is executed
// last
if(typeof(Sys) !== "undefined")Sys.Application.notifyScriptLoaded();





Any feed back appreciated

thanks
zaphod

65 Answers, 1 is accepted

Sort by
0
rwozniak
Top achievements
Rank 1
answered on 14 Nov 2007, 07:26 PM
I am very interested in seeing this work as well. I am currently using the Q2 2007 SP1 version of RadAjaxManager because EnablePageHeadUpdate does not yet appear to work in the Prometheus version.
0
Missing User
answered on 16 Nov 2007, 12:43 PM
Hi rwozniak,


 

Unfortunately this is a problem with our current implementation. I will forward your request to our development team. 

One possible workaround is to set the Visible property of the UserControl to false. Please find attached a sample web application that demonstrates the needed approach.

Let me know if you have other question and/or problems.

 




Kind regards,
Plamen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rwozniak
Top achievements
Rank 1
answered on 16 Nov 2007, 02:07 PM
This is unfortunately not an acceptable workaround, because your example assumes that I know at page load time what user control is going to be loaded into the panel.

For example, an application may have a RadTree in a splitter pane on the left, and a Panel in the pane on the right. Depending on which tree node is clicked, a different user control will be dynamically loaded on the right. If there are 50 nodes on the left it would be highly impractical to load all 50 user controls (with Visible-false) on the right...just so that the resources will be available if its associated node is clicked.

I would consider this current shortcoming to be a very, very serious one. After all, how can you have an EnablePageHeadUpdate property at all if it doesn't work when set to true?

This is a showstopper for us. Without this functionality, we will be forced to stick w/ the non-Prometheus version of RadAjaxManager. This really concerns me, given the fact that it will eventually be unsupported. I'm also not sure of the implications of moving to the other Prometheus controls, but having to stay with a prior version of RadAjaxManager.

Thanks,
Ross
0
Missing User
answered on 20 Nov 2007, 09:23 AM
Hi rwozniak,

The second workaround is using RadScriptBlock to add an external javascript. I prepared another sample project (AJAXEnabledWebSite16.zip) for your reference and attached the files to this thread.

I hope the current solution is applicable for you.


Sincerely yours,
Plamen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael Tissington
Top achievements
Rank 1
answered on 25 Nov 2007, 01:48 AM
I have this problem too, is there a solution yet ?
0
Michael Tissington
Top achievements
Rank 1
answered on 25 Nov 2007, 01:53 AM
One more bit of information ...

I am using RadCodeBlock with <% %> elements so I can not put it into a script file like your example ....

The fact that the script is not getting loaded for subsequent loads of different usercontrols looks very much like an URGENT bug.
0
Steve
Telerik team
answered on 26 Nov 2007, 10:57 AM
Hi Michael Tissington,

The problem has already been addressed. I am attaching a trial version of the fix here for testing. Whoever needs dev build, please open a support ticket and we will provide you with one.

Sorry for the inconvenience.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ramesh
Top achievements
Rank 1
answered on 26 Nov 2007, 03:11 PM
Steve,
Can you please elaborate on which "problem" had been already fixed? The original RADAjax manager does not load JS files in dynamically loaded user control
or
Michael Tissington's specific issue with using RADCode  block

If the original issue has been addressed I would like to get the hot fix too

Please advise
thanks
ramesh
0
Michael Tissington
Top achievements
Rank 1
answered on 26 Nov 2007, 07:58 PM
Steve, this does not appear to have fixed the problem .... :(
0
UT_DEV
Top achievements
Rank 1
answered on 28 Nov 2007, 09:06 AM
"The original RADAjax manager does not load JS files in dynamically loaded user control "

But if you staticaly load controls in Page_Load method all works  perfect(but only for blocks stored in MS AjaxPanels)
0
Steve
Telerik team
answered on 29 Nov 2007, 02:49 PM
Hi guys,

Michael: I believe that I have pointed you to the problem in your case in your support ticket
Ramesh: the original issue has not yet been fixed. It is logged in our bug tracking system and we will address it for subsequent release of the control (we will do our best to fix it for the official Prometheus release).

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Scott
Top achievements
Rank 2
answered on 04 Dec 2007, 03:34 AM
Glad to have seen this post.  I've spent (wasted) close to a day trying to figure out what's wrong and had to write a little test page to make sure my code was correct and came to the conclusion that it's a bug when user control is loaded dynamically...arrrgh!   But glad you guys are aware of it.
0
Russell
Top achievements
Rank 1
answered on 01 May 2008, 04:17 PM
Any update on the status of dynamically loading script files from a user control?
0
Yavor
Telerik team
answered on 02 May 2008, 05:55 AM
Hi Eric,

The issue is still not resolved, bur our developers are aware of it and will address it soon.
I hope it is not causing you much inconvenience in the meantime.

All the best,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
fabio selingrim
Top achievements
Rank 1
answered on 09 Feb 2009, 04:42 PM
Any solutions for this problem ??
0
SamJ
Top achievements
Rank 1
answered on 10 Feb 2009, 06:11 AM
HI,

Try registering your scripts through the ScriptManager.

Regards,
SamJ
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 17 Feb 2009, 08:56 PM
I have a user control with some javascript that looks something like this...

<telerik:RadCodeBlock ID="block1" runat="server">  
    <script language="javascript">  
          
        var Grid_CCC;  
        var Master_CCC;  
          
        function GridCreated_CCC(sender, eventArgs)  
        {  
            Grid_CCC = sender;  
            Master_CCC = Grid_CCC.get_masterTableView();  
        }  
          
</telerik:RadCodeBlock> 

I have a grid later in the control which has a clientsetting

OnGridCreated

 

="GridCreated_CCC"

 

 

 

 

 


When the user control is dynamically loaded after an ajax update, I get a javascript error telling me that GridCreated_CCC does not exist. I believe this is an example of the issue discussed in this thread. As you can see, I use a RadCodeBlock. I have also tried to use a RadScriptBlock, but the same error occurs. Is there any update as to a fix or workaround to this issue. It seems like it has been around a very long time.

I am using the 2008 Q3 version 1314 controls.
0
Sebastian
Telerik team
answered on 18 Feb 2009, 08:50 AM
Hi Albert,

Have you tried to register the OnGridCreated client handler using the ScriptManager.RegisterStartupScript static method from within the dynamically loaded web user control? Thus the script should be registered and accessible on the page when you load the user control on ajax request.

Another approach you can try is to move the RadCodeBlock on the main page.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 18 Feb 2009, 05:06 PM
As for B), I am using dynamically loaded user controls. I tried to add a script block around the user control in the dynamic loading process, but that didn't seem to make a difference.

As for A), how do I use RegisterStartUpScript to register an event handler like Grid_Created? And where within the usercontrol event cycle? Can you please provide an example.
0
Vlad
Telerik team
answered on 19 Feb 2009, 07:43 AM
Hi guys,

Generally RadCodeBlock cannot execute JavaScript - you should use RadScriptBlock instead.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 19 Feb 2009, 03:44 PM
I tried RadScriptBlock both inside the usercontrol and also to wrap around the usercontrol, and neither made a difference. There appears to be a suggested fix here (of using ScriptManager.Register....), but no one appears to be eager to provide an example.
0
Sebastian
Telerik team
answered on 19 Feb 2009, 04:02 PM
Hi Albert,

The signature of the method is specified in the MSDN article linked in my previous reply. You can use it in the same manner as you will register other javascript function in this case.

Regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 19 Feb 2009, 04:54 PM
Thanks. I am aware of the syntax, I'm just not sure where to put it. I added the following in the Page_Load event handler of my user control:

ScriptManager.RegisterStartupScript(Me, Me.GetType, "CCC", "GridCreated_CCC", True) 

But it didn't seem to make a difference. I still get a 'GridCreated_CCC' is undefined javascript error when the usercontrol is loaded with an ajax update. I also tried it with the same syntax, but "False" for the include script tags attribute, and there was no difference.
0
SamJ
Top achievements
Rank 1
answered on 20 Feb 2009, 06:22 AM
Hi,

I assume that this error is expected as you haven't really registered the 'GridCreated_CCC' method. Try the following:

Dim script As String = "var Grid_CCC; var Master_CCC; " + "function GridCreated_CCC(sender, eventArgs) {  "  
   + " Grid_CCC = sender; Master_CCC = Grid_CCC.get_masterTableView(); }  " 
ScriptManager.RegisterStartupScript(Page, GetType(Page), "script", script, True

Tell me if it works.

Thanks,
SamJ


0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 20 Feb 2009, 07:09 AM
Thanks for the suggestion, SamJ, but that doesn't work either. And even if it did, it would certainly be an untennable solution. You can't go including all of your client-side code in code-behind. Anyways, given the length of this thread it appears that this bug has been known for a year and a half. I can't understand how it wouldn't be an urgent matter for telerik to fix it. Basically I am unable to use their Ajax Controls with dynamically-loaded User controls if the user control includes client-side scripting. Given that most of telerik's controls require client-side scripting, this puts me in a tremendous bind. It totally rules out user control load on demand scenarios, which are a primary performance improvement technique that telerik encourages. I'm not the first one to mention it in this thread, but this is becoming very frustrating.
0
SamJ
Top achievements
Rank 1
answered on 20 Feb 2009, 07:25 AM
Hi Albert,

I agree with you.
However until it is fixed, what we could do is to find alternative solutions for our cases. What I do if I were in your situation, I would move my client script into js files and just register the file through the ScriptManager.

Regards,
SamJ
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 20 Feb 2009, 09:59 AM
I don't believe moving the script to a .js file is going to be an option. In each of my user controls, within the Codeblock there is a <style></style> section with the following. This is necessary to accomodate the updatepanel 100% height bug.

<style type="text/css">  
#<%= Me.GetMyAjaxManagerUpdatePanelId("pnlGrid") %> 
        {  
            margin:0;  
            height:100%;  
        }  
</style> 

GetMyAjaxManagerUpdatePanelId is a method which returns the client Id of the update panel.

This style block cannot be placed in an external; .js file.
0
SamJ
Top achievements
Rank 1
answered on 20 Feb 2009, 11:13 AM
Well, I am afraid I am out of ideas and cannot help you.
I hope you find resolution for your issues soon.

SamJ
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 20 Feb 2009, 03:30 PM
Thanks for the attempt! Is anyone from Telerik out there?
0
Rosen
Telerik team
answered on 20 Feb 2009, 06:03 PM
Hello Albert,

I have attached a small application demonstrating similar scenario. Can you please take a look maybe I'm missing something obvious?

Greetings,
Rosen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 23 Feb 2009, 04:04 PM
I am not a C# programmer, but I think I was able to figure out the code which was attached. I don't know if it works since it isn't a project, but I assume you tested it. Anyways, other than the fact that you are ajaxifying a placeholder control (something I have thought you could not do with Telerik Controls), it seems pretty straightforward. Unfortunately, I am not implementing such a straight forward example. Mine is more like your "Load-On-Demand" tabs demo. Interestingly, the Load On Demand Tabs example does not use the "LastLoadedControl" construct you have in the attached code Page_Load event. When I first implemented load on demand tabs, I was a little surprised about the ommision, but the demo works, so I assume it is not necessary.
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 02 Mar 2009, 03:00 PM
Any update on this?
0
Rosen
Telerik team
answered on 04 Mar 2009, 08:58 AM
Hello Albert,

Can you please send us (attached to a formal ticket)  a small sample project in which the behavior in question can be reproduce? Thus we will be able to gather more details about the your exact scenario and provide you with detailed answer.

Sincerely yours,
Rosen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 11 Mar 2009, 02:48 PM
Well, after going through a support ticket, I have found the following...If, you are loading usercontrols via ajax (such as in the Telerik load-on-demand pageview example), then there are some scenarios under which this will not work..

If you have any javascript script blocks within the user control....

You must either, set the ajaxmanager RestoreOriginalRenderDelegate property to true, or your page must inherit from the Telerik RadJaxPage base class instead of System.Web.UI.Page.

Doing the first will in all likelihood prevent your app from working in many 3rd party hosting environments as they are being run in medium trust.

Doing the second is certainly straightforward, however, in many cases a developer does not have a choice of which page base class to inherit from, as is the case in my scenario.

So for me, it would appear that the use of Telerik Ajax to load User controls has some serious limitations. According to the support tech, these are limitations of MS Ajax, and there is no way around them except the two methods I mentioned.
0
Josh
Top achievements
Rank 1
answered on 15 Sep 2009, 05:30 PM
Dear Telerik,

Is the above the last word on this problem?  I am trying to create a RadGrid using a user control as the insert/edit form.  I've found that on adding a new row to the grid the user control's javascript is not recognized.  That is, I get a " 'Null' is not null or an object" error message on the OnClientClick event. 

I don't have any problem with editing strangely enough.  If information exists then the form works without error.

I've also tried to put the usercontrol's Javascript and include it in a RadScriptBlock, but I receive an error that the .js file cannot be found. 

Any news on this? Solutions?

Sincerely,
Josh
0
Vlad
Telerik team
answered on 16 Sep 2009, 05:40 AM
Hi Josh,

Can you send us small example (via support ticket) where we can reproduce and debug this problem?

All the best,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Josh
Top achievements
Rank 1
answered on 16 Sep 2009, 06:22 PM
Dear Vlad,

I have solved my problem.  Because the radgrid dynamically loads the usercontrol the clientIDs do not yet exist.  Therefore, it is necessary to pass the clientIDs from the RadGrid1_ItemDataBound event after the usercontrol has been loaded to the Javascript via something like the below code:

 

 

script.Append("clientCalendar = '" + calendarClientID + "';");   
RadAjaxManager.GetCurrent(Page).ResponseScripts.Add(script.ToString());   
 

 

The clientCalendar is a variable in the Javascript that gets populated with the ClientID value from the C# code. 
My biggest issue was the fact that the Item could be obtained from Insert, but not edit, in the ItemCommand Event.
Like so:

if (e.CommandName == RadGrid.InitInsertCommandName)   
{  
other code...   
GridEditableItem insertedItem = e.Item.OwnerTableView.GetInsertItem();   
// Get the insert/edit form's user control    
UserControl uc = insertedItem.FindControl(GridEditFormItem.EditFormUserControlID) as UserControl;   


If you attempt to do something like the above except with the RadGrid.EditCommandName it fails.  The ItemDataBound event must be used to obtain the user control during the Edit event.

Josh

 

 

0
Zeke Sheppard
Top achievements
Rank 1
answered on 18 Feb 2010, 04:13 PM
Albert, 
Setting the RadAjaxManager RestoreOriginalRenderDelegate to True on the container page did not resolve this issue. Client side function still not found on the .ascx and prevented LoadControl from succeeding.

Are you doing something different to allow this to work?
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 18 Feb 2010, 04:18 PM
Zeke, I have given up loading user controls using AJAX given the limitations described in this thread. What you are doing sounds like it should work, though not in 3rd party hosting environments. If it isn't working, I would sugeest you submit a support ticket with Telerik.
0
Zeke Sheppard
Top achievements
Rank 1
answered on 18 Feb 2010, 04:26 PM

Albert, thanks for the prompt response.

This seemed like a promising resolution, since I've got control of the environment, but to no avail. Telerik to this point, has been unable to provide a workable solution despite repeated inquiries.

Thanks again for your response.

 

0
Rosen
Telerik team
answered on 19 Feb 2010, 07:11 AM
Hi Zeke,

Can you please provide more detailed information on what your scenario is? Please verify that your are using RadScriptBlock control around the scripts you need to be loaded. It will be appreciated if you can send us (attached to a formal ticket) a small runnable sample.
Also did you look at the attached sample in this thread which demonstrates similar functionality.

Best wishes,
Rosen
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
Zeke Sheppard
Top achievements
Rank 1
answered on 19 Feb 2010, 01:26 PM

Your site has literally dozens of non working samples (pick any one), including this thread, yet no working solution from Telerik. Your group has never given any working solution to this issue. Please provide a solution to the original issue listed on this thread. This has not happened to date.

As evidenced in this thread, even experienced Telerik users have given up on this technique, due to the inability to determine a workable solution. This appears to be an issue known to your group for at least two years.

 

 

 

0
Rosen
Telerik team
answered on 19 Feb 2010, 04:51 PM
Zeke,

I have attached a fully runnable sample which demonstrates how to accomplish the scenario from the first post in this thread. Please let me know if I'm missing something obvious.

All the best,
Rosen
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
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 19 Feb 2010, 05:10 PM
In your smaple project, is there a particular reason you have an update panel in the declaration? Also, this example doesn't make use of the LastLoadedControlName convention that Telerik typically employs in their dynamic user controls examples. Is this no longer necessary for some reason, or is it only unecessary in Ajax scenarios?
0
Rosen
Telerik team
answered on 19 Feb 2010, 05:21 PM
Albert ,

As you can see the UpdatePanel is commented out and it is just a leftover from some testing not related to the sample. As to the rest of the code and naming etc. it is directly taken from the first post in this thread.
Note that the example is not how to load/reload usercontrols but to demonstrate the script resolving.

Sincerely yours,
Rosen
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
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 19 Feb 2010, 05:31 PM
Just so I am not confused, what originally brought me to this thread was that I was trying to implement your dynamically loaded user controls examples using ajax, and was having issues when the user controls contained javascript. To my knowledge, the only way Telerik has found around these issues was setting RestoreOriginalRenderDelegate to true, or inheriting the page from a Telerik Page Base class. The first option is problematic because it won't work in most 3rd party hosted environments. The second is problematic because, at least in my case, I don't have an option as to what base class my pages inherit from.

So, that is why I abandoned the idea of dynamically loading user controls using AJAX. Just so I'm clear, regardles of whether the previously attached project solves the original issue in this thread, Telerik hasn't yet come up with a better way (other that the two options I mentioned) of circumventing this limitaiton in AJAX. Is this correct?
0
Rosen
Telerik team
answered on 22 Feb 2010, 12:19 PM
Hello Albert,

If I can recall correctly you have issues with medium trust environments and as you know (and stated in the docs) in order  RadAjax to work as expected in such environments RadAjaxPage need to be used due to some limitations in ASP.NET Page's architecture in extensibility aspect. In full trust  environments (as the one demonstrated in the sample) there is not need for such extra step and scripts should be evaluated in the demonstrated manner.

However with Q1 2010 version of RadControls for ASP.NET AJAX we will introduce an interface which can be implemented in case you are using a base page which cannot be modified. By using this interface you will be able to use the RadAjax in medium trust environments by providing the RadAjaxPage's functionality by your own, thus without need to directly inherit from RadAjaxPage.

Kind regards,
Rosen
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
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 22 Feb 2010, 03:02 PM
Thanks. That's exactly the sort of solution I was looking for. I look forward to the next release.
0
Deepak Saboji
Top achievements
Rank 1
answered on 24 Aug 2010, 02:50 PM
Hi,

Has this problem been fixed in the latest version? If it is, please let us know the version details.

Thanks,
Deepak Saboji.

0
Austin
Top achievements
Rank 1
answered on 22 Sep 2010, 06:01 PM
It seems like a long enough time frame has gone by for the last question asked, which is 'any update yet?'  So I'm going to second the question.  Any update yet??
0
Iana Tsolova
Telerik team
answered on 25 Sep 2010, 07:56 AM
Hello Austin,

Normally, when you have javascript block in your dynamically loaded control, for that javascript to be evaluated properly, you need to wrap it in a RadScriptBlock.
A possible reason for this solution not to work is if you have any invalid ajax settings. So you should either refactor your ajax settings or register the scripts manually calling the ScriptManager.RegisterStartupScript() static method.

All the best,
Iana
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
Austin
Top achievements
Rank 1
answered on 29 Dec 2010, 10:44 PM
Actually, I was asking for an update to the post given by Rosen on Feb 22, 2010... is there any update on this functionality:

Rosen posted:
"However with Q1 2010 version of RadControls for ASP.NET AJAX we will introduce an interface which can be implemented in case you are using a base page which cannot be modified. By using this interface you will be able to use the RadAjax in medium trust environments by providing the RadAjaxPage's functionality by your own, thus without need to directly inherit from RadAjaxPage."

Thanks,
0
Iana Tsolova
Telerik team
answered on 30 Dec 2010, 11:52 AM
Hello Austin,

The mentioned interface was implemented just as my colelague stated. You can find more information on it here.

Regards,
Iana
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
Austin
Top achievements
Rank 1
answered on 30 Dec 2010, 03:56 PM
Thanks, that is what I was looking for!  We implemented a different approach to get around this issue due to time requirements, but if we run into this again, or ever rework that area, then I will give this a try.
0
Kyaw
Top achievements
Rank 1
answered on 23 May 2012, 04:05 AM
Hi Telerik Team,

I also can't fix this issue.
Master page i referenced some javascript files, css and inline script. And added the RadCodeBlock, RadAjaxManager and RadAjaxLoadingPanel. After post back reference javascript, css and inline script are not working.

<head>
<script type="text/javascript" src="../../Scripts/jquery-1.6.1.min.js"></script>
 
    <script type="text/javascript" src="../../Scripts/jquery_YPbanner.js"></script>
 
    <script type="text/javascript">
 
        //TEXT RESIZE
        function getCookie(c_name) {
            if (document.cookie.length > 0) {
                c_start = document.cookie.indexOf(c_name + "=");
                if (c_start != -1) {
                    c_start = c_start + c_name.length + 1;
                    c_end = document.cookie.indexOf(";", c_start);
                    if (c_end == -1) c_end = document.cookie.length;
                    return unescape(document.cookie.substring(c_start, c_end));
                }
            }
            return "";
        }
 
        function setCookie(c_name, value, expiredays) {
            var exdate = new Date();
            exdate.setDate(exdate.getDate() + expiredays);
            document.cookie = c_name + "=" + escape(value) +
                ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
        }
 
        var sitefunctions = {
            textresize: function() {
                // show text resizing links
                var $cookie_name = "PAGCFontSize";
                var originalFontSize = $("body").css("font-size");
                // if exists load saved value, otherwise store it
                if (getCookie($cookie_name)) {
                    var $getSize = getCookie($cookie_name);
                    $("body").css({ fontSize: $getSize + ($getSize.indexOf("px") != -1 ? "" : "px") }); // IE fix for double "pxpx" error
                    if ($getSize.indexOf(14) != -1) { $(".gc_resizeBig").addClass("gc_resizeActive"); }
                    if ($getSize.indexOf(12) != -1) { $(".gc_resizeNormal").addClass("gc_resizeActive"); }
                    if ($getSize.indexOf(10) != -1) { $(".gc_resizeSmall").addClass("gc_resizeActive"); }
                } else {
                    setCookie($cookie_name, originalFontSize);
                }
                // reset
                $(".gc_resizeNormal").bind("click", function() {
                    $("body").css("font-size", 12);
                    setCookie($cookie_name, 12);
                    $(".gc_resizeActive").removeClass("gc_resizeActive");
                    $(this).addClass("gc_resizeActive");
                    return false;
                });
                // text small
                $(".gc_resizeSmall").click(function() {
                    $("body").css("font-size", 10);
                    setCookie($cookie_name, 10);
                    $(".gc_resizeActive").removeClass("gc_resizeActive");
                    $(this).addClass("gc_resizeActive");
                    return false;
                });
                $(".gc_resizeBig").click(function() {
                    $("body").css("font-size", 14);
                    setCookie($cookie_name, 14);
                    $(".gc_resizeActive").removeClass("gc_resizeActive");
                    $(this).addClass("gc_resizeActive");
                    return false;
                });
 
            }
        };
 
        $(document).ready(function() {
            $(".gc_homeTabsContents > div").hide();
            $(".gc_homeTabsContents > div:first").show();
            $(".gc_homeTabsItems ul li").click(function() {
                if ($(this).attr("class") != "active") {
                    //SWITCH TAB STYLE
                    $(this).siblings().removeClass("active");
                    $(this).addClass("active");
 
                    //SWITCH CONTENT
                    var thisnum = $("a", this).attr("href");
                    $(".gc_homeTabsContents > div").hide();
                    $(".gc_homeTabsContents").find(thisnum).show();
                }
            })
 
            //BANNER
            $('.BannerHolder').BannerRotator({
                delay: 5000,
                speed: 1000,
                controlPOS: 'BR',
                arrow: false,
                startNum: 0
 
            });
            //============ TEXT RESIZE
            sitefunctions.textresize();
        });
    </script>
 
    <!-- <link href="../_Survey/NSurveyAdmin/CSS/nsurveyadmin.css" type="text/css" rel="stylesheet" /> -->
    <link href="../App_Themes/infolab/basic.css" type="text/css" rel="stylesheet" />
    <link href="../App_Themes/infolab/CustomTelerik.css" type="text/css" rel="stylesheet" />
</head>
<body>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
 
        function RequestStart(sender, args) {
            // the following Javascript code takes care of expanding the RadAjaxLoadingPanel
            // to the full height of the page, if it is more than the browser window viewport
 
            var loadingPanel = $get("<%= RadAjaxLoadingPanel1.ClientID %>");
            var pageHeight = document.documentElement.scrollHeight;
            var viewportHeight = document.documentElement.clientHeight;
 
            if (pageHeight > viewportHeight) {
                loadingPanel.style.height = pageHeight + "px";
            }
 
            var pageWidth = document.documentElement.scrollWidth;
            var viewportWidth = document.documentElement.clientWidth;
 
            if (pageWidth > viewportWidth) {
                loadingPanel.style.width = pageWidth + "px";
            }
 
            // the following Javascript code takes care of centering the RadAjaxLoadingPanel
            // background image, taking into consideration the scroll offset of the page content
 
            if ($telerik.isSafari) {
                var scrollTopOffset = document.body.scrollTop;
                var scrollLeftOffset = document.body.scrollLeft;
            }
            else {
                var scrollTopOffset = document.documentElement.scrollTop;
                var scrollLeftOffset = document.documentElement.scrollLeft;
            }
 
            var loadingImageWidth = 55;
            var loadingImageHeight = 55;
 
            loadingPanel.style.backgroundPosition = (parseInt(scrollLeftOffset) + parseInt(viewportWidth / 2) - parseInt(loadingImageWidth / 2)) + "px " + (parseInt(scrollTopOffset) + parseInt(viewportHeight / 2) - parseInt(loadingImageHeight / 2)) + "px";
        }
 
    </script>
    </telerik:RadCodeBlock>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <ClientEvents OnRequestStart="RequestStart" />
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="pnl_Loading">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnl_Loading" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" IsSticky="true" CssClass="ModalPanel" Transparency="50" />
    <asp:Panel ID ="pnl_Loading" runat ="server">
</asp:Panel>
</body>

0
Iana Tsolova
Telerik team
answered on 23 May 2012, 01:13 PM
Hi, Kyaw

Try setting the EnablePageHeadUpdate property of the RadAjaxManager to false and see if it works.
You can also replace the RadCodeBlock with RadScriptBlock and let me know if it makes any difference. Or at leaset wrap the scripts in the <head> tag with RadScriptBlock.

All the best,
Iana Tsolova
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
Kyaw
Top achievements
Rank 1
answered on 24 May 2012, 04:27 AM
Hi,

After I changed EnablePageHeadUpdate property of the RadAjaxManager to false, the javascript is working fine.

One more question, now i can't open RadAjaxManager1.ResponseScripts.Add(@"radalert('Class has been updated.', 300, 110,'Class Management');"); in my user control.

Is there any way to call this kind of function.

Thanks.
0
Iana Tsolova
Telerik team
answered on 25 May 2012, 07:46 AM
Hi,

Try registering the scripts through the ScriptManage instead:
ScriptManager.RegisterStartupScripts(Page, typeof(Page), "script", radalert('Class has been updated.', 300, 110,'Class Management');", true);

Greetings,
Iana Tsolova
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
Kyaw
Top achievements
Rank 1
answered on 28 May 2012, 11:28 AM
Hi,

I still have a problem , i put RadAjaxManager, Loading Panel and RadAjaxPanel in master page.
Normal functions look fine.
But for RadUpload control not working. If generated excel file, got issue like that "Server cannot set content type after HTTP headers have been sent.". 

So many problems.


Thanks.,
0
Rohan
Top achievements
Rank 1
answered on 20 Oct 2012, 06:57 AM

Hi all,

 

I have  following scenario.

I am using the radgrid with Edit Usercontrol.

In user control we do some operation and show the status of operation via RADWindow …

My problem is – when I am showing the message using the RADWINDOW my page gets postback and I lost my current page position so I need to again scroll the page.

I also try for RadAjaxPanel – it gives me exception like

Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.

 

And Exception details are

DotNetNuke.Services.Exceptions.PageLoadException: Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error. ---> System.Web.HttpException: Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error. ---> System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). at System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) at Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) --- End of inner exception stack trace --- at Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) at Telerik.Web.UI.RadAjaxControl.PerformRender() at Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) at Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at DotNetNuke.Framework.PageBase.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---

 

Please suggest is any alternative way to do this ……

Thank you once again to all

0
Maria Ilieva
Telerik team
answered on 24 Oct 2012, 10:50 AM
Hello Rohan,

Using RadAjaxPanel should automatically keep the scroll position as you need. As for the error you are facing I would suggest you to review the help topic below which elaborates on its fixing:
http://www.telerik.com/help/aspnet-ajax/ajax-radscriptblock-radcodeblock.html

All the best,
Maria Ilieva
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
Peter
Top achievements
Rank 1
answered on 14 Jan 2013, 07:55 AM
What is the issue here? Our "EditFormSettings" User Control in the Grid won't render the JavaScript?
0
Allen
Top achievements
Rank 1
answered on 19 Sep 2013, 02:54 PM
I'm having the same issue.  For simplication, I put the RadAjaxManager in the aspx page instead of masterpage, I still get the same error: Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.
Here is my script and I even put the scripts in the RadScriptBlock / RadCodeBlock :

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="CDEDistricts.aspx.vb" Inherits="CDEDistricts" title="Custom Drivers by Distrcit" EnableEventValidation="false" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 292px;
        }
        p.MsoNormal
 {margin-bottom:.0001pt;
 font-size:12.0pt;
 font-family:"Times New Roman","serif";
         margin-left: 0in;
            margin-right: 0in;
            margin-top: 0in;
        }
        </style>
       

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" Runat="Server">
    <%--<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>--%>
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
                </Scripts>
            </telerik:RadScriptManager>
        <asp:Panel ID="pnlRegion" runat="server">
           
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="gvCustomDriver">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="gvCustomDriver" UpdatePanelCss
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
    function EnableEditing(a) {
        for (var i = 0; i < document.forms[0].elements.length; i++) {
            var element = document.forms[0].elements[i];
            switch (element.type) {
                case 'text':
                    if (a) {
                        document.forms[0].elements[i].readOnly = false;
                    }
                    else {
                        document.forms[0].elements[i].readOnly = true;
                        document.forms[0].elements[i].style.background = '#eeeeee';
                    }
                    break;
            }
        }
    }
    function hourglass() {
        document.body.style.cursor = "wait";
    }
    function preventBackspace(e) {
        var evt = e || window.event;
        if (evt) {
            var keyCode = evt.charCode || evt.keyCode;
            if (keyCode === 8) {
                if (evt.preventDefault) {
                    evt.preventDefault();
                } else {
                    //Check if the text box is read only and then disable the backspace functionality
                    if (document.getElementById("ctl00_MainContentPlaceHolder_gvCustomDriver_ctl02_lblSunHrs").getAttribute("readonly")) {
                        evt.returnValue = false;
                    }
                }
            }
        }
    }
</script>
</telerik:RadScriptBlock>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Height="75px"
 
        Width="75px" Transparency="0">
 
        <%--<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border: 0;" />
        --%>       
        <img alt="Loading..." src=  "Images/pleasewait.gif" style="border: 0;"/>
 
    </telerik:RadAjaxLoadingPanel>            
    <h2 class="GridHeading">Custom Driver Entry
        Form:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<table>
            <%-- jsy - todo - Do Not show the Regions drop down to these groups. --%>
            <%' If Not Session.Item("IsWFMCATDistrictAdmin") = True Then%>
            <tr>
                <td align="left" colspan="3">
                    <p>
                        <span>Please select the desired division, region and district to enter custom
                        driver information for all locations in that district.&nbsp; You can edit and save
                        the week that is 4 weeks out or more as of Friday 10:00pm.&nbsp; If there are no
                        values for a driver then the previous week&#39;s values are displayed. Please make
                        sure you select the Save and Export button to save the data.</span><p>
                        </p>
                        <p>
                        </p>
                        <h2 class="RowLabel">
                            &nbsp;</h2>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                        <p>
                        </p>
                    </p>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    &nbsp;
                </td>
               
                <td>
                    <asp:CheckBox ID="btnAllWeels" runat="server" Checked="True"
                        Text="copy to all weeks"
                        Font-Italic="True" Font-Size="X-Small" />
                    &nbsp;</td>   
            </tr>
            <tr>
                <td class="RowLabel" style="width:100px;">
                    Division:</td>
                <td width="10px">
                    </td>
                <td align="left" class="style1">
                    <asp:DropDownList ID="ddlDivision" runat="server" AutoPostBack="true"
                        Height="31px" Width="293px">
                        <asp:ListItem Selected="True" Value="71">Macys</asp:ListItem>
                        <asp:ListItem Value="72">Bloomingdales</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:ImageButton ID="btnSave" runat="server" ImageAlign="Middle"
                        ImageUrl="Images/Save_and_Export.jpg" />
                </td>
            </tr>
            <tr>
                <td class="RowLabel" style="width:100px;">
                    Region:</td>
                <td width="10px">
                    &nbsp;</td>
                <td align="left" class="style1">
                    <asp:DropDownList ID="ddlRegions" runat="server" AutoPostBack="true"
                        Height="31px" Width="293px">
                    </asp:DropDownList>
                    <cc1:CascadingDropDown ID="ddlRegions_CascadingDropDown" runat="server"
                        Category="orglev3" Enabled="True" PromptText="Please select a Region"
                        ServiceMethod="GetRegions" ServicePath="MacysOrgLevels.asmx"
                        TargetControlID="ddlRegions" UseContextKey="True">
                    </cc1:CascadingDropDown>
                </td>
               
                <td>
                    <asp:ImageButton ID="btnScreenPrintDist1" runat="server" ImageAlign="Middle"
                        ImageUrl="~/Images/screen_print.jpg" onclientclick="window.print()"
                        Enabled="False" ToolTip="save records before you print" />
                </td>
            </tr>
            <tr>
                <td class="RowLabel" style="width:100px;">
                    District:</td>
                <td width="10px">
                    &nbsp;</td>
                <td align="left" class="style1">
                    <asp:DropDownList ID="ddlDistricts" runat="server" AutoPostBack="true"
                        Height="31px" Width="293px">
                    </asp:DropDownList>
                    <cc1:CascadingDropDown ID="ddlDistricts_CascadingDropDown" runat="server"
                        Category="orglev4" Enabled="True"
                        LoadingText="Please wait while the list is being loaded."
                        ParentControlID="ddlRegions" PromptText="Please select a District"
                        ServiceMethod="GetDistricts" ServicePath="MacysOrgLevels.asmx"
                        TargetControlID="ddlDistricts" UseContextKey="True">
                    </cc1:CascadingDropDown>
                </td>
            </tr>
            <tr ID="trAMC" runat="server" visible="false">
                <td class="RowLabel" style="width:100px;">
                    AMC Week:</td>
                <td width="10px">
                    &nbsp;</td>
                <td class="RowLabel">
                    <asp:DropDownList ID="ddlAMCWeek" runat="server" AutoPostBack="true"
                        EnableViewState="true" Height="31px" Width="50px">
                    </asp:DropDownList>
                    &nbsp;&nbsp;Week Begin Date:&nbsp;&nbsp;<asp:Label ID="lblAMCWeek" runat="server"></asp:Label>
                    <asp:LinkButton ID="lnkExcel" runat="server" CssClass="RowLabel" Text="Export"
                        ToolTip="Export the Custom driver data to Excel" visible="false"></asp:LinkButton>
                    &nbsp;&nbsp;<asp:CheckBox ID="chkHideZeroes" runat="server" visible= "true" AutoPostBack="True" Text="HideZeroes"                  
                        ToolTip="Check or uncheck this box to hide or show the custom driver values which are all zeroes for the whole week." Checked="True" />
                    &nbsp;&nbsp; Page Size: &nbsp;   
                    <asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True"
                        EnableViewState="true" Height="31px" Width="50px">
                        <asp:ListItem>10</asp:ListItem>
                        <asp:ListItem>20</asp:ListItem>
                        <asp:ListItem Selected="True">50</asp:ListItem>
                        <asp:ListItem>100</asp:ListItem>
                        <asp:ListItem>1000</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="3">
                    <asp:Label ID="lblMessage" runat="server" CssClass="RowLabel" ForeColor="Red"
                        Visible="false"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="3">
                    <asp:Label ID="lblMessageWeek" runat="server" CssClass="RowLabel"
                        ForeColor="#cc0000" Visible="false"></asp:Label>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server"
                        DisplayMode="BulletList" EnableClientScript="true"
                        HeaderText="You must enter correct value in the following fields:"
                        ShowMessageBox="true" />
                </td>
            </tr>
        </table>
            </h2>
            <asp:GridView ID="gvCustomDriver" runat="server" AutoGenerateColumns="False"
                DataKeyNames="DEPARTMENT,CUSTOMDRIVER,SUNHRS,MONHRS,TUESHRS,WEDHRS,THURSHRS,FRIHRS,SATHRS,DeptTotal,PrimKey"
                HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle"
                RowStyle-VerticalAlign="Bottom" ShowFooter="True" PageSize="50"
                AllowPaging="True"  AllowSorting = "true" >
                <RowStyle VerticalAlign="Bottom" />
                <Columns>
                <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="center" HeaderText="Store"
                        SortExpression="STORE">
                        <EditItemTemplate>
                            <asp:Label ID="txtStore" runat="server" Text='<%# Bind("STORE") %>'></asp:Label>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtNewStoreNum" runat="server" MaxLength="4"
                                Text='<%# Bind("STORE") %>' visible="false"></asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblStoreNum" runat="server" Text='<%# Bind("STORE") %>'></asp:Label>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="center" HeaderText="Dept."
                        SortExpression="DEPARTMENT">
                        <EditItemTemplate>
                            <asp:Label ID="txtDeptNum" runat="server" Text='<%# Bind("DEPARTMENT") %>'></asp:Label>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtNewDeptNum" runat="server" MaxLength="4"
                                Text='<%# Bind("DEPARTMENT") %>' visible="false"></asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblDeptNum" runat="server" Text='<%# Bind("DEPARTMENT") %>'></asp:Label>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="center" HeaderText="Driver Name"
                        SortExpression="CUSTOMDRIVER">
                        <EditItemTemplate>
                            <asp:Label ID="txtDriverName" runat="server" Text='<%# Bind("CUSTOMDRIVER") %>'></asp:Label>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtNewDriverName" runat="server"
                                Text='<%# Bind("CUSTOMDRIVER") %>' visible="false"></asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblCustomDriver" runat="server"
                                Text='<%# Bind("CUSTOMDRIVER") %>'></asp:Label>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Middle"
                        HeaderText="SUN" SortExpression="SUNHRS">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtSunHrs" runat="server" MaxLength="2"
                                Text='<%# Bind("SUNHRS") %>' Width="19"></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="ddlSunHrs" runat="server" visible="false">
                            </asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="lblSunHrs" runat="server" Columns="3" MaxLength="7"
                                onKeyDown="preventBackspace();" Text='<%# Bind("SUNHRS") %>'></asp:TextBox>
                            <asp:RangeValidator ID="CompareValidator1" runat="server"
                                ControlToValidate="lblSunHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Sunday hours must be between 0 to 9999.99"
                                MaximumValue="9999.99" MinimumValue="0" Type="Double" ValueToCompare="9999.99">*</asp:RangeValidator>
                            <asp:RequiredFieldValidator ID="RangeValidator1" runat="server"
                                ControlToValidate="lblSunHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Sunday hours must be between 0 to 9999.99">*</asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Left" VerticalAlign="Middle" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="center" HeaderText="MON" SortExpression="MONHRS">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtMonHrs" runat="server" MaxLength="2"
                                Text='<%# Bind("MONHRS") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="ddlMonHrs" runat="server" visible="false">
                            </asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="lblMonHrs" runat="server" Columns="3" MaxLength="7"
                                onKeyDown="preventBackspace();" Text='<%# Bind("MONHRS") %>'></asp:TextBox>
                            <asp:RangeValidator ID="CompareValidator2" runat="server"
                                ControlToValidate="lblMonHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Monday hours must be between 0 to 9999.99"
                                MaximumValue="9999.99" MinimumValue="0" Type="Double" ValueToCompare="9999.99">*</asp:RangeValidator>
                            <asp:RequiredFieldValidator ID="RangeValidator22" runat="server"
                                ControlToValidate="lblMonHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Monday hours must be between 0 to 9999.99"
                                ValueToCompare="9999.99">*</asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="center" HeaderText="TUE" SortExpression="TUESHRS">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtTuesHrs" runat="server" MaxLength="2"
                                Text='<%# Bind("TUESHRS") %>' Width="19"></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="ddlTuesHrs" runat="server" visible="false">
                            </asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="lblTuesHrs" runat="server" Columns="3" MaxLength="7"
                                onKeyDown="preventBackspace();" Text='<%# Bind("TUESHRS") %>'></asp:TextBox>
                            <asp:RangeValidator ID="CompareValidator3" runat="server"
                                ControlToValidate="lblTuesHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Tuesday hours must be between 0 and 9999.99"
                                MaximumValue="9999.99" MinimumValue="0" Type="Double" ValueToCompare="9999.99">*</asp:RangeValidator>
                            <asp:RequiredFieldValidator ID="RangeValidator2a" runat="server"
                                ControlToValidate="lblTuesHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Tuesday hours must be between 0 and 9999.99"
                                ValueToCompare="9999.99">*</asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="center" HeaderText="WED" SortExpression="WEDHRS">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtWedHrs" runat="server" MaxLength="2"
                                Text='<%# Bind("WEDHRS") %>' Width="19"></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="ddlWedHrs" runat="server" visible="false">
                            </asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="lblWedHrs" runat="server" Columns="3" MaxLength="7"
                                onKeyDown="preventBackspace();" Text='<%# Bind("WEDHRS") %>'></asp:TextBox>
                            <asp:RangeValidator ID="CompareValidator4" runat="server"
                                ControlToValidate="lblWedHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Wednesday hours must be between 0 and 9999.99"
                                MaximumValue="9999.99" MinimumValue="0" Type="Double" ValueToCompare="9999.99">*</asp:RangeValidator>
                            <asp:RequiredFieldValidator ID="RangeValidator2b" runat="server"
                                ControlToValidate="lblWedHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Wednesday hours must be between 0 and 9999.99">*</asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="center" HeaderText="THU" SortExpression="THURSHRS">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtThursHrs" runat="server" MaxLength="7"
                                Text='<%# Bind("THURSHRS") %>' Width="19"></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="ddlThursHrs" runat="server" visible="false">
                            </asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="lblThursHrs" runat="server" Columns="3" MaxLength="7"
                                onKeyDown="preventBackspace();" Text='<%# Bind("THURSHRS") %>'></asp:TextBox>
                            <asp:RangeValidator ID="CompareValidator5" runat="server"
                                ControlToValidate="lblThursHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Thursday hours must be between 0 and 9999.99"
                                MaximumValue="9999.99" MinimumValue="0" Type="Double" ValueToCompare="9999.99">*</asp:RangeValidator>
                            <asp:RequiredFieldValidator ID="RangeValidator2c" runat="server"
                                ControlToValidate="lblThursHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Thursday hours must be between 0 and 9999.99">*</asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="center" HeaderText="FRI" SortExpression="FRIHRS">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtFriHrs" runat="server" MaxLength="2"
                                Text='<%# Bind("FRIHRS") %>' Width="19"></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="ddlFriHrs" runat="server" visible="false">
                            </asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="lblFriHrs" runat="server" Columns="3" MaxLength="7"
                                onKeyDown="preventBackspace();" Text='<%# Bind("FRIHRS") %>'></asp:TextBox>
                            <asp:RangeValidator ID="CompareValidator6" runat="server"
                                ControlToValidate="lblFriHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Friday hours must be between 0 and 9999.99"
                                MaximumValue="9999.99" MinimumValue="0" Type="Double" ValueToCompare="9999.99">*</asp:RangeValidator>
                            <asp:RequiredFieldValidator ID="RangeValidator2d" runat="server"
                                ControlToValidate="lblFriHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Friday hours must be between 0 and 9999.99">*</asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header"
                        HeaderStyle-HorizontalAlign="center" HeaderText="SAT" SortExpression="SATHRS">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtSatHrs" runat="server" MaxLength="2"
                                Text='<%# Bind("SATHRS") %>' Width="19"></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="ddlSatHrs" runat="server" visible="false"
                                Font-Bold="True" Font-Italic="True" ForeColor="Red">
                            </asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="lblSatHrs" runat="server" Columns="3" MaxLength="7"
                                onKeyDown="preventBackspace();" Text='<%# Bind("SATHRS") %>'></asp:TextBox>
                            <asp:RangeValidator ID="CompareValidator7" runat="server"
                                ControlToValidate="lblSatHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Saturday hours must be between 0 and 9999.99"
                                MaximumValue="9999.99" MinimumValue="0" Type="Double" ValueToCompare="9999.99">*</asp:RangeValidator>
                            <asp:RequiredFieldValidator ID="RangeValidator2e" runat="server"
                                ControlToValidate="lblSatHrs" Display="Dynamic" EnableClientScript="true"
                                ErrorMessage="The Saturday hours must be between 0 and 9999.99">*</asp:RequiredFieldValidator>
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="header" HeaderText="Edit"
                        Visible="false">
                        <EditItemTemplate>
                            <asp:ImageButton ID="btnUpdate" runat="server" AlternateText="Update"
                                CausesValidation="True" CommandName="Update" ImageUrl="Images/accept.png"
                                ToolTip="Update" />
                            <asp:ImageButton ID="btnCancel" runat="server" AlternateText="Cancel"
                                CausesValidation="False" CommandName="Cancel" ImageUrl="Images/cancel.png"
                                ToolTip="Cancel" />
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:LinkButton ID="lnkAdd" runat="server" CommandName="AddNew" Visible="false">Add New</asp:LinkButton>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:ImageButton ID="btnEdit" runat="server" AlternateText="Edit"
                                CausesValidation="False" CommandName="Edit" ImageUrl="Images/pencil.png"
                                ToolTip="Edit" />
                        </ItemTemplate>
                        <HeaderStyle CssClass="header" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Total Hours" SortExpression="DeptTotal">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDeptTotal" runat="server" MaxLength="2"
                                Text='<%# Bind("DeptTotal") %>' Width="19px" Font-Bold="True"
                                Font-Italic="True" ForeColor="#EC0000" Enabled="False"></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="ddlDeptTotal" runat="server" BackColor="White"
                                Font-Bold="True" Font-Italic="True" ForeColor="#D90000" Enabled="False" >
                            </asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="lblDeptTotal" runat="server" Columns="3" ForeColor="Red"
                                MaxLength="7" onKeyDown="preventBackspace();" ReadOnly="True"
                                Text='<%# Bind("DeptTotal") %>' Enabled="False"></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Primary Key" SortExpression="PrimKey" Visible="false">
                        <EditItemTemplate>
                            <asp:TextBox ID="PrimKey" runat="server" MaxLength="2"
                                Text='<%# Bind("PrimKey") %>' Width="19px" Font-Bold="True"
                                Font-Italic="True" ForeColor="#EC0000" Enabled="False"></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="ddlPrimKey" runat="server" BackColor="White"
                                Font-Bold="True" Font-Italic="True" ForeColor="#D90000" Enabled="False" >
                            </asp:TextBox>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="lblPrimKey" runat="server" Columns="3" ForeColor="Red"
                                MaxLength="7" onKeyDown="preventBackspace();" ReadOnly="True"
                                Text='<%# Bind("PrimKey") %>' Enabled="False"></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:GridView>
            <%--add both save and print buttons at the end of the page--%>
            <asp:ImageButton ID="btnSave0" runat="server" ImageAlign="Bottom"
                ImageUrl="Images/Save_and_Export.jpg" Visible="False" />
            <asp:ImageButton ID="btnScreenPrintDist2" runat="server" ImageAlign="Bottom"
                ImageUrl="~/Images/screen_print.jpg" onclientclick="window.print()"
                Visible="False" />
           
    <br />
   
  <asp:Panel ID="pnlButtons" runat="server" Visible="false">
    <table>
       
        <tr id="trButtons" runat="server">
        <td>
        &nbsp;&nbsp;<asp:ImageButton ImageUrl="Images/Back.jpg" ID="btnBack" Text="Back" runat ="server"/>
        </td>
          </tr>
         </table>
       </asp:Panel>



       </asp:Panel>
          <asp:Panel ID="NoAccessPanel" runat="server" Visible="false">
        <table>
            <tr>
                <td align="center"> <h1 style="color:Red"> No Access </h1> </td>
            </tr>
            <tr>
                <td> &nbsp;</td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblNoAccess" runat="server" Font-Size="Large"></asp:Label>
                    &nbsp;</td>
           </tr>
            <tr>
                <td> &nbsp;</td>
            </tr>

           <tr>
                <td align="center">
                    <asp:ImageButton ID="btnReturnToHome" runat="server"
                        ImageUrl="~/Images/Home_Return.jpg"
                        PostBackUrl="~/Introduction.aspx" />
                </td>
            </tr>
        </table>
   
    </asp:Panel>
   
</asp:Content>


0
Berta
Top achievements
Rank 1
answered on 28 Mar 2014, 02:50 AM
Hi Telerik Team

any solution for this problem ??

I have the some problem with a user control

I use Page.LoadControl('my control') but not load the javascript functions.
0
Maria Ilieva
Telerik team
answered on 31 Mar 2014, 12:38 PM
Hi Diego and Allen

As this thread become rather big and different issues are discussed in it, I would suggest you to open separate support tickets and send us detailed description of the exact issues you are facing.
Thus we will be able to handle them with the required attention needed for your specific cases.

Regards,
Maria Ilieva
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Ajax
Asked by
zaphod94
Top achievements
Rank 1
Answers by
rwozniak
Top achievements
Rank 1
Missing User
Michael Tissington
Top achievements
Rank 1
Steve
Telerik team
Ramesh
Top achievements
Rank 1
UT_DEV
Top achievements
Rank 1
Scott
Top achievements
Rank 2
Russell
Top achievements
Rank 1
Yavor
Telerik team
fabio selingrim
Top achievements
Rank 1
SamJ
Top achievements
Rank 1
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Sebastian
Telerik team
Vlad
Telerik team
Rosen
Telerik team
Josh
Top achievements
Rank 1
Zeke Sheppard
Top achievements
Rank 1
Deepak Saboji
Top achievements
Rank 1
Austin
Top achievements
Rank 1
Iana Tsolova
Telerik team
Kyaw
Top achievements
Rank 1
Rohan
Top achievements
Rank 1
Maria Ilieva
Telerik team
Peter
Top achievements
Rank 1
Allen
Top achievements
Rank 1
Berta
Top achievements
Rank 1
Share this question
or