Not sure if this is a typo but the attribute for your getservertime method should look like this [AjaxPro.AjaxMethod()]
 
Also, check to make sure that the button1's AutoPostback property is set to false.  I believe it is true be default
 
Joseph Guadagno
http://josephguadagno.net

 
On 6/19/06, JMan <[EMAIL PROTECTED]> wrote:

Hi,
I'm trying to get the example of the Quick Start Guide running. Im
using VS2003 (.Net1.1).
This is what my code looks like:

using System;
using System.Collections;
using System.Text;
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 AjaxPro;

namespace AjaxProTest
{
       public class WebForm1 : System.Web.UI.Page
       {
               protected System.Web.UI.WebControls.Button Button1;


               private void Page_Load(object sender, System.EventArgs e)
               {
                       AjaxPro.Utility.RegisterTypeForAjax(typeof(WebForm1));
                       StringBuilder ajaxmethods = new StringBuilder();
                       ajaxmethods.Append("<script>                                                                                                            ");
                       ajaxmethods.Append("function getServerTime_callback(res)                                                        ");
                       ajaxmethods.Append("{                                                                                                                           ");
                       ajaxmethods.Append("    alert(res.value);                                                                                       ");
                       ajaxmethods.Append("}                                                                                                                           ");
                       ajaxmethods.Append("</script>                                                                                                           ");


                       Page.RegisterClientScriptBlock ("ajaxmethoden",ajaxmethods.ToString());
                       Button1.Attributes.Add("OnClick","_javascript_:AjaxProTest.WebForm1.getServerTime(getServerTime_callback);");




               }

               [AjaxPro.AjaxMethod]
               public String getServerTime()
               {
                       return DateTime.Now.ToString();
               }


               override protected void OnInit(EventArgs e)
               {

                       InitializeComponent();
                       base.OnInit(e);
               }


               private void InitializeComponent()
               {
                       this.Load += new System.EventHandler(this.Page_Load);

               }

       }
}

When i click the Button on the resulting page, it just does a regular
postback, but no alert pops up :-(

I added these lines to my webconfig:

<httpHandlers>
   <add verb="POST,GET" path="ajaxpro/*.ashx"
type="AjaxPro.AjaxHandlerFactory,AjaxPro"/>
   </httpHandlers>

So, where is the problem with my code? Neither IExplorer nor Firefox
state any _javascript_ errors.

regards, J.E.



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to