Tuesday

asp.net calling codebehind from JavaScript


1.add this to javascript __doPostback('GetPage', 'myargument1');


2.Then in OnLoad event I can add:


If Request.Form("__EVENTTARGET") = "GetPage" Then
MyFunction1(Request.Form("__EVENTARGUMENT")) 'myargument1 will be passed to MyFunction1
End If

1 comment:

Anonymous said...

i. In your code file (assuming you are using C# and .NET 2.0 or later) add the following Interface to your Page Class to make it look like

public partial class Default : System.Web.UI.Page, IPostBackEventHandler{}


ii. This should add (using Tab-Tab) this function to your code file:

public void RaisePostBackEvent(string eventArgument) { }


iii. In your onclick event in Javascript write the following code:

var pageId = '<%= Page.ClientID %>';
__ doPostBack(pageId, argumentString);


This will call the 'RaisePostBackEvent' method in your code file with the 'eventArgument' as the 'argumentString' you passed from the Javascript. Now, you can call any other event you like.

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...