在上篇博文中讨论了怎么在Dynamics CRM中使用自定义页面,现在我们来看看怎么在自定义页面中使用Asp.net Ajax框架。Asp.net Ajax是个优秀的Ajax框架,用它来开发Ajax应用程序能达到事半功倍的效果。接下来我们就来看看在自定义页面中怎么使用它吧:
操作步骤
图1
图2
图3
图4
图5
图6
程序代码
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick">
</asp:Timer>
<br />
<asp:TextBox ID="TextBox1" runat="server" Width="500" Height="250"></asp:TextBox>
<asp:HtmlEditorExtender ID="TextBox1_HtmlEditorExtender" runat="server"
Enabled="True" TargetControlID="TextBox1">
</asp:HtmlEditorExtender>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<br />
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
}