📄 defaultcs.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Telerik.QuickStart;
namespace Telerik.WindowExamplesCS.DemoEmail
{
public class DefaultCS: XhtmlPage
{
protected System.Web.UI.WebControls.DataGrid UserGrid;
private void Page_Load(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
/* Produce a fake datasource for the emails */
DataTable userTable = new DataTable();
string[] from = new string[]{"John Doe", "Jane Doe", "Dimitre Nikolov", "John Smith"};
string[] subjects = new string[]{"Q4", "SiteFinity 2.0", "Re: What Happened", "Q4"};
string[] dateReceived = new string[]{"8/04/2005", "11/05/2005", "11/02/2005", "10/02/2005"};
string[] mailUrls = new string[]{"ExampleFiles/john_doe.html", "ExampleFiles/jane_doe.html",
"ExampleFiles/dim_nikolov.html", "ExampleFiles/john_smith.html"};
string[] columns = new string[]{"MailUrl", "From", "Subject", "DateReceived"};
int i=0;
for (i = 0; i < columns.Length; i++)
{
DataColumn oColumn = new DataColumn(columns[i], typeof(string));
userTable.Columns.Add (oColumn);
}
for (i = 0; i < from.Length; i++)
{
DataRow row = userTable.NewRow();
row["MailUrl"] = mailUrls[i];
row["From"] = from[i];
row["Subject"] = subjects[i];
row["DateReceived"] = dateReceived[i];
userTable.Rows.Add(row);
}
UserGrid.DataSource = userTable;
UserGrid.DataBind();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.UserGrid.ItemDataBound +=new DataGridItemEventHandler(UserGrid_ItemDataBound);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void UserGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.Attributes["onmouseover"] = "this.bgColor = '#ff8100';";
e.Item.Attributes["onmouseout"] = "this.bgColor = '#f4f4ef'";
e.Item.Attributes["onclick"] = "viewMsg('" + ((DataRowView)e.Item.DataItem)["MailUrl"] + "')";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -