Skip to main content

Posts

Configure Visual Studio to Name Private Fields with Underscore

Most C# coding standards recommend using camelCase for local variables and _camelCase for private or internal.  Unfortunately, out of the box Visual Studio just uses camelCase for these fields, which makes typical dependency injection scenarios annoying in constructors: Steps: Click on Tools in the menu. Click on Options. Click on Text Editor. Click on C#. Click on Code Style. Click on Naming. Click on Manage naming styles. In the Naming Style dialog. Specify the following (see image below): Naming Style: _fieldName Required Prefix: _ Capitalization: camel Case Name Once you add it, your list should look like this

Remove Banner in SharePoint Online Modern Page

When we create a new page in SharePoint Online, The title area appears on the top with a banner image and the page title. SharePoint Online doesn’t allow you to save and publish a modern page without its “Title”. If you try to save a page with no title, you’ll get an error popup, “ Could not complete that action: Page title cannot be blank. ” We can use the following PowerShell Script to change the page layout type into a "Home"

Bulk Update Managers of the Azure AD Users using powershell script

In Azure AD we do not have an option to update the Manager of multiple users. Followig PowerShell script can help us to overcome this repetitive task.  First we need to create a 'csv' file with following columns User Manager User column contains the list of User Emails. Manager column will contain the Manager's Email of the respective User. Update the 'csv' file path & run the PowerShell script as Administrator.

Restore SQL Server backup into Docker Container

sql1 is the SQL Server instance name   These commands will copy the ".bak" file into "/var/opt/mssql/backup" directory. You can use the "Restore Database" option in the SQL Server Management Studio to restore the database

Windows 10: PowerShell to Assign Drive Letters

If a drive is missing on your device, it could be a letter assignment issue. Follow the steps below to using PowerShell to quickly assign a new letter. Step 1 Search for Windows PowerShell in the start menu, right-click the result, and select Run as administrator. Step 2 Run the following command to get the disk information Get-Disk Step 3 Run the following command to get the partition information Get-Partition -DiskNumber 1 Step 4 Run the following command to assign the drive letter Get-Partition -DiskNumber 1 -PartitionNumber 2 | Set-Partition -NewDriveLetter Z In the above command, replace the following; 1 with the Drive Number you want to assign letters 2 with the Partition Number you want to assign letter Z with the Drive Letter you want to assign Once you’ve completed the steps, the hard drive will now appear in File Explorer.

SharePoint Online: PowerShell to Change Page Layout

Single part app pages provide the capability to host SharePoint Framework web parts or Teams applications in SharePoint Online with a locked layout.  Pros: Single Part App Pages cannot be edited by end-users using a browser It will take the entire width & Header banner area Cons: Currently supports hosting only a single web part or Microsoft Teams application Developers can change page layout programmatically from normal page layout to a Single Page App Page To deploy the Single Web Part App Page in your tenant follow the next steps: Install PowerShell Gallery Open PowerShell as Administrator & run the following command Update Page Template Change the "About-Us.aspx" to the name of the page you want to update Before After Happy Coding...

Dynamically create Bar Chart using Chart.js in Asp.net

This article explains about Bar Chart. We are going to create a simple Bar Chart using char.js library in jQuery. Bar Chart can be used to show data or compare multiple data sets. Chart.js : A Simple chart library for developers developed by Nick Downie . It uses HTML5 canvas element and supports all the browsers.  Code Snippet Code Behind Finally, we are done with coding. You can bind a real dataset from the code behind and see the output Happy Coding :)

jQuery Dialog for ASP.NET

A jQuery dialog is a lightweight pop-up which can be used in ASP.NET to get the confirmation from the user before doing some task. Here I shall demonstrate how to work with jQuery dialog in ASP.NET. First of all we need to import the jQuery core and UI libraries in the head section of the master page Then add the jQuery dialog to the page Now we will design the popup and the buttons Code behind Happy Coding :)

How To Setup a USB Flash Drive to Install Windows 7, 8

If you are going to install windows from USB Flash drive, you'll need a USB Flash drive with a minimum capacity of 4GB and an ISO image of the Windows version you are going to install.  Format your USB Flash drive Download and install  Windows 7 USB/DVD Download Tool Locate the ISO image of windows Select USB device Choose your flash drive and click Begin copying The process may take little time to complete After the copying is finished, you can see the files on the flash drive as you would if you opened the installation disc. Now you can start the installation on any computer that allows you to boot from a USB drive. Update (2015/08/13) This method works with all variations of windows 10.

Method Overriding with C#

Method overriding is a feature that allows you to invoke functions (that have the same signatures) that belong to different classes in the same hierarchy of inheritance. Let's understand method overriding using few examples. Output Above code consists of base class A and a derived class B. Class A consists of method Show(). Class B hides the function Show() it inherited from the base class A by providing its on implementation of Show(). In the above code we first created object of type A. Using the reference variable “a” we invoke the function Show(). As expected,  Show() of class A is executed because the reference variable “a” refers to the object of class A. Then we created an object of Derived class B and storing its reference in the reference variable “a” of type A. Using the reference variable “a” we invoke the function Show(). Since “a” contains a reference to an object of type B we would expect the function Show() of class B to get executed. But that do...

Make sure "AjaxControlToolkit.Properties.Resources.NET4.resources" was correctly embedded or linked

Error Message Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "AjaxControlToolkit.Properties.Resources.NET4.resources" was correctly embedded or linked into assembly "AjaxControlToolkit" at compile time, or that all the satellite assemblies required are loadable and fully signed. Reason AjaxControlToolkit’s control load reference refers to the base System.Web.UI.Control method which is present as a part of the ASP.NET AJAX Libraries and those libraries are referenced only when the ScriptManager is referenced in the page. Solution Add ScriptManager in the page

Validating DropDownList using RequiredFieldValidator

In ASP.NET we need to validate DropDownList controls. But validating the DropDownList control with RequiredFieldValidator is not a straight forward as validating a TextBox control with RequiredFieldValidator. It requires little extra work. Following are the steps for validating a  DropDownList  with  RequiredFieldValidator Step 1: Create a DropDownList control 1: < asp:DropDownList ID ="ddlFruit" runat ="server" Height ="22px" Width ="200px" > 2: < asp:ListItem > - Select - </ asp:ListItem > 3: < asp:ListItem > Apple </ asp:ListItem > 4: < asp:ListItem > Orange </ asp:ListItem > 5: < asp:ListItem > Banana </ asp:ListItem > 6: < asp:ListItem > Pineapple </ asp:ListItem > 7: </ asp:DropDownList > Step 2: Add a RequiredFieldValidator 1: < asp:RequiredFieldValidator ID ="rfvFruit" runat =...

Get the BIOS Serial Number with C#

Fisrt you have to import the following referenece in to your project. System.Management Sample Code 1: using System; 2: using System.Management; 3: using System.Windows.Forms; 4:   5: namespace DemoProjects 6: { 7: public partial class frmBIOSSerial : Form 8: { 9: public frmBIOSSerial() 10: { 11: InitializeComponent(); 12: } 13:   14: private void btnGet_Click( object sender, EventArgs e) 15: { 16: string serialNumber = string .Empty; 17:   18: ManagementObjectSearcher MOS = new ManagementObjectSearcher( " Select * From Win32_BIOS " ); 19: foreach (ManagementObject getserial in MOS.Get()) 20: { 21: serialNumber = getserial[ "SerialNumber" ].ToString(); 22: } 23:   24: lblSerialNumber.Text = serial...