📄 defaultcs.aspx
字号:
<%@ Page AutoEventWireup="false" Language="c#" CodeBehind="DefaultCS.aspx.cs" Inherits="Telerik.WindowExamplesCS.DialogReturnValue.DefaultCS" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" Assembly="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %>
<%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
<%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %>
<%@ Register tagprefix="radW" namespace = "Telerik.WebControls" assembly="RadWindow" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<telerik:HeadTag runat="server" ID="Headtag1"></telerik:HeadTag>
<!-- custom head section -->
<!-- end of custom head section -->
</head>
<body class="BODY">
<form runat="server" id="mainForm" method="post" style="WIDTH:100%">
<telerik:Header runat="server" ID="Header1" NavigationLanguage="C#"></telerik:Header>
<div class="module" style="width:80%;">
<b>Returning Values From a Dialog</b>
<br/><hr/><br/>
<script type="text/javascript">
//Show the window
function ShowDialog()
{
//Force reload in order to guarantee that the onload event handler of the dialog which configures it executes on every show.
var oWnd = window.radopen(null, "DialogWindow");
oWnd.SetUrl(oWnd.GetUrl());
}
//Called when a window is being shown. Good for setting an argument to the window
function OnClientShow(radWindow)
{
//Get current content of textarea
var oText = document.getElementById("InfoArea").value;
//Create a new Object to be used as an argument to the radWindow
var arg = new Object();
//Using an Object as a argument is convenient as it allows setting many properties.
arg.TextValue = oText;
arg.Color = "red";
arg.BackColor = "yellow";
//Set the argument object to the radWindow
radWindow.Argument = arg;
}
function CallBackFunction(radWindow, returnValue)
{
var oArea = document.getElementById("InfoArea");
if (returnValue) oArea.value = returnValue;
else alert ("No text was returned");
}
// Called when a window is being closed.
function OnClientClose(radWindow)
{
//Another option for passing a callback value
//Set the radWindow.Argument property in the dialog
//And read it here --> var oValue = radWindow.Argument;
//Do cleanup if necessary
}
</script>
Text to be modified from the dialog:
<br>
<textarea id="InfoArea" rows="5" cols="20">Text here will be sent to the dialog....</textarea>
<br>
<button onclick="ShowDialog();return false;" class="Button" style="width:250px;">Show dialog (force dialog refresh)</button>
(Open by client script)
<br /><br />
<asp:Button Runat="server" ID="ServerButton" Text="Show dialog (do not force dialog reload)" cssclass="button" style="width:250px;"></asp:Button>
(Server-side binding)
<radW:RadWindowManager
id="Singleton"
runat="server"
ClientCallBackFunction="CallBackFunction"
OnClientShow = "OnClientShow"
OnClientClose = "OnClientClose"
>
<windows>
<radW:RadWindow id="DialogWindow"
OpenerElementId = "<%# ServerButton.ClientID %>"
OffsetElementId = "InfoArea"
Left="250px"
Modal = "true"
Runat="server"
Width="270px"
Height="200px"
Title="User List Dialog"
NavigateUrl="./Dialog.aspx">
</radW:RadWindow>
</windows>
</radW:RadWindowManager>
</div>
<telerik:Footer runat="server" ID="Footer1"></telerik:Footer>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -