This is a migrated thread and some comments may be shown as answers.

RadGrid set value cell

1 Answer 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 08 Nov 2016, 12:12 PM

Hi,

I have a GridTemplateColumn with itemtemplate, in this itemtemplate i have a linkbutton and ImageControl, when i click the link i want show the image. 

this is the aspx:

<telerik:GridTemplateColumn UniqueName="BtnPOD" HeaderStyle-Width="5%" ItemStyle-Width="10%" HeaderText="POD" AllowFiltering="false" >

                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnPOD" CommandName ="detailPOD" Text='<%#Eval("POD")%>' runat="server"/>
                                                <asp:Image ID="ImgPOD" runat="server" ImageUrl='<%#Eval("POD")%>' />                                                                                                               </ItemTemplate>                                                                                  
</telerik:GridTemplateColumn>

 

in vb, in the ItemCommand event:

If Not Image Is Nothing AndAlso Image.Length <> 0 Then
            Dim arrpictures As Byte() = System.Convert.FromBase64String(Image)
            Dim myStream As New System.IO.MemoryStream(arrpictures)
            Dim base64String As String = Convert.ToBase64String(arrpictures, 0, arrpictures.Length)
            For i = 0 To CType(Session("GridViewData"), DataTable).Rows.Count - 1
                If i = e.Item.ItemIndexThen
                    CType(Session("GridViewData"), DataTable).Rows(i)("POD") = "data:image/jpeg;base64," & base64String
                End If
            Next
End If

i modify the DataTable and in needdatasource event:

RadGrid1.DataSource = CType(Session("GridViewData"), DataTable)

in needdatasource i check the changes in DataTable, but i can see the changes in radgrid

 

 

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 11 Nov 2016, 01:13 PM
Hi Alex,

At which event of the Page Lifecycle you call Rebind(), for the grid to get the new data? If you call it too late, it is already rendered using the old data.

Regards,
Vasil
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Grid
Asked by
Alex
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or