Posts

C# Enum with readable string

public enum MerchantType        {             [Description("Master merchant")]             mastermerchant,             [Description("Merchant")]             merchant,             [Description("Terminal")]             terminal,                         error,         } public static string GetDescription ( this Enum value ) { if ( value == null ) { throw new ArgumentNullException ( "value" ); } string description = value . ToString (); FieldIn...

JQuery checkbox checking

Sometimes Jquery.attr('checked','checked') does not work for many cases. Jquery newest attribute manipulator .prop() can be used as follows checking   $(document).ready(function(){     $('#btn').click(function(){        $('#chk').removeProp('checked');        $('#chk').prop('checked','checked');     });  }); http://jsfiddle.net/yxCnK/

Jquery Validate Plugin

Include ~/Scripts/jquery.validate.js id="formCreate" action="/System/Bin" method="post" novalidate="novalidate">                                 @Resource.Input_Bin                 @Resource.Input_Description                                         name="txtBin"   type="text"  />                                                 ...

UML Tool

Image
There's a free tool for UML diagramming and documenting called Visual Paradigm UML. Community edition is more than enough for everyday modeling practices. http://www.visual-paradigm.com/product/vpuml/provides/?edition=ce Download from http://www.visual-paradigm.com/download/vpuml.jsp?edition=ce

Asp Updatepanel run script on update completed

< script   type = "text/javascript" >              var  prm = Sys.WebForms.PageRequestManager.getInstance();             prm.add_endRequest(EndRequest);              function  EndRequest(sender, args) {                 onPanelLoad(); // things to do             }           </ script >      </ ContentTemplate > </ asp : UpdatePanel >       Ref. http://stackoverflow.com/questions/2985937/asp-net-need-to-run-javascript-on-update-panel-load-completed post by Aristos

Use locale resource in Javascripts

var localResource = '<%= GetLocalResourceObject("LocalResourceKey").ToString() %>' ;     http://keith-wood.name/localisation.html  

Generate Properties from Database Table

-- ============================================= -- Author:        Duminda Piumwardena -- Create date: 10/10/2012 -- Description:    To generate class properties from tables -- =============================================   Alter PROCEDURE GenerateProperties     @tableName varchar(50) AS BEGIN         DECLARE @LINEFEED varchar(10)     SET @LINEFEED = CHAR(13)+CHAR(10)         SELECT '#region Fields'+@LINEFEED     UNION ALL     SELECT 'private '  +              CASE data_type                  WHEN 'bigint'       THEN 'int'      --          WHEN 'binary'       THEN ...