@manhng

Welcome to my blog!

DataTables Export Excel JavaScript + EPPlus Excel Format

December 24, 2019 20:41

DataTables Export Excel JavaScript (edit)

http://live.datatables.net/yifojova/2/edit

https://www.datatables.net/download/nightly

EPPlus Report

http://zeeshanumardotnet.blogspot.com/2011/06/creating-reports-in-excel-2007-using.html

EPPlus Samples Code

https://github.com/JanKallman/EPPlus/tree/master/SampleApp

https://www.c-sharpcorner.com/blogs/how-to-format-excel-table-using-epplus-net-library-c-sharp-part-fifteen (HAY)

EPPlus Ignore Excel Warning

https://stackoverflow.com/questions/26483496/is-it-possible-to-ignore-excel-warnings-when-generating-spreadsheets-using-epplu/

https://stackoverflow.com/questions/26483496/is-it-possible-to-ignore-excel-warnings-when-generating-spreadsheets-using-epplu/26484880#26484880

https://support.office.com/en-gb/article/block-or-unblock-external-content-in-office-documents-10204ae0-0621-411f-b0d6-575b0847a795

EPPlus Excel Format

https://github.com/JanKallman/EPPlus/wiki/Formatting-and-styling

https://www.c-sharpcorner.com/blogs/how-to-apply-cell-text-background-color-in-excel-sheet-using-epplus

EPPlus Excel Format

https://www.codeproject.com/Articles/1194712/Advanced-Excels-With-EPPlus

https://www.c-sharpcorner.com/blogs/how-to-format-excel-table-using-epplus-net-library-c-sharp-part-fifteen

https://riptutorial.com/epplus/topic/8219/styling-the-excel-document

EPPlus Example

using (var xlsx = File.Create("Text.xlsx"))
        using (var pkg = new ExcelPackage())
        {
            var ws = pkg.Workbook.Worksheets.Add("Sheet1");
            var r = 0;
            ws.Cells[++r, 1].Value = "Values";
            ws.Cells[++r, 1].Value = 1171.2;
            ws.Cells[++r, 1].Value = 1.1;
            ws.Cells[++r, 1].Value = 1.2;
            ws.Cells[++r, 1].Value = 1.3;
            ws.Column(1).Style.Numberformat.Format = "General";   // Default
            //ws.Column(1).Style.Numberformat.Format = "0.00";    // Numeric with fixed decimals
            //ws.Column(1).Style.Numberformat.Format = "@";       // Text
            pkg.SaveAs(xlsx);
        }

Text Format

https://riptutorial.com/epplus/example/27222/text-format

Number Format

https://riptutorial.com/epplus/example/26056/number-formatting

DateTime Format

https://riptutorial.com/epplus/example/26058/date-formatting

DataTable to Excel using EPPlus

var ws = MainExcel.Workbook.Worksheets.First();
 DataTable tbl = new DataTable();
 for (var rowNum = 1; rowNum <= ws.Dimension.End.Row; rowNum++)      
 {
     var wsRow = ws.Cells[rowNum, 1, rowNum, ws.Dimension.End.Column];
     var array = wsRow.Value as object[,];

     var row = tbl.NewRow();
     int hhh =0;

     foreach (var cell in wsRow)
          {
           cell.Style.Numberformat.Format = "@";
           row[cell.Start.Column - 1] = cell.Text;
          }
     tbl.Rows.Add(row);
 }

Range

using (var range = worksheet.Cells[1, 1, 1, 5])  //Address "A1:A5"
{
    range.Style.Font.Bold = true;
    range.Style.Fill.PatternType = ExcelFillStyle.Solid;
    range.Style.Fill.BackgroundColor.SetColor(Color.DarkBlue);
    range.Style.Font.Color.SetColor(Color.White);
}

Number format

worksheet.Cells["A1:B3,D1:E57"].Style.NumberFormat.Format = "#,##0"; //Sets the numberformat for a range containing two addresses.
worksheet.Cells["C2:C5"].Style.Numberformat.Format = "#,##0";

Font

worksheet.Cells["A:B"].Style.Font.Bold = true; //Sets font-bold to true for column A & B
worksheet.Cells["1:1,A:A,C3"].Style.Font.Bold = true; //Sets font-bold to true for row 1,column A and cell C3
worksheet.Cells["A:XFD"].Style.Font.Name = "Arial"; //Sets font to Arial for all cells in a worksheet.

DateTime format

ws.Column(1).Style.Numberformat.Format  = "yyyy-mm-dd"; 
//OR "yyyy-mm-dd h:mm" if you want to include the time!

Border thin

https://www.c-sharpcorner.com/blogs/how-to-apply-cell-border-style-on-excel-sheet-using-epplus-net-application-c-sharp-part3

Background Color

//Sets the background color for the selected range (default is A1).
//A range is selected using the by using the worksheet.Select method
worksheet.Cells.Style.Fill.PatternType = ExcelFillStyle.Solid;
worksheet.Cells.Style.Fill.BackgroundColor.SetColor(Color.LightGreen);

jQuery DataTables

June 28, 2019 22:37

jQuery DataTables (edit)

  <!-- DataTables CSS -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<!-- jQuery -->
<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-1.12.4.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>

https://www.datatables.net/examples/ajax/

https://www.gyrocode.com/articles/tag/jquery-datatables/

https://gallery.technet.microsoft.com/scriptcenter/Server-Side-Paging-Sorting-4cd29194

How to modify your JSON returned objects before sending them to the tables using DataTables.js

https://medium.com/code-kings/datatables-js-how-to-modify-your-returned-ajax-json-data-before-sending-it-to-your-html-table-24a92244bc40

Ajax Loading Indicator:

$(document).ajaxStart(function () {
    Pace.restart()
})

$.ajaxStart in AdminLTE

https://loading.io/spinner/

https://adminlte.io/themes/AdminLTE/pages/examples/pace.html

https://stackoverflow.com/questions/11961438/implement-a-loading-indicator-for-a-jquery-ajax-call

https://stackoverflow.com/questions/4355268/how-to-display-a-busy-indicator-with-jquery

http://jsfiddle.net/sd01fdcm/

http://jsfiddle.net/VpDUG/4952/

https://snippets.aktagon.com/snippets/204-How-to-display-an-animated-icon-during-Ajax-request-processing

jQuery DataTables for Beginner

https://www.codeproject.com/Tips/844403/jQuery-Datatables-For-Beginners

DYNAMIC COLUMN HEADER AND RESULT FROM AJAX CALL IN JQUERY DATATABLE (HAY HAY HAY - GOOD FOR CREATE PROTOTYPE)

https://blog.pheonixsolutions.com/dynamic-column-header-result-ajax-call-jquery-datatable/

jQuery DataTables - Dynamic Columns and Records (HAY)

https://www.codeproject.com/Articles/1256759/jQuery-DataTable-Integration-Dynamic-columns-and-r

JQuery Datatable (Dynamic columns) populate after Ajax JSON response via server side processing - Using EF Raw SQL query

Logic/Idea: How to Dynamically Bind Jquery DataTables Using Anonymous JSON Result?

Pie Chart using ChartJS

https://codepedia.info/chartjs-asp-net-create-pie-chart-with-database-calling-jquery-ajax-c/

Column Chart - ASP.NET MVC 5

http://www.aspmantra.com/2016/11/how-to-create-chart-with-database-data-mvc-asp.net.html

Export to Excel using NPOI

https://errorhub.blogspot.com/2012/01/export-adonet-datatable-to-excel-using.html

ASHX - Generic Handler

https://codepedia.info/generic-handler-ashx-file-post-send-json-data-parameters-in-asp-net-c-jquery/

Dropzone js

https://codepedia.info/using-dropzone-js-file-image-upload-in-asp-net-webform-c/

jQuery DataTables + Checkboxes

https://www.gyrocode.com/articles/jquery-datatables-checkboxes/

jQuery - Knowledge Based (HAY HAY HAY)

https://codepedia.info/jquery-get-table-cell-td-value-div/

How to show column searching select inputs at the top of the table header?

https://forums.asp.net/t/2138097.aspx?How+to+show+Jquery+Datatable+Individual+column+searching+select+inputs+at+the+top+of+the+table+header

jQuery DataTables With Server Side Data

https://www.c-sharpcorner.com/article/jquery-datatable-with-server-side-data/

Display Data In ASP.NET Using jQuery DataTables Plugin - ASP.NET

https://www.c-sharpcorner.com/article/display-data-in-Asp-Net-using-jquery-datatables-plugin/

How dynamically change column title

table = $('#example').DataTable({...});

$
(table.column(1).header()).text('My title');

Sample

https://makitweb.com/datatables-ajax-pagination-with-custom-filter-in-codeigniter/

$(document).ready(function (){
var table = $('#example').DataTable({
ajax: {
url: 'https://api.myjson.com/bins/if7vf',
dataSrc: function(d){
if(d.data.length === 0){
var settings = $('#example').DataTable().settings()[0];
settings.oLanguage.sEmptyTable = d.message;
}

return d.data;
}
}
});
});

https://jsfiddle.net/fj5629sx/

<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>

See returned data from Ajax

var table = $("#myTable").DataTable({
    "ajax": {
        "url": "/api/Search",
        "type": "POST",

// I added this section. It is called before the success callback // You will have to figure out your parsing at this point because // each configuration is different so I just put how mine is.
dataFilter: function(response){ var tempData = JSON.parse(response);
return response; } }, "processing": true, "serverSide": true, "columns": [ { "data": "id" }, { "data": "job_id" }, { "data": "type" }, { "data": "connection_id" }, { "data": "company_id" }, { "data": "message" }, { "data": "total_completion_time" }, { "data": "date" }, { "data": "start_time" }, { "data": "end_time" }, { "data": "error_time" } ], "info": false, "searching": false, "bLengthChange": false });

https://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Part

https://www.codeproject.com/Articles/165410/ASP-NET-MVC-Editable-DataTable-jQuery-DataTables-a

https://stackoverflow.com/questions/44002822/how-to-refresh-datatables-plug-in-for-jquery

https://datatellblog.wordpress.com/2015/08/01/server-side-paging-with-datatables-net-and-mvc/

http://www.cyqdata.com/cnblogs/article-detail-35087-english

https://social.technet.microsoft.com/wiki/contents/articles/39961.beginners-guide-to-implement-ajax-crud-operations-using-jquery-datatables-in-asp-net-mvc-5.aspx?Sort=MostRecent&PageIndex=1

https://www.c-sharpcorner.com/article/using-datatables-grid-with-asp-net-mvc/

https://www.codeproject.com/Articles/177335/Refreshing-content-of-the-table-using-AJAX-in-ASP

https://www.c-sharpcorner.com/article/ajax-crud-operation-with-jquery-datatables-in-asp-net-mvc-5-for-beginners/

https://www.codaffection.com/asp-net-mvc-tutorial/asp-net-mvc-with-jquery-ajax/

https://datatables.net/forums/discussion/25012/having-trouble-getting-ajax-to-work

https://datatables.net/examples/server_side/defer_loading.html

https://www.linkedin.com/pulse/beginners-guide-ajax-crud-using-jquery-datatables-aspnet-ehsan-sajjad

http://developmentpassion.blogspot.com/2017/06/ajax-crud-in-grid-using-jquery.html

https://clip-share.net/rev/asp+net+mvc+tutorial+for+beginners+with+bootstrap+and+jquery/

Email: technotipstutorial@gmail.com

dataTables

March 11, 2018 02:15

jQuery DataTables

https://datatables.net/examples/server_side/

https://datatables.net/examples/server_side/post.html

https://editor.datatables.net/examples/simple/server-side-processing.html

Web.config

https://stackoverflow.com/questions/11636386/how-to-configure-the-web-config-to-allow-requests-of-any-length

  • ASP.NET Runtime : These limits are lifted using the httpRuntime node and its associated attributes
  • IIS Requests Filtering module : IIS also applies its own filtering rules regarding URL and Query String length, even before the request is processed by the ASP.NET Runtime. By default, the maximum allowed length for a query string is 2048 (see here). You should set the appropriate values in your Web.config, under the requestLimits subnodes, eg :

    <system.webServer>
      <security>
        <requestFiltering>
          <requestLimits maxQueryString="4096"/>
        </requestFiltering>
      </security>
    </system.webServer>

jQuery DataTables Service Side Processing (HAY)

https://www.codeproject.com/Tips/1011531/Using-jQuery-DataTables-with-Server-Side-Processin

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <security>
        <requestFiltering>
            <requestLimits maxQueryString="32768"/>
        </requestFiltering>
    </security>

https://datatables.net/media/blog/beautiful_tables/complete.html

https://world.episerver.com/documentation/upgrading/Episerver-CMS/8/upgrading-from-mvc-4-to-5/

https://docs.microsoft.com/en-us/aspnet/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2

  • Javascript
  • HTML
  • CSS
  • Ajax
  • Server-side script

jQuery DataTables

https://editor.datatables.net/examples/advanced/jsonId.html

jQuery DataTables for Beginners

https://www.codeproject.com/Tips/844403/jQuery-Datatables-For-Beginners

CSS for jQuery DataTables

https://datatables.net/forums/discussion/39890/passing-parameters-to-column-render-function

http://jsfiddle.net/jasonblewis/u9en604m/

http://jsfiddle.net/jasonblewis/u9en604m/4/

https://stackoverflow.com/questions/41982049/jquery-datatables-render-column-data

Ajax CRUD Operations with Grid using JQuery DataTables in ASP.NET MVC 5

https://code.msdn.microsoft.com/Implement-Ajax-CRUD-a543a978

https://gallery.technet.microsoft.com/Ajax-CRUD-Operations-with-d005e974

AJAX CRUD in GridView using JQuery DataTables in ASP.NET MVC 5

Ajax server paging, searching with jQuery DataTables

http://developmentpassion.blogspot.com/2017/06/ajax-crud-in-grid-using-jquery.html

https://www.c-sharpcorner.com/article/crud-operations-in-mvc-using-entity-framework-with-ajax-call-jquery-and-all-val/

https://www.c-sharpcorner.com/article/using-jquery-datatables-grid-with-asp-net-core-mvc/

http://www.webslesson.info/2017/01/php-pdo-ajax-crud-with-data-tables-and-bootstrap-modals.html

CRUD, Upload Image

https://phppot.com/php/twitter-like-profile-image-upload-using-jquery-ajax/

Upload files

https://phppot.com/php/pause-resume-file-upload-using-javascript/

https://phppot.com/php/multiple-file-upload-using-fine-uploader/

Demo

https://phppot.com/demo/multiple-file-upload-using-fineuploader/

ASP.NET

https://docs.microsoft.com/en-us/aspnet/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/display_data_items_and_details

Categories

Recent posts