SfUploader inside Grid

Hi,

I am using the SfUploader to add files inside a grid using an Api.The problem is that the bytes (Signature) are not sent to the api via grid. How can this be done?





Attachment: Files_1e00ee67.zip

1 Reply 1 reply marked as answer

MS Monisha Saravanan Syncfusion Team August 23, 2022 02:52 PM UTC

Hi Francisco,


Greetings from Syncfusion support.


Query: “I am using the SfUploader to add files inside a grid using an Api.The problem is that the bytes (Signature) are not sent to the api via grid. How can this be done?”


We have checked your query and we could see that you have used SfUploader in EditTemplate. We would like to inform SfUploader does not have a bind value property. So when using components inside editor settings that does not have bindvalue then we suggest you to update the data to be updated in the action events of DataGrid.


Also please refer the forum for additional information.


Kindly check the attached code snippet for your reference.


 

<SfGrid AllowPaging="true" DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">

        <GridColumn Field="Imagesrc" HeaderText="Customer Name" Width="200">

            <EditTemplate>     @*for rendering SfUploader component in EditTemplate for uploading the image during Adding/Editing*@

                <SfUploader ID="uploadFiles" AllowedExtensions=".jpg,.png,.jpeg" Multiple="false">

                    <UploaderEvents FileSelected="Selected" ValueChange="OnChange"></UploaderEvents>

                </SfUploader>

            </EditTemplate>

        </GridColumn>

    </GridColumns>

</SfGrid>

 

@code{

    public int? DefaultValue = 100;

    public string UploadedFile { get; set; }

    public void BeginHandler(ActionEventArgs<Order> Args)

    {

        if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save && Args.Action == "Add")

        {

            //Args.Data.OrderID = DefaultValue++;    //set the default value while adding.

            //save the file name / url in grid datasource / your database. You can generate the byte and store here.

           // Args.Data.Imagesrc = "scripts/Images/Employees/"+UploadedFile;

        }

    }

   

}

 


Please let us know if you have any concerns.


Regards,

Monisha



Marked as answer
Loader.
Up arrow icon