PopulateValues with a dataView throws an exception

I have a gridcontrol (Not databound) that I am trying to populate with the sorted results from a dataview. The control throws a an exception on the call to PopulateValues(). This worked fine on a DataBound Grid. Any ideas? Thanks, Jonathan

2 Replies

AD Administrator Syncfusion Team August 14, 2003 02:36 PM UTC

This code worked OK for me in a button handler to populate a grid from a DataView on a DataTable dt. Can you post a sample showing the problem?
private void button1_Click(object sender, System.EventArgs e)
{
	DataView dv = new DataView(this.dt, "", "Col1", DataViewRowState.CurrentRows);
	this.gridControl1.RowCount = dv.Count + 1;
	this.gridControl1.ColCount = dv.Table.Columns.Count + 1;
	this.gridControl1.PopulateValues(GridRangeInfo.Cells(1, 1, 
			this.gridControl1.RowCount, this.gridControl1.ColCount) , dv);
	this.gridControl1.Refresh();
}


JG Jonathan Guidry August 14, 2003 04:50 PM UTC

Thanks! I was missing: this.gridControl1.RowCount = dv.Count + 1; this.gridControl1.ColCount = dv.Table.Columns.Count + 1; Jonathan

Loader.
Up arrow icon