.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Refresh of datagrid

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :WPF

Hi. I have a strange problem.

I am developing on SQL 2008 but deploying to SQL 2005. I need to return a UNION query to the client.

After a couple of hours of debugging I have come to the conclusion that the union query doesn't like running on the SQL 2005 version. When I run the following

dbx.Refresh(System.Data.Objects.RefreshMode.ClientWins, obList)

I get the following error (Which has limited hits on google)

{"The refresh attempt has failed because an unexpected entity was returned by the data source."}

It works fine on the SQL 2008 local version.

It works fine when I remove the UNION and only have one straight forward VIEW

Strange one, and one that may be a block for me.

In hope of a solution or at least some pointers would be gratefully accepted

Many thanks Scott

View Complete Post

More Related Resource Links

Refresh Silverlight datagrid

In a Silverlight page I have a datagrid (items loaded from a SP list) and below it a dataform that lets the user make edits to the items displayed in the datagrid when a row is selected from the datagrid.  However, when a user makes an edit to an item using the dataform, the datagrid doesn’t get refreshed when I re-query (via CAML) the SP list to refresh the datagrid.  Only if I change another item in the dataform, does the datagrid then refresh as expected. Code when I Edit the list item in the dataform: public void EndEdit() { ClientContext context = new ClientContext(ApplicationContext.Current.Url); context.Load(context.Web); _skills = context.Web.Lists.GetByTitle("Skills_NewRequest").GetItemById(skillId); _skills["TimeStamp"] = TimeStamp; _skills["Parent"] = Parent; _skills.Update(); context.ExecuteQueryAsync(OnRequestSucceeded, OnFailListener); } private void OnRequestSucceeded(Object sender, ClientRequestSucceededEventArgs args) { Deployment.Current.Dispatcher.BeginInvoke(BindData); } private void BindData() { //MessageBox.Show("Your request has been submitted!"); }   And here’s the code for refreshing the datagrid: private void dataFormNewPending_EditEnding(object sender, DataFormEditEn

WPF DataGrid.Items.Refresh Exception


I am getting this exception when calling the Refresh method of a datagrid.items.  Any clue how to solve this?

This is the message:  'Refresh' is not allowed during an AddNew or EditItem transaction


Cannot Automatically Refresh WPF Datagrid (MVVM / Prism)


I'm developing MVVM application. I bind the DataGrid ItemsSource to a ObservableCollection in the ViewModel code. Every user control (eg. TextBox, Label, etc) in the UI except the DataGrid works fine. When the PropertyChanged event is fired, the value is displayed correctly. But not in the DataGrid, I use TwoWay mode, but it seems that the DataGrid never refresh itself. The DataGrid content is refreshed only when I try to sort any DataGrid column.


public ObservableCollection<CartItem> Cart
	get	{
		return cart;
	set	{
		cart = value;
public ObservableCollection<CartItem> cart;

public CartItem CurrentCartItem
	get	{
		return currentCartItem;
	set	{
		currentCartItem = value;
		// Update the Price value programatically, 
		// It works fine when this value is bound to a common control such as TextBlock
		currentCartItem.Price = CurrentCartItem.Quantity * CurrentCartItem.PricePerUnit;

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Use Jquery with repeater, gridview, datagrid

Before we talk about jquery inside any itemtemplate (repeater, gridview, datagrid), we need to understand the basic use of jquery functions

ListBox tricky to set in a DataGrid/GridView

Listboxes are very tricky to set selected items in grid - there is no real nice way to do it. It would have been great if Microsoft included a property that accepts an array or comma separated values - or anything! But they only allow each item in the list to be selected individually. The way to do this in a grid is a bit messy, but it is fairly simple to implement. When a row is created (as per the event), select the items of the listbox as per the datagrid source data:

How to highlight datagrid or GridView row on mouse over?

This article will show how you can Ajax with GridView to display popup messages when mouse moves over certain column. In the demo project I have added first column as an image column with a help icon in it. This kind of implements a feature that if you want more information about the row you can move mouse over this icon, a asynchronous request is sent to server for data about that row and when call returns the returned message is show as a popup message.

Multiple Column Dropdownlist for the ASP.NET DataGrid

Based on my previous control "Multiple Column DropDownList for ASP.NET", I received many emails asking for the same control to be used in the DataGrid for web applications. Here we go.. This control can be used as the regular MS DropDownList in the DataGrid and also as a regular dropdownlist. It has all the properties, like DataTextField, DataValueField, DataSource, SelectedIndex etc. The download file contains the samples both in VB.NET and C#. In this sample, I have used the Northwind database of SQL Server.

Using the WPF Toolkit DataGrid

WPF comes with a large number of built in controls, but from the beginning it has lacked something that many application developers find extremely important - a DataGrid. You can use the ListView to create something approximating a DataGrid

A datagrid control that can be personalized... anyone??


Hello all,

I need a datagrid control that has following features, besides other regular stuff like paging, sorting, filtering, etc:

The user should be able to -

1. Select columns to view

2. Select column Sequence

3. Select default sort column

4. Store the setting (as a view) and use it on next visit.

5. llow multiple such views to be stored for a user for future use.

All these settings should be saved and when the user comes back he gets the same settings.

Really appreciate your time and would love to get any ideas.


- Zen



Dropdownlist Show the all PatientName and save the PatientID in the database and in datagrid showing the PatientID my requirement is that the PatientName show in DataGrid.

how to do ? 

Cutting Edge: Moving DataGrid Rows Up and Down


Imagine opening your Inbox one morning and finding a message that reads "Dear Mr. DataGrid, I urgently need an ASP.NET DataGrid that lets my users move rows on the client. You're my last hope. Will you please help me?"

Dino Esposito

MSDN Magazine March 2005

GridView: Move Over DataGrid, There's a New Grid in Town!


When incorporating the ASP.NET DataGrid control into your Web apps, common operations such as paging, sorting, editing, and deleting data require more effort than you might like to expend. But all that is about to change. The GridView control--the successor to the DataGrid-- extends the DataGrid's functionality it in a number of ways. First, it fully supports data source components and can automatically handle data operations, such as paging, sorting, and editing, as long as its bound data source object supports these capabilities. In addition, the GridView control offers some functional improvements over the DataGrid. Here DataGrid expert Dino Esposito introduces the GridView and explains all its long-awaited features.

Dino Esposito

MSDN Magazine August 2004

DataGrid: Tailor Your DataGrid Apps Using Table Style and Custom Column Style Objects


One of the most enduring challenges in writing user interfaces is figuring out how to display large amounts of data efficiently and intuitively without bewildering the user. The problem becomes particularly thorny when the interface must reflect hierarchical relationships within the data that the user needs to modify. The Windows Forms DataGrid control gives developers a powerful and flexible tool to meet this challenge. This article explains its basic operations and shows how to extend the DataGrid to display columns of data in an application-appropriate manner.

Kristy Saunders

MSDN Magazine August 2003

Cutting Edge: Creating a Multi-table DataGrid in ASP.NET


If you bind a multi-table DataSet to a DataGrid, only the first table is recognized. Here Dino Esposito writes a custom solution the the multi-table problem.

Dino Esposito

MSDN Magazine August 2003

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend