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 / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

ClientCallback a step behind...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthew Wells - 14 May 2008 21:15 GMT
Hello,

   I am using a client callback routine that seems to mostly work, except
that program flow doesn't seem to continue from the point the function is
called after the Receive function finishes...

...paraphrasing....

var X = "";

button_Click
{
   var sTest = ListBox1.value;
   DoCallBack(sTest);
   ------ ReceiveCallback executes fine ------
   alert(X);
}

function ReceiveCallback(rValue, context)
{
   textbox1.text = rValue;
   X = rValue
}

When alert(X) happens, it is always a step behind.  For instance, say there
are 5 rows in the list box and the values are 1,2,3,4 and 5.  When I click
1, the textbox shows 1, but alert(X) shows an empty string, then I click 2 -
the textbox shows 2, but alert(X) shows 1.  If I skip values the alert
always shows th previous value.  alert(X) will show the right value if fired
in ReceiveCallback.

How can I continue program flow wirh the current rValue in the button_Click
function?

Thanks

Signature

Matthew.Wells
Matthew.Wells@FirstByte.net

bruce barker - 14 May 2008 21:33 GMT
client callbacks are async. the receive callback will not be called
until after the button click completes.

-- bruce (sqlwork.com)

> Hello,
>
[quoted text clipped - 31 lines]
>
> Thanks
Matthew Wells - 15 May 2008 03:57 GMT
I finally caught that.  I thought the ReceiveCallback alert was firing AFTER
the btnClick alert, but it turns out that the btnClick alert fired first,
then thr ReceiveCallback alert fired and the msgbox appeared on top of the
first so the illusion was that I clicked  OK on the first then the second
appeared, but in reality, I clicked OK on the second leaving the first one.

I know the intent is to be async, but is there a way to "pause" the btnClick
until the Receive callback finishes?  I'm setting a variable in
ReceiveCallBack that I need in btnClick.

Thanks.

> client callbacks are async. the receive callback will not be called until
> after the button click completes.
[quoted text clipped - 36 lines]
>>
>> Thanks
Peter Bromberg [C# MVP] - 15 May 2008 18:57 GMT
No, there wouldn't be a way to "Pause" the button click, because it is the
button's click event handler itself that is actually generating the
callback. So you'll need to revisit your logic to see if you can get what
you need.
Peter

>I finally caught that.  I thought the ReceiveCallback alert was firing
>AFTER the btnClick alert, but it turns out that the btnClick alert fired
[quoted text clipped - 49 lines]
>>>
>>> Thanks

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.