Hi all,
i'm facing with images behaviour in GridTemplateColumns.
I have a grid with two GridTemplateColumns, first with an image object and second with a panel object.
image ImageUrl parameter is set in grid ItemDataBound event, and it points to a custom HttpHandler which downloads an image from my database and renders it on the browser.
Unfortunately, when i change grid datasource, image ImageUrl is programmatically set to the right new imageUrl, while the grid renders the previous image. If i inspect the image url, it really points to previous url, instead of new one.
I tried yet to expire and disable cache of my page, but it still doesn't work.
here is my grid
and here is the ItemDataBound handler
i'm facing with images behaviour in GridTemplateColumns.
I have a grid with two GridTemplateColumns, first with an image object and second with a panel object.
image ImageUrl parameter is set in grid ItemDataBound event, and it points to a custom HttpHandler which downloads an image from my database and renders it on the browser.
Unfortunately, when i change grid datasource, image ImageUrl is programmatically set to the right new imageUrl, while the grid renders the previous image. If i inspect the image url, it really points to previous url, instead of new one.
I tried yet to expire and disable cache of my page, but it still doesn't work.
here is my grid
| <telerik:RadGrid ID="RadGrid1" runat="server" > |
| <MasterTableView DataKeyNames="ID_N" AutoGenerateColumns="false" ShowHeader="true"> |
| <Columns> |
| <telerik:GridTemplateColumn> |
| <ItemTemplate> |
| <asp:Image ID="Image1" runat="server" CssClass="AssetImage" /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn > |
| <ItemTemplate> |
| <asp:Panel runat="server" ID="Panel1"></asp:Panel> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
and here is the ItemDataBound handler
| Private Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound |
| If e.Item.ItemType = Telerik.Web.UI.GridItemType.Item OrElse e.Item.ItemType = Telerik.Web.UI.GridItemType.AlternatingItem Then |
| Dim GDI As Telerik.Web.UI.GridDataItem = DirectCast(e.Item, Telerik.Web.UI.GridDataItem) |
| Dim DRV As DataRowView = DirectCast(GDI.DataItem, DataRowView) |
| Dim img As Image = DirectCast(GDI.FindControl("Image1"), Image) |
| img.ImageUrl = String.Format("assetimg.ashx?IDN={0}&BH=100&BW=100&CAT={1}", DRV("ID_N"), Me.Category) |
| End If |
| End Sub |