Posts

Showing posts from 2017

server-side pagination with EasyUI (easyui-pagination)

<div class="easyui-panel"> <table id="dg" title="Customer Profile" class="easyui-datagrid" style="width:100%;height:350px" url="CustomerProfile/LoadAllCustomers" toolbar="#toolbar" pagination="FALSE" rownumbers="true" fitcolumns="true" singleselect="true"> <thead> <tr> <th data-options="field:'Id',hidden:true">ID</th> <th data-options="field:'CardNo'">Card No</th> <th data-options="field:'FullName'">Full Name</th> <th data-options="field:'Gender'">Gender</th> <th data-options="field:'Email'">Email</th> <th data-options="field:'M...

Check has value in property c# ternary operator

 isFound.IssueQty = isFound.IssueQty.HasValue ? (isFound.IssueQty + itemIssue.Qty) : itemIssue.Qty;

ASP.NET MVC , Datatables server-side custom paging

Image
By default datatables load all record from database and then use search in client side. but it often cause problem in large data set, to load from database. So i implement custom paging and searching using jqery Bootpag pagination https://codepen.io/SitePoint/pen/jBWOMX  HTML  <div class="col-md-4">         <input type="text" class="form-control" style="float:left;"                 placeholder="Search Style size,Barcode,Product" id="myInputTextField">     </div>      <div class="col-md-12" style="margin-top: -10px;">         <div class="table-responsive" style="margin-top: 0px;">             <table id="dlWarehouseStock" class="display" cellspacing="0" width="100%">        ...

DataTable To Class (Generic) C#

        public static List<T> DataTableToList<T>(DataTable dt) where T : class, new()         {             List<T> lstItems = new List<T>();             if (dt != null && dt.Rows.Count > 0)                 foreach (DataRow row in dt.Rows)                     lstItems.Add(ConvertDataRowToGenericType<T>(row));             else                 lstItems = null;             return lstItems;         }   private static T ConvertDataRowToGenericType<T>(DataRow row) where T : class,new()         {             Type entityType = typeof(T);           ...

Generate class from database table

Set @TableName to the name of your table. declare @TableName sysname = 'TableName' declare @Result varchar ( max ) = 'public class ' + @TableName + ' {' select @Result = @Result + ' public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; } ' from ( select replace ( col . name , ' ' , '_' ) ColumnName , column_id ColumnId , case typ . name when 'bigint' then 'long' when 'binary' then 'byte[]' when 'bit' then 'bool' when 'char' then 'string' when 'date' then 'DateTime' when 'datetime' then 'DateTime' when 'datetime2' then 'DateTime' when 'datetimeoffset' then 'DateTimeOffset' ...