Hi,
I'm testing a component that search the grid and, in order to do this, am populating a DataTable with random data and assigning it as the DataSource on a UltraGrid. However, it appears the grid doesn't do anything with the data. Is this possible, or is the grid only functional on a form?
[TestFixture]
public class UltraGridSearcherFixture
{
private struct ColumnLabels
public static string Qty = "Qty";
}
[Test]
const int ROW_COUNT = 1000;
new DataColumn(ColumnLabels.Id, typeof(Guid)),
);
DataRow newRow = data.NewRow();
newRow[ColumnLabels.Qty] = rnd.Next(-100, 100);
#endregion
grid.DataSource = data;
grid.DataBind();
Hi Mike,
Thank you for reply.
The problem has just been resolved. The database has been modified at the same moment
when I tried my solution.
You were right. My datasource did not have any rows in it. Shame on me...
Sorry for having make you lost your time. Beginner mistake.
Atsukami
Hi Atsukami,
I can't think of any other reason why you would not get any rows - other than the obvious ones like your data source doesn't actually have any rows in it.
But I am not familiar with BraraCoder. Perhaps it's something specific to the environment. Have you tried this with any other controls, like the Microsoft DataGridView, for example?
I'm getting the same problem as BraraCoder.
I'm using an ultragrid in a class that is not a form. I use the ultragrid just to make an exportexcel.
I set the binding context to a new instance of System.Windows.Forms.BindingContext and refresh the grid, but it still gets no rows. It works better than before because at least I have my table's headers now. But not table's rows.
ds = db.getDataSet(sql); grid.BindingContext = new System.Windows.Forms.BindingContext(); grid.DataSource = ds.Tables[0]; grid.DataBind(); grid.Refresh();
My infragistics version is 10.2.
Do you have an idea?
Thank you for help.
Thanks Mike,
Setting the BindingContext to a new instance of System.Windows.Forms.BindingContext property worked perfectly.
Actually, it might be that the grid simply doesn't have a BindingContext since it's not on a form. Try setting grid.BindingContext = new object() and see if that helps.
If it is, in fact, an issue of painting, you might try calling grid.Refresh to force a paint.