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

[Solved] RadAjax for ASP.Net Error "object does not support this property..."

1 Answer 98 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Prasad
Top achievements
Rank 1
Prasad asked on 21 May 2009, 09:38 AM
Hi

I am trying to display the radAlert from User control but I recieve an error "Object Does not support this proprty or method"

I am using the following code below.

Master Page File :  MasterPage.master
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="UploadTest_MasterPage" %> 
 
<!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>Master Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="scriptManager" runat="server"></asp:ScriptManager> 
 
    <div> 
        <asp:contentplaceholder id="PageContentPlaceHolder" runat="server">  
        </asp:contentplaceholder> 
    </div> 
    </form> 
</body> 
</html> 

RadAlert.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadAlert.aspx.cs"   
Inherits="UploadTest_RadAlert" MasterPageFile="~/UploadTest/MasterPage.master" EnableTheming="true" Theme="Default" %> 
 
<%@ Register Src="~/UploadTest/ParentUserControl.ascx" TagName="ParentUserControl" TagPrefix="uc" %> 
 
<asp:Content ID="content" ContentPlaceHolderID="PageContentPlaceHolder" Runat="Server">  
 
<div id="page_maincol">  
 
<table class="emex_outer_container">  
<tr>          
<td> 
              
            <div class="page_box" id="content_page">  
 
                <div class="page_box_title">  
                    <h1> 
                    <span>Rad Alert Test</span> 
                    </h1>         
                </div> 
 
                <div>                                 
                <uc:ParentUserControl ID="ParentUserControl1" runat="server" /> 
                </div> 
            </div> 
</td> 
</tr> 
</table> 
                  
</div> 
          
</asp:Content> 

The source code for the UserControl on the page
UserControl : ParentUserControl.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ParentUserControl.ascx.cs" Inherits="UploadTest_ParentUserControl" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
 
 
<%@ Register Src="~/UploadTest/ChildUserControl.ascx" TagName="ChildUserControl" TagPrefix="uc" %> 
 
 
<uc:ChildUserControl runat="server" ID="ChildUserControl1" /> 
 
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="25" meta:resourcekey="RadAjaxLoadingPanel1Resource1">  
    <asp:Image ID="Image1" runat="server" AlternateText="Loading..." ImageUrl="~/RadControls/Ajax/Skins/Default/Loading.gif" /> 
</telerik:RadAjaxLoadingPanel> 
 
<telerik:RadAjaxManager EnableAJAX="true" ID="RadAjaxManager1" runat="server" > 
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="ChildUserControl1">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="ChildUserControl1"   
                        LoadingPanelID="RadAjaxLoadingPanel1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
    <ClientEvents /> 
</telerik:RadAjaxManager> 
 
<telerik:RadWindowManager ID="windowManager" runat="server" Skin="Vista"   
Behaviors="Close, Move" Height = "700px" Width="900px"  > 
<Windows> 
    <telerik:RadWindow ID="RadWindow1"        
     Skin="Vista" 
     VisibleOnPageLoad = "false" 
     Height="517px" Width="650px" VisibleStatusBar="false"       
     Title="Emex"   
     runat="server"></telerik:RadWindow> 
</Windows> 
<ConfirmTemplate>    
    <div class="windowpopup radconfirm">    
        <div class="dialogtext">    
        {1}    
        </div>    
        <div>    
        <onclick="$find('{0}').callBack('true');" class="radwindowbutton" href="javascript:void(0);">    
        <span class="outerspan"><span class="innerspan">Yes</span></span></a>     
                            
        <onclick="$find('{0}').callBack('false');"    
        class="radwindowbutton" href="javascript:void(0);"><span class="outerspan"><span    
        class="innerspan">No</span></span></a>    
                                
    </div>    
</div>    
</ConfirmTemplate> 
</telerik:RadWindowManager> 

The User Control also has another user control from which tries to print the RadAlert on which I get the error message.

File : ChildUserControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ChildUserControl.ascx.cs" Inherits="UploadTest_ChildUserControl" %> 

The code behind for this control

File : ChildUserControl.ascx.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;  
 
using Telerik.Web.UI;  
 
public partial class UploadTest_ChildUserControl : System.Web.UI.UserControl  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        Message = "Sample RadAlert Message";  
    }  
 
    public string Message  
    {  
        set  
        {  
            RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(this.Page);  
            ajaxManager.ResponseScripts.Add(string.Format("radalert('{0}', 330, 120)", value));  
        }  
    }  

The teleriks dlls in my bin folder are 

Telerik.Web.UI - 2008.2.826.35
Telerik.Web.Design - 2007.3.1314.20
Telerik.Charting - 2.0.2.0

Please Advice!

Thanks
Prasad




1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 25 May 2009, 01:41 PM
Hello Prasad,

The ResponseScripts property of RadAjax is to be used for executing custom javascript after ajax request. However, you are trying to call it on initial page load and therefore you end up with an error. In case you want to show the alert on initial load, I suggest that you try the below code:

public string Message  
{  
    set 
    {              
        string script = string.Format("function pageLoad() {{ window.radalert('{0}', 330, 120); }}", value);  
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "script", script, true);  
    }  
}    

Additionally, you can try the attached sample and see how you could use ResponseScripts property on button click.

I hope this helps.

Sincerely yours,
Iana
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.
Tags
Ajax
Asked by
Prasad
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or