📄 defaultcs.aspx
字号:
<%@ Page Language="c#" AutoEventWireup="false" Codebehind="DefaultCS.aspx.cs" Inherits="Telerik.GridExamplesCSharp.Client.ClientSideAPI.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="radG" Namespace="Telerik.WebControls" Assembly="RadGrid" %>
<!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 -->
<link href="../../Styles/ColorSchemes/Desert/Styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
var RadGrid1;
function GetGridObject()
{
RadGrid1 = this;
}
function SwapColumns(index1, index2)
{
RadGrid1.MasterTableView.SwapColumns(index1, index2);
}
function ResizeColumn(index, width)
{
RadGrid1.MasterTableView.ResizeColumn(index, width);
}
function MoveColumnToLeft(index)
{
RadGrid1.MasterTableView.MoveColumnToLeft(index);
}
function MoveColumnToRight(index)
{
RadGrid1.MasterTableView.MoveColumnToRight(index);
}
function HideColumn(index)
{
RadGrid1.MasterTableView.HideColumn(index);
}
function ShowColumn(index)
{
RadGrid1.MasterTableView.ShowColumn(index);
}
function HideRow(index)
{
RadGrid1.MasterTableView.HideRow(index);
}
function ShowRow(index)
{
RadGrid1.MasterTableView.ShowRow(index);
}
function ExportToExcel(fileName)
{
RadGrid1.MasterTableView.ExportToExcel(fileName);
}
function ExportToWord(fileName)
{
RadGrid1.MasterTableView.ExportToWord(fileName);
}
-->
</script>
<!-- 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="CS"></telerik:Header>
<!-- content start -->
<span class="text"><b>Working with r.a.d.<b>grid</b> client-side API</b></span>
<table border="0" width="100%">
<tbody>
<tr>
<td align="left" valign="top">
<fieldset class="module" style="BACKGROUND-POSITION: 0px 18px; HEIGHT: 185px">
<legend>Columns swapping</legend>
<table border="0">
<tbody>
<tr>
<td>
<asp:Label ID="Label1" Font-Bold="True" Runat="Server">First column index:</asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" MaxLength="1" CssClass="textfield" Text="0" Runat="server" Width="12px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" Font-Bold="True" Runat="Server">Second column index:</asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" MaxLength="1" CssClass="textfield" Text="1" Runat="server" Width="12px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<hr/>
<asp:CheckBox ID="CheckBox1" Font-Bold="True" AutoPostBack="True" Text="Reorder columns on client"
Runat="server"></asp:CheckBox>
<hr/>
<input type="button" class="button" style="WIDTH:120px" value="Swap columns" onclick='SwapColumns(document.getElementById("<%= TextBox1.ClientID %>").value, document.getElementById("<%= TextBox2.ClientID %>").value)'/>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
<td align="left" valign="top">
<fieldset class="module" style="BACKGROUND-POSITION: 0px 18px; HEIGHT: 185px">
<legend>Columns resizing</legend>
<table border="0">
<tbody>
<tr>
<td>
<asp:Label ID="Label3" Font-Bold="True" Runat="Server">Column index:</asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox3" MaxLength="1" CssClass="textfield" Text="0" Runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" Font-Bold="True" Runat="Server">Column width:</asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox4" MaxLength="4" CssClass="textfield" Text="300" Runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<hr/>
<asp:CheckBox ID="CheckBox2" Font-Bold="True" AutoPostBack="True" Text="Resize grid on column resize"
Runat="server"></asp:CheckBox>
<br/>
<asp:CheckBox ID="CheckBox3" Font-Bold="True" AutoPostBack="True" Text="Clip cell content on column resize"
Runat="server"></asp:CheckBox>
<hr/>
<input type="button" class="button" style="WIDTH:120px" value="Resize column" onclick='ResizeColumn(document.getElementById("<%= TextBox3.ClientID %>").value, document.getElementById("<%= TextBox4.ClientID %>").value)'/>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
<td align="left" valign="top">
<fieldset class="module" style="BACKGROUND-POSITION: 0px 18px; HEIGHT: 185px">
<legend>Columns moving</legend>
<table border="0">
<tbody>
<tr>
<td>
<asp:Label ID="Label5" Font-Bold="True" Runat="Server">Column index:</asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox5" MaxLength="1" CssClass="textfield" Text="0" Runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<hr/>
<input type="button" class="button" style="WIDTH:150px" value="Move column to left" onclick='MoveColumnToLeft(document.getElementById("<%= TextBox5.ClientID %>").value)'/>
<br/>
<input type="button" class="button" style="WIDTH:150px" value="Move column to right" onclick='MoveColumnToRight(document.getElementById("<%= TextBox5.ClientID %>").value)'/>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
</tr>
<tr>
<td align="left" valign="top">
<fieldset class="module" style="BACKGROUND-POSITION: 0px 18px; HEIGHT: 185px">
<legend>Columns Hide/Show</legend>
<table border="0">
<tbody>
<tr>
<td>
<asp:Label ID="Label6" Font-Bold="True" Runat="Server">Column index:</asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox6" MaxLength="1" CssClass="textfield" Text="0" Runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<hr/>
<input type="button" class="button" style="WIDTH:150px" value="Hide column" onclick='HideColumn(document.getElementById("<%= TextBox6.ClientID %>").value)'/>
<br/>
<input type="button" class="button" style="WIDTH:150px" value="Show column" onclick='ShowColumn(document.getElementById("<%= TextBox6.ClientID %>").value)'/>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
<td align="left" valign="top">
<fieldset class="module" style="BACKGROUND-POSITION: 0px 18px; HEIGHT: 185px">
<legend>Rows Hide/Show</legend>
<table border="0">
<tbody>
<tr>
<td>
<asp:Label ID="Label8" Font-Bold="True" Runat="Server">Row index:</asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox8" MaxLength="1" CssClass="textfield" Text="0" Runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<hr/>
<input type="button" class="button" style="WIDTH:150px" value="Hide row" onclick='HideRow(document.getElementById("<%= TextBox8.ClientID %>").value)'/>
<br/>
<input type="button" class="button" style="WIDTH:150px" value="Show row" onclick='ShowRow(document.getElementById("<%= TextBox8.ClientID %>").value)'/>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
<td align="left" valign="top">
<fieldset class="module" style="BACKGROUND-POSITION: 0px 18px; HEIGHT: 185px">
<legend>Exporting</legend>
<table border="0" cellpadding="0" cellspacing="15">
<tbody>
<tr>
<td>
<asp:Label ID="Label7" Font-Bold="True" Runat="Server">File name:</asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox7" CssClass="textfield" Text="RadGridExport" Runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" class="button" style="WIDTH:150px" value="Export to MS Excel" onclick='ExportToExcel(document.getElementById("<%= TextBox7.ClientID %>").value)'/>
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" class="button" style="WIDTH:150px" value="Export to MS Word" onclick='ExportToWord(document.getElementById("<%= TextBox7.ClientID %>").value)'/>
</td>
</tr>
</tbody>
</table>
</fieldset>
</td>
</tr>
</tbody>
</table>
<br/>
<radG:RadGrid id="RadGrid1" CssClass="RadGrid" runat="server" AllowPaging="True" AllowSorting="True" GridLines="None"
PageSize="10" Width="95%">
<PagerStyle Mode="NumericPages" CssClass="GridPager" Height="18px"></PagerStyle>
<AlternatingItemStyle CssClass="GridRow" Height="23px"></AlternatingItemStyle>
<ItemStyle CssClass="GridRow" Height="23px"></ItemStyle>
<HeaderStyle CssClass="GridHeader" Height="30px"></HeaderStyle>
<FooterStyle CssClass="GridFooter"></FooterStyle>
<SelectedItemStyle BackColor="#FFF8DC"></SelectedItemStyle>
<mastertableview Width="100%"/>
<ClientSettings AllowColumnHide="True" AllowRowHide="True" AllowColumnsReorder="True" ReorderColumnsOnClient="True">
<Resizing EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowColumnResize="True"></Resizing>
<ClientEvents OnGridCreated="GetGridObject"></ClientEvents>
</ClientSettings>
</radG:RadGrid>
<br/>
<asp:Button Text="PostBack" Runat="server" id="Button1" CssClass="button"></asp:Button>
<!-- content end -->
<telerik:Footer runat="server" ID="Footer1"></telerik:Footer>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -