Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7494623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:40:39+00:00 2026-05-29T17:40:39+00:00

I have a checkbox list that each time the user selects one item, my

  • 0

I have a checkbox list that each time the user selects one item, my ViewModel will ask my service to send the data related to that option.

_myService.GetAssetSpotDataCompleted += GetAssetSpotDataCompleted;

_myService.GetAssetSpotDataAsync(descItem);

Each selected item will call the same service Method and Debugging the service it sends back the right data.

My problem appears when the user checks some of the items while the data is not still received in my ViewModel. Example: the user selects item 1 and item 2, but my viewModel still has no answer from the service.

When my ViewModel receives the information comes the problem, I always receive twice the same data in my e.Result.

That means that it enters to the method GetAssetSpotDataAsync twice but always with the same result instead of the result for the item 1 and then for the item 2.

I have debugged everything and I have focused the problem in these first two lines of the method GetAssetSpotDataCompleted:

 ((MyServiceClient)sender).GetAssetSpotDataCompleted -= GetAssetSpotDataCompleted;
            if (e.Result != null)

Anyone can help me with this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T17:40:47+00:00Added an answer on May 29, 2026 at 5:40 pm

    What is happening is that by the time the response to first request has arrived the service finds 2 delegates listening on GetAssetSpotDataCompleted (one was added when the request was made the other when the second still outstanding request was made).

    It will call both the delegates, it has no way to know that the second delegate was only meant for the second outstanding request. When the first is called its code removes one of the delegates from the event. When the second is called then it also removes the remaining delegate leaving the GetAssetSpotDataCompleted as null.

    Now when the second request finally completes the service finds GetAssetSpotDataCompleted event is null and does nothing.

    One solution would be to only add the event handler once, perhaps at the same point that _myService gets assigned in the ViewModel.

    However there may be another issue, there is no guarantee that the responses to the two outstanding requests will arrive in the same order they were sent (although it highly likely that they will.) It may be better then to add an IsBusy boolean property to the ViewModel and set this true when an outstanding request is made, clearing it when completed. Bind this property to a BusyIndicator control (found in the Toolkit). This will prevent user interaction whilst an async operation that will ultimate change the state of the UI is in progress.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of items and each item has a Html.CheckBox. What is
I have a list of items and each item has a checkbox attached to
I have a checkbox list control on my asp.net web form that I am
We have an ASP.Net page that uses a checkbox to toggle between a list
Currently I have a list view within it each row has a checkbox attached.
I have a un-ordered ( ul ) HTML list. Each li item has 1
I have a List component that has drop-in CheckBox itemEditor that also serves as
I have a simple user signup form with a checkbox that lets users get
I have a paged list of items, each with a checkbox associated with it.
I have a list of States in an ItemsControl, the DataTemplate is a CheckBox.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.