I am suddenly getting the following error message:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name '16'.
The grid is used for a timesheet application, and has 16 date columns. The 16th column is added for months with 31 days. For the first 15 days of the month, only columns 1-15 are shown, and column 16 is hidden. The logic for hiding the column is simple; if the data contains the key word "hide" in the columns display field, it sets the columns visible property to false. This should prevent the binding of the column from happening. In fact, it has been working in production since January 1st, 2009. However, after adding a column to the grid, this logic no longer works. I reference all columns by unique name, not column number, so the addition of a column should not have changed the existing functionality.
Here is the column's definition:
Here is the code that hides the column:
I have verified that the columns dateheaderdisplaytext is set to hide for column 16 (see attachment), and have also verified through Team Foundation Server that no code related to column 16 or the logic to hide the column has changed. Additionally, I have verified that the Telerik control version is the same in production (where it is working) as on my development machine (where it is not working). The version is 2010.3.1317.40.
Please advise me as to what could have gone wrong.
Thanks,
Nathan
DataBinding: 'System.Data.DataRowView' does not contain a property with the name '16'.
The grid is used for a timesheet application, and has 16 date columns. The 16th column is added for months with 31 days. For the first 15 days of the month, only columns 1-15 are shown, and column 16 is hidden. The logic for hiding the column is simple; if the data contains the key word "hide" in the columns display field, it sets the columns visible property to false. This should prevent the binding of the column from happening. In fact, it has been working in production since January 1st, 2009. However, after adding a column to the grid, this logic no longer works. I reference all columns by unique name, not column number, so the addition of a column should not have changed the existing functionality.
Here is the column's definition:
<
telerik:GridTemplateColumn
DataField
=
"16"
HeaderStyle-Font-Size
=
"8pt"
FooterStyle-Font-Bold
=
"true"
HeaderStyle-HorizontalAlign
=
"Center"
HeaderText
=
"16"
ItemStyle-HorizontalAlign
=
"Center"
SortExpression
=
"16"
UniqueName
=
"16"
Visible
=
"true"
>
<
ItemTemplate
>
<%# Eval("16")%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"txt16"
runat
=
"server"
MaxValue
=
"24"
MinValue
=
"0"
NumberFormat-DecimalDigits
=
"1"
TabIndex
=
"90"
Text='<%# Bind("16") %>'
Width="20px" />
</
EditItemTemplate
>
<
FooterStyle
Font-Bold
=
"True"
HorizontalAlign
=
"Center"
VerticalAlign
=
"Middle"
Width
=
"26px"
/>
<
HeaderStyle
Font-Size
=
"8pt"
HorizontalAlign
=
"Center"
VerticalAlign
=
"Middle"
Width
=
"26px"
/>
<
ItemStyle
HorizontalAlign
=
"Center"
VerticalAlign
=
"Middle"
Width
=
"26px"
/>
</
telerik:GridTemplateColumn
>
Here is the code that hides the column:
//Hide date columns that are needed for this reporting period (14 day and 15 day reporting periods)
if
(dateheaderdisplaytext ==
"hide"
)
{
//hide the columns that are not in this reporting date range.
RadGrid1.MasterTableView.GetColumn(sequence).Visible =
false
;
}
else
{
header[sequence].Text = dateheaderdisplaytext;
}
I have verified that the columns dateheaderdisplaytext is set to hide for column 16 (see attachment), and have also verified through Team Foundation Server that no code related to column 16 or the logic to hide the column has changed. Additionally, I have verified that the Telerik control version is the same in production (where it is working) as on my development machine (where it is not working). The version is 2010.3.1317.40.
Please advise me as to what could have gone wrong.
Thanks,
Nathan