Skip to content

ErcanOPAK.com

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

Category: C#

C#

How to Validate a DateTime in C#?

- 03.01.21 - ErcanOPAK comment on How to Validate a DateTime in C#?

DateTime myDate; if(DateTime.TryParse(txtBirthDate.Text, out myDate)) { //Valid Date } else { //Invalid Date }

Continue Reading ..
C#

Convert comma separated string into a List in C#

- 03.01.21 | 03.01.21 - ErcanOPAK comment on Convert comma separated string into a List in C#

string myList = “9,3,12,43,2”; List<int> intList = myList.Split(‘,’).Select(int.Parse).ToList();

Continue Reading ..
C#

Converting a List to a comma separated string in C#

- 03.01.21 - ErcanOPAK comment on Converting a List to a comma separated string in C#

List<int> list = new List<int>() {1,2,3}; string.Join<int>(“,”, list) Join has generic overloads. It is so much easier to use it in that way to convert your list to the different types.

Continue Reading ..
ASP.Net MVC / C#

How to add placeholder to Multiple Selection DropDownList in Asp.Net MVC

- 02.01.21 - ErcanOPAK comment on How to add placeholder to Multiple Selection DropDownList in Asp.Net MVC

@Html.ListBox( “Countries”, ViewBag.AllCountries as MultiSelectList, new { @class = “form-control”, data_placeholder = “Choose a Country…” } )

Continue Reading ..
ASP.Net MVC / C#

Convert List to List in one line in C#

- 08.10.20 - ErcanOPAK comment on Convert List to List in one line in C#

string sNumbers = “1,2,3,4,5”; var numbers = sNumbers.Split(‘,’).Select(Int32.Parse).ToList();

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

Checking multiple contains on one string

- 30.08.20 - ErcanOPAK comment on Checking multiple contains on one string

new[] {“,”, “/”}.Any(input.Contains) or you can use Regex Regex.IsMatch(input, @”[,/]”);

Continue Reading ..
C#

Default Values for Data Types in C#

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

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

Creating Multiline textbox using Html.Helper function in Asp.Net MVC

- 23.07.20 | 23.07.20 - ErcanOPAK comment on Creating Multiline textbox using Html.Helper function in Asp.Net MVC

@Html.TextArea(“Body”, null, new { cols = “55”, rows = “10” }) or

Continue Reading ..
C#

How to split string and get first (or n-th) value only

- 20.07.20 - ErcanOPAK comment on How to split string and get first (or n-th) value only

string myValueToSplit = “Istanbul, Tokyo, Seoul, Bangkok, Bali, Minsk, Belgrade, Kiev”; var theFirstValue = myValueToSplit.Split(‘,’)[0]; //OUTPUT: theFirstValue = “Istanbul” //You can change [0] as you wish. //For example, if you want to get Kiev, make it [7]

Continue Reading ..
Page 1 of 5
1 2 3 … 5 Next ยป

Posts navigation

Older posts
April 2021
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930  
« Jan    

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (243)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (194)
  • How to make some specific word(s) Bold or Underline in ReportViewer (187)
  • How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components (183)
  • Confirm before process with ASPxButton in Devexpress (172)
  • ASPxGridView – Disable CheckBox based on condition in GridViewCommandColumn (170)
  • Find numbers with more than two decimal places in SQL (168)
  • Devexpress ASPxGridview Column Grouping in Code (164)
  • DATEADD Function in SQL (163)
  • Tense Changes When Using Reported Speech (160)

Recent Posts

  • How to check for ‘IS NOT NULL’ And ‘IS NOT EMPTY’ string in SQL
  • How to auto-scroll or manually to end of div when data is added
  • Filter Rows By Max Date in SQL
  • How to Validate a DateTime in C#?
  • Convert comma separated string into a List in C#
  • Converting a List to a comma separated string in C#
  • How to add placeholder to Multiple Selection DropDownList in Asp.Net MVC
  • How to use toFixed() for Float numbers in Javascript
  • Convert List to List in one line in C#
  • How to use column search in datatable when responsive is false

Recent Posts

  • How to check for ‘IS NOT NULL’ And ‘IS NOT EMPTY’ string in SQL
  • How to auto-scroll or manually to end of div when data is added
  • Filter Rows By Max Date in SQL
  • How to Validate a DateTime in C#?
  • Convert comma separated string into a List in C#

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (243)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (194)
  • How to make some specific word(s) Bold or Underline in ReportViewer (187)
  • How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components (183)
  • Confirm before process with ASPxButton in Devexpress (172)

Social

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

powered by XBlog Plus WordPress Theme