How To Recover Sql Server Password

When you are forgot your password in sql server authentication nothing to worry.

First open your Microsoft SQL Server Management Studio .

Select ServerName and first select Authentication type is Window Authentication and Connect.


sql server


Now showing Object Explorer in left side.

In Security > Logins > Select your sql server authentication username.

And right click on username and select properties. 



sql server management studio

Now open login properties pop up and here you are set new password.


sa

Enjoy..!

Display Data In Webgrid And Delete Multiple Rows By Using Checkboxes In MVC 5 Application

INTRODUCTION

In this article, I am explain How to Display Data In Webgrid And Delete Multiple Rows By Using Checkboxes In MVC 5 Application.

CREATE NEW PROJECT.

Go to File > New > Project > Select asp.net web application (with .NET Framework 4.5) > Enter Application Name > Click OK > Select Empty MVC Template > OK

Create Table.

DATA TABLE

Add Entity data model.
In previous articles I explained how to add entity data model. here

ADD A NEW CONTROLLER.

Go to Solution Explorer > Right Click on Controllers folder form Solution Explorer > Add > MVC5 Controller- Empty > Enter Controller name Home > Add.

ADD NEW ACTION INTO YOUR CONTROLLER FOR DISPLAY DATA IN WEBGRID.

Here I have added "List" Action into "Home" Controller. write this following code. 

LIST ACTION

ADD VIEW FOR for the LIST ACTION

Right Click on Action Method (here right click on form action) > Add View... 

ADD VIEW

Rebuild solution before add view.

Write following code into List view.

LIST VIEW


ADD ANOTHER ACTION INTO YOUR CONTROLLER FOR DELETE MULTIPLE ROWS AT ONCE.

Here I have added "Delete" Action into "Home" Controller. 
write this following code .

DELETE ACTION

RUN APPLICATION(CTTL + F5).

WEBGRID

Dropdownlist control in MVC using HTML helpers

A dropdownlist in MVC is a collection of SelectListitem objects. Depending on your project requirement you may either hard code the values in code or retrieve them from a database table.

First here we show dropdownlist using hard coded value.

Write following code to your view.


DROPDOWNLIST

Now run application.(ctrl + F5).


DROPDOWNLIST

Now write code in Index action for retrieve data from database.

DROPDOWNLIST

Right click on Index action and Add View and write following code.

DROPDOWNLIST

Now run application.(ctrl + F5).

DROPDOWNLIST






Insert, Update, Delete data in MVC5 using EntityFramework

This tutorial will show you how you can perform insert, update, delete operation in an mvc application using entity framework. This is called CRUD functionality. This you can use in MVC3, MVC4, MVC5.

Here we use entity framework 6 with MVC5.

First of here is our sql table:


DATABASE TABLE

So for this tutorial first we will create a new empty mvc application in this we will add a ADO.NET entity data model in Model.

NEW ITEM

Select EF Designer from database.

DATA MODEL

Then select Server name and Database name.

CONNECTION PROPERTIES

Select Yes radio button and click on Next.

ENTITY DATA MODEL WIZARD

Select Entity Framework 6.x.

ENTITY FRAMEWORK 6

Then Select table.

DATABASE


Now MVCdb.edmx add in Model folder.

EDMX FILE


Now Add Employee Controller.

CONTROLLER


Choose MVC5 Controller with views, using Entity Framework.

MVC 5 CONTROLLER

Select Model class and DataContextClass and give Controller name Employee.

ADD CONTROLLER


so now, automatically create  Index,Create,Delete,Edit,Details Views and Controller actions.

EMPLOYEE CONTROLLER

Now Run Application. (ctrl+F5)

RUN APPLICATION

Clcik on Create New.

CREATE
Add data and Click on Create button.

EMPLOYEE






Views in MVC Application

A view requests information from the model that it uses to generate an output representation to the user.

First Add Home Controller in MVC Project.


ViewBag & ViewData is a mechanism to pass data from controller to view.



To pass data from controller to a view, it's always a good practice to use strongly typed view models.

We use "@" symbol to switch between html and C# code.

ADD VIEW

Enter View Name. and Click Add Button.

ADD VIEW

Now Create Index.cshtml file in View/Home Folder.

Write Following code into Home Controller.

INDEX ACTION

Now open Index.cshtml file. and write  following code.

INDEX VIEW

Now Run Project.(Ctrl+F5)

WELCOME

How to add a Controller in MVC5

First create new empty mvc project.
ASP.NET MVC5

















In Solution  Explorer, right-click the Controllers folder  and then click Add,  then Controller.

CONTROLLER
















In the Add Scaffold dialog box, click MVC 5  Controller - Empty, and then click Add.CONTROLLER

Name your new controller "HomeController" and click Add.


CONTROLLER

In Solution  Explorer that a new file  has been created named HomeController.cs and a new folderViews\Home. HomeController.cs file is open in the IDE.

Replace the contents of the file with the following code.

CONTROLLER ACTION

The controller methods will return a string of HTML as an example. The controller is named Home and  the first action named Index.  Let’s invoke it from a browser. Run the application (press F5 or Ctrl+F5). In the  browser, append "Home" to the path in the address bar. (For example,  in the illustration below, it's http://localhost:50263/Home.)  The page in the browser will look like the following screenshot. In the action above, the code returned a string directly. You told the system to just return some HTML, and it did! 

MVC APPLICATION
ASP.NET MVC invokes different controller classes (and different action methods within  them) depending on the incoming URL. The default URL routing logic used by ASP.NET  MVC uses a format like this to determine what code to invoke:
/[Controller]/[ActionName]/[Parameters]
You set the format for routing in the App_Start/RouteConfig.cs  file.

route config


When you run the application and don't supply any URL segments, it defaults to  the "Home" controller and the "Index" action method specified in the defaults  section of the code above. 

Now Add Welcome action in HomeController.cs file. Add the following code in your file.

 public string Welcome(string name, int numTimes = 1)
        {
            return HttpUtility.HtmlEncode("Hello " + name + ", NumTimes is: " + numTimes);
        }

Run your application and browse to the example URL (http://localhost:50263/Home/Welcome?name=M9coders&numtimes=9).
You can try different values for name and numtimes in  the URL. The ASP.NET MVC model binding system automatically maps the named parameters from  the query string in the address bar to parameters in your method.


mvc




Create Hello World Application using MVC5 with Visual Studio 2013

This tutorial will teach you the basics of building an ASP.NET MVC 5 Web application using Visual Studio 2013.
Creating Your First Hello World Application.
Click New Project.
Then Select New Project.

VISUAL STUDIO 2013

Then select Visual C# on the left, then Web and then select ASP.NET  Web Application. Name your project "HelloWorld" and then click OK.


.NET FRAMEWORK 4.5

In the New ASP.NET Project dialog, click MVC and then click OK.

MVC
Visual Studio used a default template for the ASP.NET MVC project you just created, so you have a working application right now without doing anything!
Now run the application.


MVC


This is a simple "Hello World!" project, and it's a good place to start your application.

ASP.NET MVC
This application also provides support to register and log in.
The next tutorial is how to adding a Controller.

Getting Started with ASP .NET MVC for Beginners

Introduction

we will start with understanding concept of MVC.
ASP.NET MVC Framework is a web application framework that implements the model-view-controller pattern. 


MVC




Advantages of MVC

  • Separation of Concerns
  • Better Support For Test Driven Development
  • Clean URL
  • Better For Search Engine Optimization
  • Full Control Over the User Interface or the HTML
  • Loosely Coupled so Each Component can be tested independently.

Pre-requisite for MVC

Before we start the tutorial let's ensure that you have all the ingredients to create an MVC application. Now MVC has lot of versions MVC 2 , MVC 3 , MVC 4 and MVC 5. So depending on which version you are working you need the appropriate visual studio version.
If you are doing MVC 5 you need VS 2013 you can download the same from http://www.visualstudio.com/downloads/download-visual-studio-vs
If you are doing MVC 3 and 4 you need VS 2012.
For MVC 2 you need VS 2010  2008 will also do.
So once you have all your pre-requisites it is time to start the first tutorial.

here we are using Visual Studio Professional 2013 with Update 3.