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 6707059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:35:38+00:00 2026-05-26T07:35:38+00:00

I really want to know why in the first case I can bind data

  • 0

I really want to know why in the first case I can bind data to the DataGrid and in the second case it doesn’t work at all. Thank you for any clue!!!

Here is the code:

        Guid id = Guid.Parse("BCBBF129-30ED-400B-9D63-403ED79FDFC7");
        EntityQuery<Alert> alert = this._preDomainContext.GetAlertQuery(id);  
        LoadOperation<Alert> l = this._preDomainContext.Load(alert);
        dataGrid1.ItemsSource = l.Entities; // <- It works fine

        label1.Content = l.Entities.ElementAt(0).Message; // It gives an error

And the XAML:

<sdk:DataGrid   AutoGenerateColumns="True" Height="100" 
HorizontalAlignment="Left" Margin="173,154,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="120" />
<sdk:Label Height="28" HorizontalAlignment="Left" Margin="194,114,0,0" Name="label1" VerticalAlignment="Top" Width="120" />

And error is:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Oh! On both cases when I debug I cannot see any values for the l.Entities and as well as
l.Entities.ElementAt(0).Message. But when page appears under the DataGrid I can see the data but at the same time I get the error above…

I am not sure… But is it possible to see the data before when a page appears? It’s really uncomfortable don’t see any data at all…

UPDATES:

    [RequiresAuthentication]
    [EnableClientAccess()]
    public class PreDomainService : LinqToEntitiesDomainService<PreEntities>
    {


    public  Alert GetAlert(Guid id)
        {
            return this.ObjectContext.Alerts.Where(a=>a.ID == id).FirstOrDefault();
        }
  • 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-26T07:35:38+00:00Added an answer on May 26, 2026 at 7:35 am

    I would assume that your Entities collection is empty.

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

Sidebar

Related Questions

First of all, I don’t really know what’s wrong with dependent types and why
I really want to know if I'm missing anything obvious in the software I'm
I really want to know your experience at working with ADO.Net datasets (calling stored
I know about the ADODB.Stream object . But what I really want is a
I want to start working with TDD but I don't know really where to
I really want to write .NET apps that run on any platform (PC, Linux
First, my code (It is far from perfect, I don't really know what I
i know how to post data using javascript but im trying to work out
I really want to get the google Calendar Api up an running. I found
I really want to be able to have a way to take an app

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.