changing Datasource for Grid Control


Author
Message
Amadneep Kirar
Amadneep Kirar
StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)StrataFrame Beginner (1 reputation)
Group: Forum Members
Posts: 1, Visits: 9
Hi..



i am using a Datagrid control in my application.

i am binging a datatable to grid on page load.

and on a click event of a button i am binding another datatable to grid.which i deserialize from stream.but datagird shows me the DataCoulumns and Datarows only but not the values.

i tried grid.refresh(), grid.refreshdatasource() but problem still exists.



when i bound the same datatable i deserialized from stream with no datasource bound to grid then am values are displayed on grid.



please help.



The code is as follows.



dtOffers = b.Deserialize(fileStream) as DataTable;

dtOffers.RemotingFormat = SerializationFormat.Binary;

if (dtOffers != null)

{

gridOffer.BeginUpdate();

gridOffer.DataSource = null;

gridOffer.DataSource = dtOffers;

gridOffer.RefreshDataSource();

gridOffer.EndUpdate();

}

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Are you binding to a business object or directly to a DataTable?

It could be that the new data table does not have the same columns as the first DataTable and therefore, none of the data is showing up.  You might try setting the AutoGenerateColumns property to True before you set the data source.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search