1

I want to load huge amount of base64 string that was bind into image and audio control in kendo grid. But the data cannot load in grid, i try for over 24 rows , that's ok. For over 30 rows , it might not sure to load in grid. How do I solved this problem? Anyone Help !!! I also compress that base64 string , it'not work properly. I want to compress double size of original file size. The use of file types are jpeg, wav, pcm, 3gpp, and 3gp.

Here is my model,

    public byte[] MULTIMEDIANOTEDATA { get; set; }

    public string strMULTIMEDIANOTEDATA { get; set; }

    public string MULTIMEDIANOTEDATA64
    {
        get
        {
            return MULTIMEDIANOTEDATA != null ? Convert.ToBase64String(MULTIMEDIANOTEDATA) : null;
        }
    }

Here is my controller,

    public ActionResult GetNoteItems([DataSourceRequest] DataSourceRequest       request)
    {
        //get models            
        List<NotesModel> Notes = new List<NotesModel>();

        List<NotesModel> lstNotes = (new CitationFactory(Session[Constants.Security.AIConnectionStringSessionVariableName].ToString())).GetNotes();

        foreach (var item in lstNotes)
        {
            Notes.Add(new NotesModel
            {
                NOTEDATE = item.NOTEDATE,
                NOTESMEMO = item.NOTESMEMO,
                MULTIMEDIANOTEDATATYPE = item.MULTIMEDIANOTEDATATYPE.ToString().Replace("\"", ""),
                MULTIMEDIANOTEFILENAME = item.MULTIMEDIANOTEFILENAME,
                MULTIMEDIANOTEDATA = item.MULTIMEDIANOTEDATA,                   
            });
        }

        int total = 0;
        if (Notes.Any())
            total = Notes.Count();

        var result = new DataSourceResult
        {
            Data = Notes,
            Total = total
        };
        var jsonResult = Json(result, JsonRequestBehavior.AllowGet);
        jsonResult.MaxJsonLength = int.MaxValue;           
        return jsonResult;
    }
tereško
  • 58,060
  • 25
  • 98
  • 150
Wint Khet
  • 11
  • 4
  • Is it throwing an exeption or is it simply not doing anything? If you decrease the page size on your kendogrid is it working then? – counterflux Mar 24 '16 at 07:19
  • I decrease the page size on my kendogrid, it'not work yet. :( counterflux – Wint Khet Mar 24 '16 at 08:26
  • the json data you're sending is not over 100k, right? If not then it might be in your binding the Jsondata to your grid? can you show the grid code maybe? – counterflux Mar 24 '16 at 08:48
  • json data is over 100k for image. Yes, I can show , .ClientTemplate("# if (MULTIMEDIANOTEDATATYPE == 'mmPicture') { #" +"" + "# } #" + "# if (MULTIMEDIANOTEDATATYPE == 'mmWaveAudio' || MULTIMEDIANOTEDATATYPE == 'mmNone') { #" + "" + "# } #"); – Wint Khet Mar 24 '16 at 09:03
  • Then I'll redirect you to here: http://stackoverflow.com/questions/10665820/how-to-load-huge-of-data-in-kendo-grid . Good luck solving your problem. ;) – counterflux Mar 24 '16 at 09:10

1 Answers1

0

I found my solution as follows:

In my view:

@(Html.Kendo().Grid<NotesModel>()        
    .DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("GetNoteItems", "Citation")).ServerOperation(true).PageSize(20)
    ))

In my controller:

        int currentPage = request.Page;
        int pageSize = request.PageSize;

        if (currentPage == 1)
        {
            partialNote = Notes.Take(pageSize).ToList();
        }
        else
        {
            partialNote = Notes.Skip(currentPage * pageSize - 20).Take(pageSize).ToList();
        }

I used Skip and Take Linq functions for that, it's fine work for me. Only used pagination internal logic in controller.You can follow this link http://docs.telerik.com/kendo-ui/third-party/tutorials/webforms/asp-net-hello-kendo-ui-part-1#handle-request-parameters

I hope this solution would be better for solving your kendo grid data load paging problem. Good Luck :)

Wint Khet
  • 11
  • 4