LinqToSql not seeing datagrid updates

B

Bill McCormick

I have a Datagrid that displays records from a table. I'm calling a
LinqToSql stored procedure that does successfully insert a row into the
table, but unfortunately I don't see the new record until the
application is restarted.

The code looks something like this:

try {
int result = _db.MakeNewRec(param1,param2,param3);

if (result == 0) {
//do some stuff
}
} catch (Exception ex) {
// handle ex
}

result is 0 and the new record is there, but the grid does not update.
The datagrid has a binding that looks like this:

<toolkit:DataGrid
x:Name="RecGrid"
ItemsSource="{Binding Recs}"
...

where Recs is a Datacontext property of _db that looks like this (from
the generated code):

public System.Data.Linq.Table<Rec> Recs
{
get {
return this.GetTable<Rec>();
}
}

What's the trick here? Anybody know?

TIA,

Bill
 
B

Bill McCormick

I have a Datagrid that displays records from a table. I'm calling a
LinqToSql stored procedure that does successfully insert a row into the
table, but unfortunately I don't see the new record until the
application is restarted.

The code looks something like this:

try {
int result = _db.MakeNewRec(param1,param2,param3);

if (result == 0) {
//do some stuff
}
} catch (Exception ex) {
// handle ex
}

result is 0 and the new record is there, but the grid does not update.
The datagrid has a binding that looks like this:

<toolkit:DataGrid
x:Name="RecGrid"
ItemsSource="{Binding Recs}"
...

where Recs is a Datacontext property of _db that looks like this (from
the generated code):

public System.Data.Linq.Table<Rec> Recs
{
get {
return this.GetTable<Rec>();
}
}

One other detail here: The Datagrid that needs updating is inside of a
<DataTemplate> which is inside the <DataGrid.RowDetailsTemplate>

Thanks,

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top