AJAX .NET Wrapper DLL Video
Because I do not have time to write a documentation I added a small video that will show you how to use the AJAX .NET Wrapper DLL. First I will show the old way using postbacks to the Server. Two textboxes (username and password) will be verified on the server. If the username is not michael and the password is wrong I will show a error message. Please note that every click on the Login button will start a postback (server round trip).
I change the code and add some Javascript lines. Now, the browser will not refresh the page after clicking on Login. You have seen how easy it is to add the AJAX .NET Wrapper to existing code!!
The second sample in this video will show you how cool it is to return your own class. You will be able to use nearly the same syntax as you use it with C#. I am using the JSON (Javascript Object Notation) that will work in Firefox, Mozilla and Internet Explorer.
Download the video as a zip: http://ajax.schwarz-interactive.de/download/ajaxvideo.zip
View the video online: http://ajax.schwarz-interactive.de/download/ajax.wmv
13 Comments
Comments have been disabled for this content.
PeterNZ said
Sorry Mate but I can't unzip the file. I'll get a
"Error in file #1: bad Zip file offset (Error local header signature not found): disk #1 offset: 0"
I wonder if others have teh same problem and ther's someting wrong with the zip file.
Cheers
Peter
Michael Schwarz said
Sorry, there was an error while uploading the ZIP file. I have started the upload of the new ZIP file. In 10 minutes the new file should be on the server...
Michael Schwarz said
If you change the page after invoking the method on the server will have no effect for the execution. The method will finish and trying to return the result. But there will be no client request running and the result will be trashed...
Ashish Jaiman said
if you have "." in the namespace an error is thrown
do
<script language="javascript" src="vbwrapper/common.ashx"></script>
<script language="javascript" src="vbwrapper/X.Y.test,X.Y.ashx"></script>
throws an exception
great work btw
Christoph said
hi
I got an exception when I call
csharpwrapper/WebForm1,CSharpSample.ashx in Browser. I use the examples in csharp.
by Christoph
[ArgumentNullException: Wert darf nicht Null sein.
Parametername: type]
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +301
Ajax.JavascriptHandler.ProcessRequest(HttpContext context) +266
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
Michael Schwarz said
@Ashish Jaiman: Can you please send me the sample VB.NET class file? Or the VB.NET project files? Are you missing the web.config httpHandler setting?
@Christoph: Can you send me the project you are using? Are you using the sample solution?? Are you using a IIS root application or a virtual folder?
Christoph said
I use the csharp-default as is in an existing project(copy and added the httpHandler-lines in web.config. I use it in an virtual folder /localhost/smspower/default.aspx
Ashish Jaiman said
where do i send the erroring out project
but to recreate it is very simple ( or may be i don't know what to change in the javascript registration on the page) but if you change the name of the assembly to VBNETSample.UI ( fromt he project properties) it blows up - i guess i am using the invalid script registration
<script language="javascript" src="vbwrapper/common.ashx"></script>
<script language="javascript" src="vbwrapper/VBNETSample.UI.WebForm1,VBNETSample.ashx"></script>
thanks a lot
Michael Schwarz said
@Ashish: the current release will not need to add those script TAG lines. You can use Ajax.Utility.RegisterTypeForAjax(typeof(WebApplication1.WebForm1)); This method will write both of those lines!!
I will upload a documention for the Ajax.NET Wrapper DLL this night.
Ashish Jaiman said
even registering for javascript wont' work - it throws an exception if there is a . in the assembly name - like VBNETSample.UI
Ajax.Utility.RegisterCommonAjax()
Ajax.Utility.RegisterTypeForAjax(Me.GetType)
Michael Schwarz said
Hello Ashish, it is working with a dot in the assembly name. I think you have to register something like WebApplication1.WebForm1 instead of Me.GetType. ASPX files will be compiled to another class that will be there only temporary. Can you send me a sample where it is not working?
liming said
I have having the same problem as Ashish, I'm running my application under the virtual directory "testmanager"
this is what's generated using RegisterTypeForAjax
<script language="javascript" src="/testmanager/ajaxwrapper/common.ashx"></script>
<script language="javascript" src="/testmanager/ajaxwrapper/testmanager.Objects.UIL.Login.Login,testmanager.ashx"></script>
I have a code behind method under the class "Login.cs" in the namespace
"testmanager.Objects.UIL.Login"
[Ajax.JavascriptMethod()]
public bool CheckUsername(String username)
but in my own javascript, when I called "CheckUsername", it was told to be not defined.
HELP! I'm only one step away from ajax.
skeps said
Does anyone have any tips or links to any url's with info on using ajax to upload files?