Monday, December 15, 2014

kendo ui datetimepicker to C# converting value

Get value

 entity.ExpiredDate = ParseDate(model.ExpiredDate);  
 private static DateTime ParseDate(string input)  
       return DateTime.ParseExact(input, formats, CultureInfo.InvariantCulture, DateTimeStyles.None);  
  private static string[] formats = new string[]  
     "MM/dd/yyyy HH:mm:ss tt",  
     "MM/dd/yyyy HH:mm:ss",  
     "M/dd/yyyy H:mm:ss tt",  
     "M/dd/yyyy H:mm:ss"  ,  
     "MM/dd/yyyy hh:mm tt"  

Set Value

 viewModel.ExpiredDate = entity.ExpiredDate.ToString("MM/dd/yyyy hh:mm tt", CultureInfo.InvariantCulture);       

C# print file on LAN Printer

If you want to print any file on network printer then you can try with this code block // Change Default Printer System.Ma...