Postări

Se afișează postări cu eticheta C#

Links !

Matematica: https://www.cymath.com Coding game: https://www.codingame.com/start https://codefights.com/

Fast POCO Class direct from SQL Management Studio

Create fast POCO class from SqlServer with this. Sweet! declare @TableName sysname = 'MyTableName' 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'          ...

Logging part I

Welcome to logging part I Recently I had a nasty error in production on an asp.net web site application that gave me an error only on one page :) So because this was on production and I was in a very big harry I had to do something fast. The only thing I could think of was to add on the fly ( because it is a web site project each page was compiled at access time - yes the project did not have a global error handler - we'll get there ) I added on the page this: void Page_Error(object sender, EventArgs e) { System.IO.File.WriteAllText(@"C:\Dev\ErrorLog.txt", Server.GetLastError().ToString()); } On the next publish (web site) just put the Global.asax file in the project either add the file with File / Add New and search global application in search and chose Global.asax file. In the appropriate Application_Error section say: public static void InsertText ( string path , string newText ) { if ( File . Exists ( path )) { st...

Asp.net TextBox - placeholder I

For sure You wanted to put a placeholder inside a textbox in asp.net and it is quite simple all you have to do is say:  placeholder="enter the text here"  inside the textbox tag like so: In the next version of this post I will show how to add the placeholder tag in an extended textbox control.

Creating date time picker control for asp.net

Imagine
This is a very simple control to create and to have with very cool results. Create a user control and just paste in the code: Code snipet: ASCX: < link href ="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel ="stylesheet"> < link rel ="stylesheet" type ="text/css" media ="screen" href ="//tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css"> <% -- -- %> < script type ="text/javascript" src ="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></ script > < script type ="text/javascript" src ="//tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js"></ script > < script type ="text/javascript" src ="//tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-date...