Click here to Skip to main content
15,945,109 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I work on core blazer server side .I face issue I can't export ridzen data grid to excel after filter data on it .

so when page load list of Data source of ridzen data grid 10 so after this write any filter to any column then become 4 so when press

button export to excel it export 10 rows but correct must be 4 rows

so How to export ridzen data grid to excel after filter ridzen datat grid

What I have tried:

  private async Task ExportToExcel()
         ExceldatabaseData = databaseData.Select(p => new CopyExcelDatabaseClass
                DBID = p.dbid,
                DBName = p.databaseName,
                ServerID = p.serverID,
                ServerName = p.serverName,
                Severity = p.serverity,
                BackupProcedure = p.backUpProcedure,
                Remarks = p.remarks,
                OwnerFileNo = p.ownerfilenumber,
                OwnerFileName = p.ownerfilename,
                IsActive = p.isActive

        ExcelPackage.LicenseContext = LicenseContext.Commercial;
        var stream = new MemoryStream();
        using (var package = new ExcelPackage(stream))
            var worksheet = package.Workbook.Worksheets.Add("DatabaseList");
            //worksheet.Cells.LoadFromCollection(databaseData, true);
            worksheet.Cells.LoadFromCollection(ExceldatabaseData, true);

        var buffer = stream.ToArray();
        var fileName = $"Database_{DateTime.Now:yyyyMMddHHmmss}.xlsx";
        await JS.InvokeAsync<object>("saveAsFile", fileName, Convert.ToBase64String(buffer));
java script function 
window.saveAsFile = (filename, bytesBase64) => {
    const link = document.createElement('a'); = filename;
    link.href = 'data:application/octet-stream;base64,' + bytesBase64;

  public class CopyExcelDatabaseClass
        [DisplayName("DB ID")]
        public int DBID { get; set; }

        [DisplayName("DB Name")]
        public string DBName { get; set; }

        [DisplayName("Server ID")]
        public int ServerID { get; set; }
        [DisplayName("Server Name")]
        public string ServerName { get; set; }
        public string Severity { get; set; }
        [DisplayName("Backup Procedure")]
        public string BackupProcedure { get; set; }
        public string Remarks { get; set; }

        [DisplayName("Owner File No")]
        public string OwnerFileNo { get; set; }
        [DisplayName("Owner File Name")]
        public string OwnerFileName { get; set; }

        [DisplayName("Is Active")]
        public bool IsActive { get; set; }

private IEnumerable<DatabaseClass> databaseData = Array.Empty<DatabaseClass>();
 private async Task RefreshList()
        var request = new HttpRequestMessage(HttpMethod.Get, config["API_URL"] + "Database/GetAllDatabaseDetails");
        var client = ClientFactory.CreateClient();
        var response = await client.SendAsync(request);
        using var responsestream = await response.Content.ReadAsStreamAsync();
        databaseData = await JsonSerializer.DeserializeAsync<List<DatabaseClass>>(responsestream);

 protected override async Task OnInitializedAsync()
        await RefreshList();
Updated 22-Jul-23 14:21pm

1 solution

Razden Official Support[^] is the best place to ask about Razden Products.
Share this answer
ahmed_sa 23-Jul-23 0:52am    
can you help me please i can't understand any thing from Razden Official Support
Graeme_Grant 23-Jul-23 1:17am    
They know best, it is THEIR product.
Andre Oosthuizen 23-Jul-23 5:31am    
Quote: i can't understand any thing from Razden Official Support - maybe change to a different product that you can understand.
Graeme_Grant 23-Jul-23 5:38am    
I'm not sure he asked them any questions.
Andre Oosthuizen 23-Jul-23 6:00am    
Nope, because they will not re-write his copied code for him as we do (used to)...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900