TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Roopangee Tandon
NA
5
0
using ICallbackeventhandler to call code behind functions form javascript in c#
May 25 2009 2:43 AM
When I use the ICallbackeventhandler I get an error that it is not implemented by my .aspx page while the downloaded files work in the same.Could any one point out the reason.
Just add name space System.web.UI.Icallbackhandler in your c# code in aspx.cs file and the page wont work.
I t is meant to call code behind methods from javascript.
Thanks,
Roopangee
Reply
Answers (
3
)
0
Rodick Wu
0
170
0
May 26 2009 1:01 AM
oh, It's badly for typesetting in this forum.
0
Rodick Wu
0
170
0
May 26 2009 1:00 AM
.aspx file function GetWeather() { var value=document.getElementById("txtName").value; UseCallback(value,""); } function GetWeatherFromServer(value,context) { alert(value);//get your result from DB } GetWeather();
0
Rodick Wu
0
170
0
May 26 2009 12:56 AM
Sorry for not clearly about your issue, and this is my example for ICallbackeventhandler, hope helps for you. public partial class Index : System.Web.UI.Page, ICallbackEventHandler { protected void Page_Load(object sender, EventArgs e) { string reference = Page.ClientScript.GetCallbackEventReference(this, "arg", "GetWeatherFromServer", "context"); string cbScript = "function UseCallback(arg,context)" + "{" + reference + ";" + "}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "UseCallback", cbScript, true); } #region ICallbackEventHandler private string value = string.Empty; public string GetCallbackResult() { return value; } public void RaiseCallbackEvent(string eventArgument) { value = GetStringFromDB(eventArgument); } #endregion
Form that reactivates itself
webbrowser