RadGrid set value cell

2 posts, 0 answers
  1. Alex
    Alex avatar
    1 posts
    Member since:
    Apr 2016

    Posted 08 Nov 2016 Link to this post


    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" >

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


    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
    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



  2. Vasil
    Vasil avatar
    1640 posts

    Posted 11 Nov 2016 Link to this post

    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.

    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.
Back to Top