Refresh RadGridview when Insert,Update and Delete Operation done on Database in WPF
Posted
by patelriki13
on Stack Overflow
See other posts from Stack Overflow
or by patelriki13
Published on 2010-03-25T12:26:37Z
Indexed on
2010/03/25
13:33 UTC
Read the original article
Hit count: 1448
WPF and C#: Problem: 1. How to Refresh Radgridview when i Insert,update and Delete Record in database anrecord. 2.when i am Insert or Update Record than in radgridview that row is selected.
i am useing sql server 2005.
i am use to set data source of radgridview like " radgridview1.ItemsSource = ds; " ==> ds is dataset.
i am beginner so if possible than tel me by code it is easy to understand.......
can u help me as early as possible ....
i give some code which i am useing for update RadGridview
con.ConnectionString = @"Data Source=(local);Initial Catalog=DigiDms;Integrated Security=True";
cmd1.Connection = con;
con.Open();
cmd1.CommandType = CommandType.StoredProcedure;
cmd1.CommandText = "Pro_Insurance_Master_Select";
da1.SelectCommand = cmd1;
da1.Fill(ds1);
con.Close();
//dataGrid.clear();
//dsGrid.Reset();
//dsGrid = dataGrid.GetData("Pro_Insurance_Master_Select"); //set datasource of gridview
gridShowData.ItemsSource = null;
gridShowData.ItemsSource = ds1;
doing this ,
when i am delete or update record than folloning error generated...
Error: >> "Object reference not set to an object"
when i am doing the "gridShowData.ItemsSource = null;"
and when i am doing insert operation than this error is not generated and RadGridview also updated.....
so pls help me as early as possible.... i am beginer ........
my email address is [email protected]
© Stack Overflow or respective owner