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

radajax usercontrol client script master page

2 Answers 111 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jill
Top achievements
Rank 1
Jill asked on 24 Jul 2008, 04:05 PM
I have a user control that calls a javascript function that is called from my master page.  When I run the user control on a page that does not use radajax, the client javascript function of the user control gets executed just fine.  However, when I run the user control on a page that ajaxifies it, I get a javascript error saying "Object Expected".

Here is the snippet of code from my usercontrol.ascx file:

<

script type="text/javascript">

loadCalendar();

</

script>

<

asp:textbox id="txt_Date" Columns="6" Width=66 runat="server" CssClass="Textbox"></asp:textbox>

<asp:hyperlink id="imgCalendar" runat="server" ImageUrl="../images/smallcalendar.gif" NavigateUrl="javascript:;"></asp:hyperlink>

Here is a snippet of code from my usercontrol .ascx.vb file:

Private

Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim scriptStr As String = _

"javascript:return popUpCalendar(this," & getClientID() & ", 'mm/dd/yyyy', '__doPostBack(\'" & getClientID() & "\')')"

imgCalendar.Attributes.Add(

"onclick", scriptStr)

End Sub

The master page includes the following line of code that holds the popUpCalendar function refered to in the usercontrol .ascx.vb codebehind file:

<script type="text/javascript" language="javascript" src="cal/popcalendar.js"></script>

My aspx page that uses the usercontrol does so as follows:

<

asp:Panel ID="pnlOwnerBeginDate" runat="server"><uc1:DateSelector ID="dsOwnerBeginDate" runat="server" /></asp:Panel>

Then I have a RadAjaxManager on the same .aspx page that updates the pnlOwnerBeginDate as follows:

<

radA:AjaxSetting AjaxControlID="btnSearch">

<UpdatedControls>

<radA:AjaxUpdatedControl ControlID="pnlSupplierInfo_Outer" LoadingPanelID="AjaxLoadingPanelLoad" />

<radA:AjaxUpdatedControl ControlID="pnlTop_Outer" />

<radA:AjaxUpdatedControl ControlID="pnlLabels" />

<radA:AjaxUpdatedControl ControlID="lblNew" />

<radA:AjaxUpdatedControl ControlID="lblInstructions" />

<radA:AjaxUpdatedControl ControlID="pnlOwnerBeginDate" />

</UpdatedControls>

</radA:AjaxSetting>

When btnSearch is clicked on my .aspx page, the popUpCalendar javascript function is not found.  Can you help me figure out what I am missing or doing wrong?

Thanks
Jill

2 Answers, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 28 Jul 2008, 11:40 AM
Hi Jill,

Can you try setting EnableOutsideScripts="true" for the RadAjaxManager? If that does not help, it will be best if you open a support ticket and attach a stripped down version of your project to it. Thus we will be able to debug it locally and get back to you with our findings.

Best wishes,
Pavel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jill
Top achievements
Rank 1
answered on 04 Aug 2008, 04:59 PM
Setting EnableOutsideScripts to true did NOT solve the problem.  I ended up having to change around which files the client scripts were located to fix the problem.  Thanks for the suggestion, though.
Tags
Ajax
Asked by
Jill
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Jill
Top achievements
Rank 1
Share this question
or