Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Category: C#

C#

Null-Conditional (?) and Null-Coalescing (??) Operators in C#

- 04.05.19 | 22.11.19 - ErcanOPAK comment on Null-Conditional (?) and Null-Coalescing (??) Operators in C#

Null coalescing: The null coalescing operator “??” uses two question marks. With it you can use a custom value for a null reference variable. It simplifies null tests. C# program that uses null coalescing operator using System; class Program { static string _name; /// <summary> /// Property with custom value when null. /// </summary> static […]

Read More
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.

Read More
C#

Function with variable number of arguments in C#

- 15.01.19 | 22.11.19 - ErcanOPAK comment on Function with variable number of arguments in C#

By using the params keyword, you can specify a method parameter that takes a variable number of arguments. You can send a comma-separated list of arguments of the type specified in the parameter declaration or an array of arguments of the specified type. You also can send no arguments. If you send no arguments, the length of the params list is […]

Read More
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”).

Read More
ASP.Net WebForms / C#

How to use the second argument of Response.Redirect: True or False

- 11.06.18 - ErcanOPAK comment on How to use the second argument of Response.Redirect: True or False

Response.Redirect(URL, false): The client is redirected to a new page and the current page on the server will keep processing ahead. Response.Redirect(“default.aspx”, false); Response.Redirect(URL, true): The client is redirected to a new page, but the processing of the current page is aborted. Response.Redirect(“default.aspx”, true);

Read More
ASP.Net WebForms / C# / Devexpress

How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components

- 11.06.18 | 22.11.19 - ErcanOPAK comment on How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components

DevExpress.Web.ASPxClasses.ASPxWebControl.RedirectOnCallback(“the_redirect_page.aspx”);

Read More
ASP.Net WebForms / C#

How to use and get HiddenField Value in Gridview

- 11.06.18 | 14.04.20 - ErcanOPAK comment on How to use and get HiddenField Value in Gridview

You can add HiddenField to the Gridview like that:

Read More
ASP.Net WebForms / C#

Display HTPP Headers in C# & ASP.net

- 10.06.18 - ErcanOPAK comment on Display HTPP Headers in C# & ASP.net

using System; using System.Web.UI; using System.Collections.Specialized; public partial class _Default : Page { protected void Page_Load(object sender, EventArgs e) { NameValueCollection headers = base.Request.Headers; for (int i = 0; i < headers.Count; i++) { string key = headers.GetKey(i); string value = headers.Get(i); base.Response.Write(key + ” = ” + value + “<br/>”); } } }

Read More
C#

Change format of the Day with Leading zero In DateTime

- 10.06.18 | 22.11.19 - ErcanOPAK comment on Change format of the Day with Leading zero In DateTime

You can use both methods: DateTime.Now.Day.ToString(“00”); DateTime.Now.ToString(“dd”);

Read More
ASP.Net WebForms / C#

Add blank item at top of dropdownlist

- 10.06.18 - ErcanOPAK comment on Add blank item at top of dropdownlist

drpList.Items.Insert(0, new ListItem(String.Empty, String.Empty)); drpList.SelectedIndex = 0;

Read More
ASP.Net WebForms / C#

Hide GridView Column on server-side

- 03.06.18 | 22.11.19 - ErcanOPAK comment on Hide GridView Column on server-side

protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Cells[index].Visible = false; }

Read More
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)

Read More
Page 14 of 14
« Previous 1 … 9 10 11 12 13 14

Posts pagination

« Previous 1 … 12 13 14
April 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
27282930  
« Mar    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (951)
  • How to add default value for Entity Framework migrations for DateTime and Bool (872)
  • Get the First and Last Word from a String or Sentence in SQL (837)
  • How to select distinct rows in a datatable in C# (806)
  • How to make theater mode the default for Youtube (762)
  • Add Constraint to SQL Table to ensure email contains @ (578)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (564)
  • Average of all values in a column that are not zero in SQL (537)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (492)
  • Find numbers with more than two decimal places in SQL (450)

Recent Posts

  • C#: Use Init-Only Setters for Immutable Objects After Construction
  • C#: Use Expression-Bodied Members for Concise Single-Line Methods
  • C#: Enable Nullable Reference Types to Eliminate Null Reference Exceptions
  • C#: Use Record Types for Immutable Data Objects
  • SQL: Use CTEs for Readable Complex Queries
  • SQL: Use Window Functions for Advanced Analytical Queries
  • .NET Core: Use Background Services for Long-Running Tasks
  • .NET Core: Use Minimal APIs for Lightweight HTTP Services
  • Git: Use Cherry-Pick to Apply Specific Commits Across Branches
  • Git: Use Interactive Rebase to Clean Up Commit History Before Merge

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (951)
  • How to add default value for Entity Framework migrations for DateTime and Bool (872)
  • Get the First and Last Word from a String or Sentence in SQL (837)
  • How to select distinct rows in a datatable in C# (806)
  • How to make theater mode the default for Youtube (762)

Recent Posts

  • C#: Use Init-Only Setters for Immutable Objects After Construction
  • C#: Use Expression-Bodied Members for Concise Single-Line Methods
  • C#: Enable Nullable Reference Types to Eliminate Null Reference Exceptions
  • C#: Use Record Types for Immutable Data Objects
  • SQL: Use CTEs for Readable Complex Queries

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com