Skip to content

ErcanOPAK.com

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

Category: ASP.Net WebForms

ASP.Net MVC / ASP.Net WebForms / Bootstrap / CSS

How to add some content to the right side of CardHeader on Bootstrap

- 21.06.23 | 21.06.23 - ErcanOPAK comment on How to add some content to the right side of CardHeader on Bootstrap

<div class=”card-header container-fluid”> <div class=”col-md-10″><h3>Your Header Title</h3></div> <div class=”col-md-2 float-right”>The content you want to add to the right side.</div> </div>  

Read More
ASP.Net MVC / ASP.Net WebForms / Bootstrap / JavaScript

How to change star rating color on mouseover/out, mouseenter/leave with Javascript

- 20.06.23 - ErcanOPAK comment on How to change star rating color on mouseover/out, mouseenter/leave with Javascript

function onMouseEnter(index){ var star = document.getElementsByClassName(“starClass”); var j; for(j = 0; j < fa.length; j++){ if(j < index){ star[j].style.color = “orange”; } else{ star[j].style.color = “#ccc”; } } } function onMouseOut(){ var star = document.getElementsByClassName(“starClass”); var k; for(k = 0; k < fa.length; k++){ star[k].style.color = “#ccc”; } }

Read More
ASP.Net MVC / ASP.Net WebForms

How to check if javascript is enabled on the client’s browser

- 13.01.23 | 13.01.23 - ErcanOPAK comment on How to check if javascript is enabled on the client’s browser

The noscript element represents nothing if scripting is enabled, and represents its children if scripting is disabled. It is used to present different markup to user agents that support scripting and those that don’t support scripting, by affecting how the document is parsed. <script type=”text/javascript”> //If javascript enabled then this part will work. //Your javascript code here… </script> <noscript>JavaScript disabled on your […]

Read More
ASP.Net MVC / ASP.Net WebForms / JavaScript

How to disable ASP.Net button after click to prevent double clicking

- 13.01.23 | 20.03.23 - ErcanOPAK comment on How to disable ASP.Net button after click to prevent double clicking

Let’s say you have 2 buttons on your web page. <form id=”form1″ runat=”server”> <asp:Button ID=”Button1″ runat=”server” Text=”Button1″ OnClick=”Button1_Clicked” /> <asp:Button ID=”Button2″ runat=”server” Text=”Button2″ /> </form> Scenario 1: Disabling the specific button <script type=”text/javascript”> function DisableButton() { document.getElementById(“<%=Button1.ClientID %>”).disabled = true; } window.onbeforeunload = DisableButton; </script> The DisableButton JavaScript function is used for disabling specific Button when Clicked. […]

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

How to align inconsistently sized logos with CSS

- 04.12.22 | 04.12.22 - ErcanOPAK comment on How to align inconsistently sized logos with CSS

These 3 lines will save you (fit, line up, remove background): aspect-ratio: 3/2; object-fit: contain; mix-blend-mode:color-burn; Let’s see how you can use that: In the body section, we have a div with the “photoDiv” class. <div class=”photoDiv”> <img src=”1.png”> <img src=”2.png”> <img src=”3.png”> <img src=”4.png”> <img src=”5.png”> </div> And here is the magical CSS: <style> […]

Read More
ASP.Net WebForms

How to get output return value from SqlDataSource in WebForms

- 14.11.22 - ErcanOPAK comment on How to get output return value from SqlDataSource in WebForms

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

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

How to use client-side function on checkbox or any asp.net component

- 10.11.22 - ErcanOPAK comment on How to use client-side function on checkbox or any asp.net component

Here is the Asp part: <label for=”chkCondition”> <asp:CheckBox ID=”chkCondition” Text=”Should i show the div?” runat=”server” onclick=”ShowHideDiv(this)” /> </label> <hr /> <div id=”divToShowOrHide” style=”display: none”> this div will be shown regarding the checkbox checked status. <asp:TextBox ID=”myTextBox” runat=”server” /> </div> And here is the Javascript part: <script type=”text/javascript”> function ShowHideDiv(chkCondition) { var divToShowOrHide = document.getElementById(“divToShowOrHide”); divToShowOrHide.style.display […]

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

How to apply two classes to a single element in CSS

- 15.09.22 - ErcanOPAK comment on How to apply two classes to a single element in CSS

Let’s say you want to use 2 or more classes for a div. Then you should use these classes inside the class attribute, separated by whitespace: <div class=”myFirstClass mySecondClass”></div> To target elements that contain all of the specified classes, use this CSS selector (no space) in your CSS file: .myFirstClass.mySecondClass {}  

Read More
ASP.Net WebForms / C# / Devexpress

How to create the ShowBlanksValue and ShowNonBlanksValue items in Devex Grid

- 04.08.22 - ErcanOPAK comment on How to create the ShowBlanksValue and ShowNonBlanksValue items in Devex Grid

By design, GridViewDataComboBoxColumn does not render (Blank) and (NonBlank) items if the HeaderFilterMode property is set to CheckedList. However, you can add these items in the HeaderFilterFillItems event handler. Just call the FilterValue.CreateShowBlanksValue and FilterValue.CreateShowNonBlanksValue methods. <dx:ASPxGridView ID=”grid” runat=”server” AutoGenerateColumns=”False” DataSourceID=”dsCategories” KeyFieldName=”CategoryID” OnHeaderFilterFillItems=”grid_HeaderFilterFillItems”> <Columns> <dx:GridViewDataTextColumn FieldName=”CategoryID”> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName=”Description”> </dx:GridViewDataTextColumn> <dx:GridViewDataComboBoxColumn FieldName=”CategoryNameNull” Caption=”Category Name”> <Settings HeaderFilterMode=”CheckedList” /> <PropertiesComboBox DataSourceID=”dsCategories” ValueField=”CategoryNameNull” TextField=”CategoryNameNull” /> </dx:GridViewDataComboBoxColumn> </Columns> […]

Read More
ASP.Net MVC / ASP.Net WebForms / CSS

How to change the style of scrollbar with CSS

- 03.07.22 - ErcanOPAK comment on How to change the style of scrollbar with CSS

::-webkit-scrollbar { width: 12px; } ::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); border-radius: 10px; } ::-webkit-scrollbar-thumb { border-radius: 10px; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); } You can get more detail from here.

Read More
ASP.Net MVC / ASP.Net WebForms / CSS

How to add scroll bar to div in Asp.Net

- 03.07.22 - ErcanOPAK comment on How to add scroll bar to div in Asp.Net

Let’s say we have div in view <div id=”myDiv” class=”div-with-scrollbar”> </div> With this CSS file, you can add a scrollbar .div-with-scrollbar { overflow-y: scroll; width: 100%; height: 500px; }  

Read More
ASP.Net MVC / ASP.Net WebForms

How to add Output Parameter to SqlDataSource

- 24.06.22 - ErcanOPAK comment on How to add Output Parameter to SqlDataSource

<asp:Parameter Name=”NewID” Direction=”Output” Type=”Int32″ DefaultValue=”0″ /> Here is a more detailed example in use: <asp:sqlDataSource ID=”EmployeeDetailsSqlDataSource” SelectCommand=”SELECT EmployeeID, LastName, FirstName FROM Employees WHERE EmployeeID = @EmpID” InsertCommand=”INSERT INTO Employees(LastName, FirstName) VALUES (@LastName, @FirstName); SELECT @EmpID = SCOPE_IDENTITY()” UpdateCommand=”UPDATE Employees SET LastName=@LastName, FirstName=@FirstName WHERE EmployeeID=@EmployeeID” DeleteCommand=”DELETE Employees WHERE EmployeeID=@EmployeeID” ConnectionString=”<%$ ConnectionStrings:NorthwindConnection %>” OnInserted=”EmployeeDetailsSqlDataSource_OnInserted” RunAt=”server”> <SelectParameters> <asp:Parameter […]

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

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

How to get the integrity value for a jquery version of script reference in a web page

- 26.04.22 - ErcanOPAK comment on How to get the integrity value for a jquery version of script reference in a web page

You can use https://www.srihash.org/ to generate links. https://code.jquery.com/jquery-3.6.0.min.js will be generated as <script src=”https://code.jquery.com/jquery-3.6.0.min.js” integrity=”sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==” crossorigin=”anonymous”></script> You can get all the versions of jquery from here: https://releases.jquery.com/jquery/ Thanks to mscdeveloper for such great post.

Read More
ASP.Net MVC / ASP.Net WebForms / JavaScript

How to get session value in Javascript

- 16.04.22 - ErcanOPAK comment on How to get session value in Javascript

<script> let mySession = ‘<%= Session[“SessionName”].ToString() %>’; //use your session … console.log(mySession); alert(mySession); </script>  

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

How to get value from resx file in C#

- 26.03.22 - ErcanOPAK comment on How to get value from resx file in C#

// Gets the value of associated with key “MyKey” from the local resource file (“~/MyPage.aspx.en.resx”) or from the default one (“~/MyPage.aspx.resx”) //The default location for resx files is App_LocalResources object keyValue = HttpContext.GetLocalResourceObject(“~/MyPage.aspx”, “MyKey”);

Read More
ASP.Net MVC / ASP.Net WebForms / Razor

How to insert space in Razor Asp.Net

- 09.01.22 - ErcanOPAK comment on How to insert space in Razor Asp.Net

@if (condition) { <text>&nbsp;</text> @:&nbsp; }  

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

Search text through Divs in Javascript

- 29.12.21 - ErcanOPAK comment on Search text through Divs in Javascript

<table align=”center” width=”20%”> <tr> <td style=”padding-right: 10px”> <input type=”text” id=”Search” onkeyup=”myFunction()” placeholder=”Please enter a search term..” title=”Type in a name”> </td> </tr> </table> <br> <div class=”target”> This is my DIV element. </div> <div class=”target”> This is another Div element. </div> <div class=”target”> Can you find me? </div> <script> function myFunction() { var input = document.getElementById(“Search”); […]

Read More
Page 1 of 3
1 2 3 Next »

Posts navigation

Older 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 (794)
  • How to select distinct rows in a datatable in C# (767)
  • How to add default value for Entity Framework migrations for DateTime and Bool (763)
  • How to make theater mode the default for Youtube (559)
  • 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 (794)
  • How to select distinct rows in a datatable in C# (767)
  • How to add default value for Entity Framework migrations for DateTime and Bool (763)
  • How to make theater mode the default for Youtube (559)

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