unable to refresh grid on toolbar button click, show error message more prominently

I have 2 questions:
a. I am trying to refresh the grid on click of a toolbar button but it is not working. Would you have any input on what could be wrong? 

Code snippets:
protected SfGrid<Fileupload> FileUploads;
public async Task FileUploads_OnToolbarClick(Syncfusion.Blazor.Navigations.ClickEventArgs args)
{
if (args.Item.Text == "Refresh")
{
this.FileUploads.Refresh();
StateHasChanged();
}
}

<SfGrid Id="FileUploads" @ref="FileUploads" AllowTextWrap="true" 
DataSource="@FileuploadsResult" AllowPaging="true" AllowSorting="true"
AllowFiltering="false"
Toolbar="@(new List<object>()
{ "Print", "Delete", "ExcelExport", "PdfExport", "WordExport","Search",
new ItemModel() {
Text = "Refresh", TooltipText = "Refresh", PrefixIcon = "e-refresh",
Id = "Refresh"
}})"
AllowExcelExport="true" AllowPdfExport="true" >
<GridSearchSettings Operator="Operator.Contains" IgnoreCase="true"/>
<GridPageSettings PageSize="10"/>
<GridEvents OnToolbarClick="FileUploads_OnToolbarClick" TValue="Fileupload"/>
<GridEditSettings AllowAdding="false" AllowEditing="false" AllowDeleting="true" ShowDeleteConfirmDialog="true"/>
<GridColumns>
<GridColumn Field=@nameof(Fileupload.fileuploadid) IsPrimaryKey="true" Visible="false"/>
<GridColumn HeaderText="Name">
<Template>
@{
var item = (context as Fileupload);
@($"{item?.actualfilename}")
}
Template>
GridColumn>
<GridColumn HeaderText="Upload Date">
<Template>
@{
var item = (context as Fileupload);
@($"{item?.timestamp.ToOrdinalWords()}")
}
Template>
GridColumn>
GridColumns>
<GridTemplates>
<DetailTemplate>
@{
var item = (context as Fileupload);
width="100%">

width="30%">
width="30%">
width="30%">














style="font-weight: 500;">Size: @item?.filesizeinbytes.Bytes().Humanize("MB")

style="font-weight: 500;">Type: @item?.filetype

style="font-weight: 500;">No of audio streams: @item?.noofaudiostreams

style="font-weight: 500;">Audio Languages: @item?.commaseperatedaudiolanguages

style="font-weight: 500;">Audio Codec: @item?.audiocodec

style="font-weight: 500;">Audio length: @(TimeSpan.FromSeconds(item.audiolength).Humanize())

}
DetailTemplate>
GridTemplates>



b. Is there a way to show the validation messages more prominently eg: show the message in red and show a * when the control is in error? 

<div style="margin-bottom: 1rem" class="row">
class="col-md-3">
style="width: 100%" Text="Transcription name"/>

class="col-md-9">
@bind-Value="@(submitTranscriptionInput.JobName)" Width="200px"/>
For="@(() => submitTranscriptionInput.JobName)" />

>





1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team January 18, 2021 01:11 PM UTC

Hi Ajit, 

Greetings from Syncfusion support. 

Query 1 : a. I am trying to refresh the grid on click of a toolbar button but it is not working. Would you have any input on what could be wrong? 
We tried using the shared code in our latest version 18.4.0.34 and tried refreshing Grid. We could not face any exception or errors while calling the Refresh method, and Grid refresh works fine with our sample. We are attaching the sample for your reference, please download the sample from the link below, 
 
If we have misunderstood your query, or if you are still facing difficulties then the following details would be helpful for us to proceed further. 
  1. Share the detailed explanation of your complete requirement.
  2. Share the exception details you are facing.
  3. Share with us a sample which you have tried from your side, or if possible reproduce the problem with the attached sample and share with us for further analysis.
  4. Share with us a video demo showing the problem you are facing.  
 
Query 2 : b. Is there a way to show the validation messages more prominently 
We have inbuilt support for validation during editing in Grid. You can use either ValidationRules in the GridColumn definition or DataAnnotation support to apply validation for columns during editing in Grid. Please refer the below documentation for more details. Ensure to use anyone of the below two ways in applying validation for GridColumn. 


Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon