Hi
I'm sorry. My English is bad.
Problem:
I have got WebUserControl with Button (OnClick= javascript with alert("aaa"))
I have got Page with:
1. telerik:RadAjaxManager
2. Button (OnClick = "WebUserControl.Visible = !WebUserControl.Visible")
3. WebUserControl
A. If initial WebUserControl.Visible=false, then after Page.Button.Click
WebUserControl.Button appear and if WebUserControl.Button.Click appear error.
B. If initial WebUserControl.Visible=true, then OK.
C. If RadAjaxManager.EnableAJAX=false, then OK.
What would you propose then? (A.)
Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Tst_Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="WebUserControl.ascx" TagName="WebUserControl" TagPrefix="Controls" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"/>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="WUC" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<Controls:WebUserControl ID="WUC" runat="server" Visible="false" />
</form>
</body>
</html>
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;
public partial class Tst_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
WUC.Visible = !WUC.Visible;
}
}
Control:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="Tst_WebUserControl" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<script type="text/javascript" language="javascript" >
function bt_Click(){alert("aaa");}
</script>
<input id="Button1" type="button" value="button" OnClick="bt_Click()"/>