Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2006

Tip: Looking for answers? Try searching our database.

ICallbackEventHandler

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SalamElias - 04 Apr 2006 15:12 GMT
I am implementing the ICallbackEventHandler interface, and one of its members
methods in a server control as follows :
public void RaiseCallbackEvent(string eventArgument)
    {
        if (eventArgument != "")
        {
           
            result += tmp1.ToString() + "), new Array(" + tmp2.ToString() + "));";
            return result;
        }
        else
        {
            return "showQueryDiv" + JS_suffixe + "('" + eventArgument + "', new
Array(), new Array());";
        }
        //throw new Exception("The method or operation is not implemented.");
    }

Yhe other method which I dont use as follows
public string GetCallbackResult()
   { }

When I compile I get the following erros

"Since 'contact_project.RaiseCallbackEvent(string)' returns void, a return
keyword must not be followed by an object expression"
and the second error
"contact_project.GetCallbackResult()': not all code paths return a value'

Thanks for your help
SalamElias - 04 Apr 2006 15:28 GMT
I forgot to say that initially, I wanted my my raise event to return a
string, when I do
      public string RaiseCallbackEvent(string eventArgument)
                     {}
then compile, I get the following error

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

Thanks again

> I am implementing the ICallbackEventHandler interface, and one of its members
> methods in a server control as follows :
[quoted text clipped - 26 lines]
>
> Thanks for your help
Steven Cheng[MSFT] - 05 Apr 2006 07:25 GMT
Hi Salam,

Thank you for posting.

Regarding on the ASP.NET 2.0 script call back issue, based on my research,
it seems a document issue. As for the ICallBackEventHandler interface, it
contains two member functions we need to implement:

#ICallbackEventHandler Methods
http://msdn2.microsoft.com/en-us/library/dcc3kkye.aspx

The "RaiseCallbackEvent" function does not have return value, so we can not
return any data in this function. If we need to return data to client-side,
we need to use the "GetCallbackResult" function. e.g:

_cbResult is a page member variable
=====================================
#region ICallbackEventHandler Members

   public string GetCallbackResult()
   {
       return _cbResult;

   }

   public void RaiseCallbackEvent(string eventArgument)
   {
       _cbResult = eventArgument + "__" +  DateTime.Now.ToLongTimeString();

   
   }

   #endregion
==============================

Hope this helps. And sorry for the inconvenience the document problem
brings you.

Regards,

Steven Cheng
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.