Linq to Sql Datagrid Help

Posted by Nuah under WPF on 10/20/2010 | Points: 10 | Views : 2668 | Status : [Member] | Replies : 1
Hello,

Im Extremely new to the whole WPF and .Net thing so bear with me.

Im working with a datagrid that is bound to a SQL database with LINQ to SQL , I can update the database when user deletes rows, edits rows etc, but, I cannot figure out how to let them add a new row. UserCanAddRows is set to true.

Help?




Responses

Posted by: Nuah on: 10/20/2010 [Member] Starter | Points: 25

Up
0
Down
Perhaps I should be more clear,

as you know when you enable UseCanAddRows = "True" you get that blank row at the bottom of your datagrid, I would like to make it so when a user fills out that row it adds it to the sql database.

here is the code I'm using for edit ending of a cell right now
       

private void RowEditEnding(object sender, Microsoft.Windows.Controls.DataGridRowEditEndingEventArgs e)
{
try
{
_dc.SubmitChanges();
}
catch (Exception ex)
{
SOBoard customer = e.Row.Item as SOBoard;
try
{
_dc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, customer);
}
catch (Exception ex2)
{
MessageBox.Show(ex2.Message);
}
MessageBox.Show(ex.Message);
}
}


Nuah, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response