Long subject, I know, but here's what's happening:
I have a RadAjaxPanel. Inside the RadAjaxPanel is an asp:Panel set to not visible and a button (button1). Inside the asp:Panel is a button (button2) that calls a function called AlertIt() within a RadCodeBlock. When button1 is clicked, it runs server code that makes the asp:Panel visible which, in turn, shows button2. When you click button2, however, a Javascript error is thrown saying AlertIt() could not be found on the page. button2 is showing like it should, so It's almost like it's stripping the Javascript out of the page.
When I remove the RadAjaxPanel so that the page does regular postbacks, it works just fine. I've also tried a RadAjaxManager, but that yields the same results.
This is very urgent, so I hope someone can reply to this. Here is all my code:
Master
Content Page
I have a RadAjaxPanel. Inside the RadAjaxPanel is an asp:Panel set to not visible and a button (button1). Inside the asp:Panel is a button (button2) that calls a function called AlertIt() within a RadCodeBlock. When button1 is clicked, it runs server code that makes the asp:Panel visible which, in turn, shows button2. When you click button2, however, a Javascript error is thrown saying AlertIt() could not be found on the page. button2 is showing like it should, so It's almost like it's stripping the Javascript out of the page.
When I remove the RadAjaxPanel so that the page does regular postbacks, it works just fine. I've also tried a RadAjaxManager, but that yields the same results.
This is very urgent, so I hope someone can reply to this. Here is all my code:
Master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="TelerikIssues.Site1" %><!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></title> <asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:ValidationSummary runat="server" ID="ValidationSummary1" EnableClientScript="true" HeaderText="The following errors were encountered: " /> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </form></body></html>Content Page
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="disappearingjavascript.aspx.cs" Inherits="TelerikIssues.disappearingjavascript" %><%@ Register Src="~/controls/javascriptinclude.ascx" TagPrefix="uc" TagName="test" %><asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"> <asp:Panel ID="pnlTest" Visible="false" runat="server"> <asp:Button ID="Button1" Text="Alert It" OnClientClick="javascript:AlertIt();" runat="server" /> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script language="javascript" type="text/javascript"> function AlertIt() { alert("Success"); } </script> </telerik:RadCodeBlock> </asp:Panel> <asp:Button ID="cmShow" Text="Show" OnClick="Show" runat="server" /> </telerik:RadAjaxPanel></asp:Content>