Skip to content

ErcanOPAK.com

  • ASP.Net WebForms
  • ASP.Net MVC
  • C#
  • SQL
  • MySQL
  • PHP
  • Devexpress
  • Reportviewer
  • About

Tag: code

ASP.Net MVC / ASP.Net WebForms / C# / SQL

How to add default value for Entity Framework migrations for DateTime and Bool

- 19.06.22 - ErcanOPAK comment on 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, […]

Continue Reading ..
ASP.Net MVC / Razor

How to put text inside MVC Razor code block

- 20.05.22 - ErcanOPAK comment on How to put text inside MVC Razor code block

The contents of a code block ({ … }) are expected to be code or markup (tags), not plain text. If you want to put text directly in a code block, you have three choices: Wrap it in any HTML tag Wrap it in the special Razor <text> tag, which will just render the text without the […]

Continue Reading ..
C#

How to lock the ciritical code part in C#

- 19.03.22 - ErcanOPAK comment on How to lock the ciritical code part in C#

According to Microsoft: The lock keyword ensures that one thread does not enter a critical section of code while another thread is in the critical section. If another thread tries to enter a locked code, it will wait, block, until the object is released. The lock keyword calls Enter at the start of the block and Exit at the end of the block. lock keyword actually […]

Continue Reading ..
C#

How to run code if not in Debug Mode in C#

- 11.03.20 - ErcanOPAK comment on How to run code if not in Debug Mode in C#

Sometimes you want to run your code only when it is not in debug mode. You can use #IF DEBUG code block for this purpose #if DEBUG LogMail(“It is in debug mode, only add a log record.”) #else SendMail(“It is not in debug mode, so you can send e-mail.”) #endif

Continue Reading ..
MySQL / PHP

mysql_connect() in PHP 7

- 14.09.19 | 22.11.19 - ErcanOPAK comment on mysql_connect() in PHP 7

After upgrading  to  PHP 7.x from PHP 5.x, you start getting  error of “Call to undefined”. This is because mysql_* functions are completely removed from PHP 7, it was get deprecated in PHP 5.5 but now it is completely removed. The older mysql function are removed due to following reasons: Not work on Object Oriented […]

Continue Reading ..
ASP.Net MVC / C# / Razor

Using Code Blocks, Mixing Text & C# Code and Comments in Asp.NET MVC Razor

- 06.08.19 | 22.11.19 - ErcanOPAK comment on Using Code Blocks, Mixing Text & C# Code and Comments in Asp.NET MVC Razor

In Razor you can create blocks of code nearly anywhere using @{ }. A block of code doesn’t emit anything into the output, but you can use the block to manipulate a model, declare variables, and set local properties on a view. Be extremely careful about having too much code in a view, however, because […]

Continue Reading ..
C#

Important Tips To Write Clean Code In C# from Debendra Dash

- 02.02.19 | 22.11.19 - ErcanOPAK comment on Important Tips To Write Clean Code In C# from Debendra Dash

To develop reusable, reliable, readable, well-structured, and maintainable application, we must follow the coding standard. There are several coding practices in the software industry. None of them are good or bad but the main thing is that whatever approach we follow, we should make sure that everyone should follow the same standard.

Continue Reading ..
ASP.Net WebForms / C# / Devexpress

Devexpress ASPxGridview Column Grouping in Code

- 12.06.18 | 30.03.20 - ErcanOPAK comment on Devexpress ASPxGridview Column Grouping in Code

The following code shows how to group by two columns (“Country” and “City”).

Continue Reading ..
C#

Fire Combobox SelectedIndexChanged with button code-behind

- 27.05.18 | 30.08.20 - ErcanOPAK comment on Fire Combobox SelectedIndexChanged with button code-behind

myComboBox_SelectedIndexChanged(myComboBox, new EventArgs()); // or (null, null)

Continue Reading ..
August 2022
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  
« Jul    

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (362)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (234)
  • Find numbers with more than two decimal places in SQL (204)
  • Confirm before process with ASPxButton in Devexpress (200)
  • Add Constraint to SQL Table to ensure email contains @ (200)
  • ASPxGridView – Disable CheckBox based on condition in GridViewCommandColumn (199)
  • How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components (197)
  • How to make some specific word(s) Bold or Underline in ReportViewer (191)
  • Devexpress ASPxGridview Column Grouping in Code (184)
  • Tense Changes When Using Reported Speech (171)

Recent Posts

  • How to create the ShowBlanksValue and ShowNonBlanksValue items in Devex Grid
  • How to get ‘n’th row in Sql Query with OFFSET FETCH NEXT and ROW_NUMBER()
  • How to change the style of scrollbar with CSS
  • How to add scroll bar to div in Asp.Net
  • How to solve “Fatal: Not possible to fast-forward, aborting” problem
  • How to add Output Parameter to SqlDataSource
  • How to get stored procedure parameters details in SQL
  • How to add default value for Entity Framework migrations for DateTime and Bool
  • String Interpolation, String Format, String Concat and String Builder in C#
  • How to get triggers create and update date in SQL

Recent Posts

  • How to create the ShowBlanksValue and ShowNonBlanksValue items in Devex Grid
  • How to get ‘n’th row in Sql Query with OFFSET FETCH NEXT and ROW_NUMBER()
  • How to change the style of scrollbar with CSS
  • How to add scroll bar to div in Asp.Net
  • How to solve “Fatal: Not possible to fast-forward, aborting” problem

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (362)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (234)
  • Find numbers with more than two decimal places in SQL (204)
  • Confirm before process with ASPxButton in Devexpress (200)
  • Add Constraint to SQL Table to ensure email contains @ (200)

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter

© 2022 ErcanOPAK.com

Proudly powered by WordPress | Theme: Xblog Plus by wpthemespace.com