Hi,
I'm trying to switch an image in relation to a string within the database for one of the columns in a Grid. So that if if the database field is equal to 'medium' a yellow flag is displayed in the column. I got it to work (the images display in relation to the database), however if there is data in the sub field then it throws and error when I try to expand the row. the exact error reads" ArgumentException was unhandled- Priority is neither a datacolumn nor a datarelation for table default view"
aspx code
VB code
thanks in advance, I'm kind of stumped on how to resolve the error as it displays but wont expand
I'm trying to switch an image in relation to a string within the database for one of the columns in a Grid. So that if if the database field is equal to 'medium' a yellow flag is displayed in the column. I got it to work (the images display in relation to the database), however if there is data in the sub field then it throws and error when I try to expand the row. the exact error reads" ArgumentException was unhandled- Priority is neither a datacolumn nor a datarelation for table default view"
aspx code
| OnItemDatabound="Rad2_ItemDataBound" |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn UniqueName="PriorityProject" Groupable="false" |
| DataField="Priority" HeaderText="Priority"> |
| <HeaderStyle Width="20px" /> |
| <ItemStyle Height="35px" /> |
| <ItemTemplate> |
| <asp:Image ID="PriorityProject" Boarderwidth="0px" runat="server" ImageUrl='<% Eval "images/icons/" & Trim(objRow("Priority")) & ".png" %>' AlternateText="PriorityFlag" style="float:right;" /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
VB code
| Protected Sub Rad2_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles Rad2.ItemDataBound |
| If e.Item.ItemType = GridItemType.Item Or e.Item.ItemType = GridItemType.AlternatingItem Then |
| Dim objRow As DataRowView |
| objRow = e.Item.DataItem |
| Dim tmpImage As Image |
| tmpImage = CType(e.Item.FindControl("PriorityProject"), Image) |
| tmpImage.ImageUrl = "images/icons/" & Trim(objRow("Priority")) & ".png" |
| End If |
| End Sub |
thanks in advance, I'm kind of stumped on how to resolve the error as it displays but wont expand