Monthly Archives: January 2014

MVC3: Dynamically set row background color in a MVC WebGrid

The idea is to inject invisible div or hidden field with color value in the row which is supposed to be featured with specific class name.

 grid.Column("CompanyName", header: "Name", style: "name",
			format: (item) => new MvcHtmlString
				"<input type='hidden' class='color' value='#e0cca9' />" +
				"<input type='hidden' class='color' value='' />" +

Then on document load, grid reload, any form submission call JavaScript

function SetFeaturedRow() {
	$('.webgrid .color').each(function (index, element) {
		$(element).parent().parent().css('background-color', $(element).val());

Start or Stop MS SQL Server using a shortcut

  • Create a new shortcut.
  • When it asks you to browse or specify the location of what you want the shortcut to point to, enter the following

    cmd /c net start MSSQLSERVER 


    cmd /c net stop MSSQLSERVER 
  • Click next, and call the shortcut whatever you want.

Important: MSSQLSERVER is your SQL instance name
Thanks to Just geeks

If you are running Windows 7, you might want to set running shortcuts as Administrator.

  • right click on the shortcut
  • in ‘Shortcut’ click ‘Advanced’ button
  • check ‘Run as administrator’ option