D
DCC700
I have a datagrid that appears to be binding to the wrong value of the
data table being bound. The datagrid is in a user control that is used
multiple times on the page. The other instances are binding as expected.
I am binding to a datatable that I create in code and when debugging I
can see the correct values are in the datatable, and to the datagrid
source after I assign the datatable to it. But after calling DataBind
the corresponding values in the cells of the data grid are not correct.
Here is a sample of how the code looks.
dt = CreateDataTableforDG()
dgData.DataSource = dt
dgData.DataBind()
I have checked that the values are assigned to the columns with the same
name as the datafield in the columns of the datagrid. The columns are
not in the same order, but that shouldn't matter. Here is a sample of
how the data looks.
Col0 Col1 Col2 Col3
DataTable Descr1 .5 0 1
DGDataSource Descr1 .5 0 1
DataGrid Descr1 1 1
It appears like Col3 is getting the right value and possibly column 1 is
getting the value from column3. This is very weird. It seems like I'm
missing something but haven't been able to find it.
Has anyone encountered anything like this?
Does anyone have any suggestions?
data table being bound. The datagrid is in a user control that is used
multiple times on the page. The other instances are binding as expected.
I am binding to a datatable that I create in code and when debugging I
can see the correct values are in the datatable, and to the datagrid
source after I assign the datatable to it. But after calling DataBind
the corresponding values in the cells of the data grid are not correct.
Here is a sample of how the code looks.
dt = CreateDataTableforDG()
dgData.DataSource = dt
dgData.DataBind()
I have checked that the values are assigned to the columns with the same
name as the datafield in the columns of the datagrid. The columns are
not in the same order, but that shouldn't matter. Here is a sample of
how the data looks.
Col0 Col1 Col2 Col3
DataTable Descr1 .5 0 1
DGDataSource Descr1 .5 0 1
DataGrid Descr1 1 1
It appears like Col3 is getting the right value and possibly column 1 is
getting the value from column3. This is very weird. It seems like I'm
missing something but haven't been able to find it.
Has anyone encountered anything like this?
Does anyone have any suggestions?