Show image from remote server inside of Blazor Grid cell and display it on page

I have found this post
http://www.syncfusion.com/forums/154812/show-image-from-database-inside-grid?reply=NtToH8
But in this case the image is hardcoded and same for every entry on list.


I'm trying to use SfGrid and display an image from a remote link, saved as string inside of static list of my students, but I don't see any iterator to use to find specific entry in the list, while just invoking Student.AvatarLink as previously used by SfGrid does result in CS0120


Below is the code I've made with the issue in line 26

https://pastebin.com/bqQGauXh

Is there some way to accomplish displaying an image from remote server, to which image link is saved in a static list as string using syncfusion's SfGrid?


1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team June 1, 2022 06:19 AM UTC

Hi Aleksander,


Greetings from Syncfusion support.


Based on this scenario, we suggest you to get the value from context inside the Template as like the below code. You can get the corresponding row data using context inside column Template. Please refer and use like below highlighted codes.


<GridColumns>

            <GridColumn Field=@nameof(Student.AvatarLink) HeaderText="Avatar"  TextAlign="TextAlign.Center">

                <Template>

                    @{

                        var rowvalue = (context as Student);

                    <div class="image">

                        <img src=@(rowvalue.AvatarLink) />

                    </div>

                }

            </Template>

        </GridColumn>

 


Reference : https://blazor.syncfusion.com/documentation/datagrid/column-template


Please get back to us if you need further assistance.


Regards,

Renjith R


Marked as answer
Loader.
Up arrow icon