Thursday, December 08, 2005

 

ICallbackEventHandler : Upgrading from VS 2005 Beta 2 to Non-beta

Problem

When converting a web site from Visual Studio 2005 beta 2 to the non-beta version released on 11/07/2005, you receive the following error message when you try to compile the web site:

'SomePage_aspx' does not implement interface member 'System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(string)'. 'SomePage_aspx.RaiseCallbackEvent(string)' is either static, not public, or has the wrong return type.

Solution

1. Open the file SomePage.aspx.cs

2. Create a member variable to hold the string to be returned



public string ajaxReturnString = "";

3. Add the following function to the page:



public string GetCallbackResult()
{
return ajaxReturnString;
}

3. Change your existing RaiseCallbackEvent() function in two ways:
a. Change the return type form string to void.
b. Replace the code that used to return a string with code that sets the ajaxReturnString variable to the string value you wish to return. Then call return;



public void RaiseCallbackEvent(string eventArgument)
{
ajaxReturnString = GetStringValueToReturn(eventArgument);
return;
}

Resources:

Comments: Post a Comment

Links to this post:

Create a Link



<< Home
Content copyright ©2003-2006 Tod Birdsall