When returning a string from a stored procedure as a return parameter, we must set it to a non-null value before the stored proc is called – even if it’s an output-only parameter. So we’ll need to make your parameter have a direction of InputOutput and set a default value: <asp:Parameter Name=”MyReturnParameter” Type=”String” Direction=”InputOutput” DefaultValue=”A […]
Tag: default
How to add default value for Entity Framework migrations for DateTime and Bool
Just add defaultValue parameter in CreateTable method for property: public partial class TestSimpleEntity : DbMigration { public override void Up() { CreateTable( “dbo.SimpleEntities”, c => new { id = c.Long(nullable: false, identity: true), name = c.String(), deleted = c.Boolean(nullable: false, defaultValue: true), }) .PrimaryKey(t => t.id); } public override void Down() { DropTable(“dbo.SimpleEntities”); } } After that, run update-database -verbose command, […]
How to make the default class type ‘public’ instead of ‘internal’ in Visual Studio
VS2012: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class VS2015: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class VS2017(RC): C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class VS2017(Professional): C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class VS2019 (Enterprise): C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class\Class.cs VS2019 (Professional): C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class\Class.cs Starting with Visual Studio 2022 VS is a 64 bit application, meaning the item templates are in C:\Program Files\… instead of C:\Program Files […]
How to make theater mode the default for Youtube
No need for extensions or any third-party software to make Youtube always play video in Theater mode. Go to https://www.youtube.com Open dev tools of the browser you are using (Press F12 or Right-click -> Inspect) Select Console tab Paste below code and Enter: document.cookie = ‘wide=1; expires=’+new Date(‘3099′).toUTCString()+’; path=/’;
Add default value to Devex Grid Columns in C#
protected void grid_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) { e.NewValues[“BirthDate”] = new DateTime(1970, 1, 10); e.NewValues[“Title”] = “Sales Representative”; } Here is the result:
Default Values for Data Types in C#
Table below shows the default value for the different predefined data types. Type Default sbyte, byte, short, ushort, int, uint, long, ulong 0 char ‘\x0000’ float 0.0f double 0.0d decimal 0.0m bool false object null string null As you can see, for the integral value types, the default value is zero. The default value for […]
Default Settings for Datatable in MVC
When working with DataTables over multiple pages it is often useful to set the initialisation defaults to common values (for example you might want to set dom to a common value so all tables get the same layout). This can be done using the $.fn.dataTable.defaults object. This object will take all of the same parameters as the DataTables initialisation […]
Define a Default Value when insert New Record From ASPxGridView
To initialize DataRow’s default values handle InitNewRow event of the required ASPxGridView control and initialize the default values by using e.NewValues dictionary in the following manner:
Constructors and Its Types in C#
Constructor is a special method of the class that is automatically invoked when an instance of the class is created is called a constructor. The main use of constructors is to initialize the private fields of the class while creating an instance for the class. When you have not created a constructor in the class, the compiler […]