PC Review


Reply
Thread Tools Rate Thread

ICallbackEventHandler

 
 
=?Utf-8?B?U2FsYW1FbGlhcw==?=
Guest
Posts: n/a
 
      4th Apr 2006
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2FsYW1FbGlhcw==?=
Guest
Posts: n/a
 
      4th Apr 2006
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

"SalamElias" wrote:

> 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
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      5th Apr 2006
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.



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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ICallbackEventHandler Slim Microsoft Dot NET 0 29th Jun 2006 03:25 PM
ASP.NET 2.0 ICallbackEventHandler Lorenzo Soncini Microsoft ASP .NET 2 28th Dec 2005 06:31 PM
ASP.NET 2 ICallbackEventHandler Maya Nasri Microsoft ASP .NET 2 2nd Nov 2005 11:34 AM
ASP.NET 2 ICallbackEventHandler Maya Nasri Microsoft C# .NET 2 2nd Nov 2005 11:34 AM
ICallbackEventHandler Q???? JimGreen Microsoft ASP .NET 1 25th Oct 2005 03:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:48 AM.