views:

53

answers:

2

Hello My Project include dataGridView Control, and i change the property: gridview1.columns.DataPropertyName at run time Now, i need rebind my gridView, how i do this. in asp.net is simple gridView1.DataBind(), bun how in c#.

Thanks..

A: 

Try setting the DataSource again, as in:

gridview1.DataSource = <your data source goes here>;
Adel Hazzah
You may have to set the gridview1.DataSource to null first to force it to recognize that something has changed.gridview1.DataSource = null;gridview1.DataSource = <your data source goes here>;
Adel Hazzah
Hello Adel, This is not work.. i know that in asp.net you can simple do : datagridview1.DataBind()anyone has another solution to rebind gridview?
liran
A: 

Hello Adel, This is not work.. i know that in asp.net you can simple do : datagridview1.DataBind() anyone has another solution to rebind gridview? (when I change the dataSource or gridview1.columns.DataPropertyName?

liran