Hi,
what error do you get? And, is it working with Internet Explorer?
Regards,
Michael
On 7/18/06, Pontus <[EMAIL PROTECTED]> wrote:
>
> please see the following code:
>
> <%@ Page language="c#" Codebehind="WebForm3.aspx.cs"
> AutoEventWireup="false" Inherits="Test4.WebForm3" %>
> <html>
> <body>
> <form id="f2" runat="server">
> <input type="text" id="txt"/>
> <div>Length of the string: <span id="txt_display">0</span></div>
> </form>
>
>
> <script type="text/javascript">
>
> var textLen = function(ele) {
> this.ele = ele;
> this.display = document.getElementById(this.ele.id + "_display");
> addEvent(this.ele, "keyup", this.dosearch.bind(this));
> }
>
> textLen.prototype = {
> dosearch: function() {
> Test4.WebForm3.GetLength(this.ele.value, this.ondata.bind(this));
> },
> ondata: function(res) {
>
> this.display.innerHTML = res.value;
> }
> };
>
> function init() {
> var x = new textLen(document.getElementById("txt"));
> x.ele.focus();
> }
>
> addEvent(window, "load", init);
>
>
>
> </script>
> </body>
> </html>
>
> //===C#
> 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;
>
> namespace Test4
> {
> /// <summary>
> /// WebForm3
> /// </summary>
> public class WebForm3 : System.Web.UI.Page
> {
> private void Page_Load(object sender, System.EventArgs e)
> {
>
> AjaxPro.Utility.RegisterTypeForAjax(typeof(WebForm3));
> }
>
>
> [AjaxPro.AjaxMethod]
> public int GetLength(string s)
> {
> return s.Length;
> }
>
>
> #region
> override protected void OnInit(EventArgs e)
> {
> //
> // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
> //
> InitializeComponent();
> base.OnInit(e);
> }
>
> /// <summary>
> /// 设计器支持所需的方法 -
> 不要使用代码编辑器修改
> /// 此方法的内容。
> /// </summary>
> private void InitializeComponent()
> {
> this.Load += new System.EventHandler(this.Page_Load);
>
> }
> #endregion
>
> }
> }
>
>
> >
>
--
Best regards | Schöne Grüße
Michael
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer
http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---