Hi,
I have an ajaxified RadGrid with a single GridImageColumn.
When updating a item, I overwrite the image (the image url stay the same).
The problem is the following :
When the Grid is rebind after the update, the image has not been refreshed within the grid, its still the old one. I have to refresh the page (F5) to make the changes visible.
Any ideas ?
- My grid is bind using needdatasource
- I tried to replace the imagecolumn by a templatecolumn -> same problem
- I tried to set the imageurl inthe itemdatabound event of the grid -> same problem
Thank You
Arnaud Boiselle
I have an ajaxified RadGrid with a single GridImageColumn.
| <telerik:RadGrid ID="RadGrid1" runat="server" Skin="Black" AllowPaging="true" PageSize="20" |
| AutoGenerateColumns="False" AllowSorting="True" AllowFilteringByColumn="True"> |
| <ClientSettings EnableRowHoverStyle="true"> |
| <ClientEvents OnRowDblClick="RowDblClick" /> |
| </ClientSettings> |
| <MasterTableView CommandItemDisplay="Top" DataKeyNames="id_film" CommandItemSettings-AddNewRecordText="Ajoutez un film" |
| NoMasterRecordsText="Aucun résultat" AllowMultiColumnSorting="true"> |
| <Columns> |
| <telerik:GridImageColumn DataType="System.String" DataImageUrlFields="id_film" DataImageUrlFormatString="Affiches/{0}_Mini.jpg" |
| DataAlternateTextField="titre" ImageAlign="Middle" ImageHeight="100" ImageWidth="75" |
| AllowSorting="false" AllowFiltering="false" UniqueName="affiche" /> |
| </Columns> |
| <EditFormSettings EditFormType="Template"> |
| <FormTemplate> |
| <asp:Button ID="Button1" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Enregistrer", "Modifier") %>' |
| runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'> |
| </asp:Button> |
| </FormTemplate> |
| </EditFormSettings> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="RadGrid1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
When updating a item, I overwrite the image (the image url stay the same).
| Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid1.ItemCommand |
| If (e.CommandName = RadGrid.UpdateCommandName) Then |
| 'Upload Affiche |
| Dim myRequest As HttpWebRequest |
| Dim myResponse As HttpWebResponse |
| Dim s As System.IO.Stream |
| Dim graphicTemp As System.Drawing.Graphics |
| Dim ImageSource As System.Drawing.Image |
| Dim affiche_url = "http://thenewimage" |
| myRequest = WebRequest.Create(affiche_url) |
| myResponse = myRequest.GetResponse() |
| s = myResponse.GetResponseStream() |
| ImageSource = System.Drawing.Image.FromStream(s) |
| graphicTemp = System.Drawing.Graphics.FromImage(ImageSource) |
| graphicTemp.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver |
| graphicTemp.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality |
| graphicTemp.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality |
| graphicTemp.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic |
| graphicTemp.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality |
| graphicTemp.DrawImage(ImageSource, 0, 0, ImageSource.Size.Width, ImageSource.Size.Height) |
| graphicTemp.Dispose() |
| ImageSource.Save(Server.MapPath("~/Media/Affiches/" & e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("id_film") & "_Normal.jpg"), System.Drawing.Imaging.ImageFormat.Jpeg) |
| ImageSource.Dispose() |
| s.Close() |
| myResponse.Close() |
| End If |
| End Sub |
The problem is the following :
When the Grid is rebind after the update, the image has not been refreshed within the grid, its still the old one. I have to refresh the page (F5) to make the changes visible.
Any ideas ?
- My grid is bind using needdatasource
- I tried to replace the imagecolumn by a templatecolumn -> same problem
- I tried to set the imageurl inthe itemdatabound event of the grid -> same problem
Thank You
Arnaud Boiselle
