Skip to content

ErcanOPAK.com

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

Category: ASP.Net MVC

ASP.Net MVC

Default Settings for Datatable in MVC

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

Read More
ASP.Net MVC

How to assing Selected Value to DropDownList in Asp.Net MVC

- 01.04.20 - ErcanOPAK comment on How to assing Selected Value to DropDownList in Asp.Net MVC

IEnumarable SelectList’s 4th parameter is just for that: @Html.DropDownList(“AuthorID”, new SelectList(Model.Authors, “Id”, “AuthorFullName”, Model.Books.AuthorId), “—Select an Author—“, new { @class = “form-control” })  

Read More
ASP.Net MVC

How to use Html.TextBox for Date in Asp.Net MVC

- 01.04.20 - ErcanOPAK comment on How to use Html.TextBox for Date in Asp.Net MVC

@Html.TextBox(“BookName”, Model.Books.BookName, new { @class = “form-control”, @type = “date” })

Read More
ASP.Net MVC / ASP.Net WebForms / C#

Formatting a Nullable DateTime with ToString() in ASP.Net MVC

- 31.03.20 | 31.03.20 - ErcanOPAK comment on Formatting a Nullable DateTime with ToString() in ASP.Net MVC

Let’s say we have a Nullable DateTime named StartTime [DisplayFormat(DataFormatString = “{0:dd.MM.yyyy}”)] public Nullable<System.DateTime> StartTime { get; set; }

Read More
ASP.Net MVC / Devexpress

How to apply a custom CSS class to Devexpress components

- 30.03.20 - ErcanOPAK comment on How to apply a custom CSS class to Devexpress components

For all the Devex Components, you can use ControlStyle > CssClass property to apply your custom CSS class (Example 1 and 2) or you can do it with parameter (if it is allowed – as in Example 3). Here is 3 examples for MVC: @Html.DevExpress().SpinEditFor(m => m.Books.Rating, settings => { settings.Properties.SpinButtons.ShowIncrementButtons = true; settings.Properties.Increment = […]

Read More
ASP.Net MVC / ASP.Net WebForms / C# / Devexpress

Define a Default Value when insert New Record From ASPxGridView

- 29.03.20 | 29.03.20 - ErcanOPAK comment on 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:

Read More
ASP.Net MVC / ASP.Net WebForms / C#

How to use Stopwatch in C#

- 22.12.19 - ErcanOPAK comment on How to use Stopwatch in C#

The Stopwatch object is often used to measure how long things take. One quick thing to remember here is that it will take the time for everything you do between starting and stopping it, so make sure you only put the actual code you want to time between those.

Read More
ASP.Net MVC / C# / Razor

@helpers in Asp.NET MVC Razor

- 19.11.19 | 27.11.19 - ErcanOPAK comment on @helpers in Asp.NET MVC Razor

A @helper in Razor ultimately defines a function you can invoke from anywhere inside the view. The function can output literal text and can contain code blocks and code expressions. Don’t forget that heavy amounts of code in a view can lead to grief. You have @PluralPick(Model.Count, “child”, “children”). @helper PluralPick(int amount, string singular, string […]

Read More
ASP.Net MVC / ASP.Net WebForms / Devexpress / HTML

How to Solve The ‘Object reference not set to an instance of an object’ error in Batch Edit mode for ASPxGridView

- 01.10.19 | 22.11.19 - ErcanOPAK comment on How to Solve The ‘Object reference not set to an instance of an object’ error in Batch Edit mode for ASPxGridView

The issue occurs in Batch Edit Mode, because in this mode an empty invisible row is created and used for further grid editing. Since the Eval method returns a value type of an object, your attempt to call the ToString() method to the null value can lead to an exception. If you remove this conversion and use <%# […]

Read More
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 […]

Read More
ASP.Net MVC / C#

Using View Model to pass Multiple Models in Single View in MVC

- 22.06.19 | 22.11.19 - ErcanOPAK comment on Using View Model to pass Multiple Models in Single View in MVC

In MVC we cannot pass multiple models from a controller to the single view. There are a few solution for that problem. But in this article we will use View Model. Here is the solution:

Read More
Page 3 of 3
« Previous 1 2 3

Posts navigation

Newer posts
November 2025
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
« Oct    

Most Viewed Posts

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

Recent Posts

  • How to get public ip address using Windows PowerShell
  • How to Reset Taskbar in Windows 11
  • Essential Steps to Take After Windows 11 Updates
  • How to list all tables referencing a table by Foreign Key in MS SQL
  • How to format date in Javascript
  • How to generate a random number for each row in T-SQL
  • How to solve ‘Microsoft.TeamFoundation.Git.Contracts.GitCheckoutConflictException’ problem
  • Why nautical mile equals 1852 mt
  • How to Find Day Name From Date in SQL Server
  • How to make pagination in MS SQL Server

Most Viewed Posts

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

Recent Posts

  • How to get public ip address using Windows PowerShell
  • How to Reset Taskbar in Windows 11
  • Essential Steps to Take After Windows 11 Updates
  • How to list all tables referencing a table by Foreign Key in MS SQL
  • How to format date in Javascript

Social

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