English 中文(简体)
RadWindow使用RadButton
原标题:Closing RadWindow using RadButton

I m试图利用RadButton从窗户本身(通过javascript)关闭rad窗。 能否打上封窗子? The javascript:

function getRadWindow() 
{
  var oWindow = null;
  if (window.radWindow) oWindow = window.radWindow;
  else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
  return oWindow;
}

function closeWindow() 
{
  getRadWindow().close();
}

这里是:

<telerik:RadButton ID="CancelButton" runat="server" OnClick="closeWindow();" CssClass="clicker" Text="Cancel" UseSubmitBehavior="False" EnableEmbeddedScripts="false" CausesValidation="False" RegisterWithScriptManager="False">
</telerik:RadButton>

我已经尝试了一切,只有我使用一个纯粹的超文本部分,如 anchor子,文字才会奏效。 如果我使用OnClick活动,我在窗口开放时会发现以下错误:Compiler Error 信:CS1026:>。

我失踪了吗?

感谢!

最佳回答

要求RadButton履行一项职能的方式是,要么使用其OnClientClicked或OnClientClicking活动。 然后,你只需要通过 Java号功能的名称,而没有父母。 在Click,是服务器手持的一种财产,在普通 as子也是如此。 为此:

<telerik:RadButton ID="CancelButton" runat="server" OnClientClicked="closeWindow" AutoPostBack="false" CssClass="clicker" Text="Cancel" UseSubmitBehavior="False" EnableEmbeddedScripts="false" CausesValidation="False" RegisterWithScriptManager="False">

Note the AutoPostBack property is set to false to prevent the postback.

问题回答

我不敢肯定,如果我改进这一答案,我只是想让大家更容易理解。 我有一个从主页开始的圆窗。 The radwindow is open in Code Behind (C#), not Javascript. 当我的用户在RadWindow上点击“拯救儿童网”时,它执行了一些逻辑任务,然后关闭了rad窗。 仅需要:

在RadWindow aspx....。

<telerik:RadCodeBlock runat="server" ID="rcb1">
<script language="javascript" type="text/javascript">

function GetRadWindow() 
{
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow;
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
return oWindow;
}
function CloseDialog(button) 
{
GetRadWindow().close();
}  

</script>
</telerik:RadCodeBlock>

在你履行预约逻辑(履行其他逻辑的同一纽扣地关闭了窗户)之后,将这部守则点击。

C# ClientScript.RegisterStartupScript(typeof(string), "", "CloseDialog();");

OR

VB ClientScript.RegisterStartupScript(Me.GetType(), "", "CloseDialog();")

如果你想到如何从这里的密码中打开rad窗,那么我是如何做到的:

RadWindow window1 = new RadWindow();
// Set the window properties   
window1.NavigateUrl = "winStrengthChart.aspx?EMPLOYIDNAME=" + parmString;
window1.ID = "RadWindow1";
window1.Width = 800;
window1.Height = 650;
window1.VisibleStatusbar = false;
window1.Behaviors = Telerik.Web.UI.WindowBehaviors.Close | Telerik.Web.UI.WindowBehaviors.Resize | Telerik.Web.UI.WindowBehaviors.Move;
window1.VisibleOnPageLoad = true; // Set this property to True for showing window from code   
rwm1.Windows.Add(window1);
this.Form1.Controls.Add(window1);   

......当然,你们需要在打开窗户的主要网页上有一个基本的RadWindowManager:

<telerik:RadWindowManager ID="rwm1" runat="server">
<Windows>
</Windows>
</telerik:RadWindowManager>

如果我犯了一个错误,请更正我的话,那就行了。

增 编





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!