I have a grid with many columns in it. I made several columns 'ReadOnly' and 'Display='false''. When I accesss one of those columns in code behind it then shows up when the grid is refreshed, though with no real data, just this: "System.Data.DataRowView"
Here is the code that matters:
AND:
Here is the code that matters:
| <telerik:GridTemplateColumn UniqueName="SetPrice" Display="false" HeaderText="SetPrice" HeaderStyle-Width="0px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ReadOnly="false"> |
| <ItemTemplate> |
| <asp:Label ID="lblSetPrice" runat="server" Text='<%# Eval("SetPrice") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
AND:
| private void SetTotalAmount() |
| { |
| double total = 0; |
| foreach (GridDataItem item in grdContractItems.Items) |
| { |
| Label lblMetalValue = (Label)item.FindControl("lblExPrice") as Label; |
| Label lblLabor = (Label)item.FindControl("lblExPrice") as Label; |
| Label lblPrice = (Label)item.FindControl("lblExPrice") as Label; |
| Label lblExPrice = (Label)item.FindControl("lblExPrice") as Label; |
| Label lblSetPrice = (Label)item.FindControl("lblSetPrice") as Label; |
| if (lblSetPrice.Text != "0") |
| { |
| lblMetalValue.Text = lblLabor.Text = lblPrice.Text = ""; |
| lblExPrice.Text = lblSetPrice.Text; |
| } |
| if (lblExPrice != null && lblExPrice.Text.Trim() != string.Empty) |
| { |
| total += double.Parse(lblExPrice.Text); |
| } |
| } |
| lblTotalAmount.Text = GetDollar(total.ToString()); |
| } |