Thursday, 9 May 2019

Difference Between ASP.NET MVC And ASP.NET Core

We love to develop websites and web applications. When we create an enterprise application, we often choose ASP.NET MVC over ASP.NET Core. Here are the basic differences: 
 
ASP.NET MVC
 
ASP.NET framework is a highly testable and powerful framework. It's a web form based framework. You can create applications in ASP.NET (.aspx) or Razor page. MVC has three major parts - Model, View and Controller.
  • Model Model represents the data business logic layer. It maintains the data in the whole application. Model object retrieves and stores data in the application.
  • View View is a user interface (what we see on a website and application). View displays the data using Model and user input, and also modifies that data.
  • Controller 
    Controller handles all the user requests and processes using Model and display View part. It provides control over the user requests, URL path change (Routing), and many other operational controls.
ASP.NET MVC gives you a pattern-based way to develop dynamic websites and applications. It has many features and powerful tools. You can learn MVC and easily working with Routing, UI, Layout, Theme, data, API, and others.
 
ASP.NET MVC isn't open source. It's controlled and developed by Microsoft.  
 
ASP.NET Core 
 
ASP.NET Core is a "learn and compose" based framework to develop an application. It mainly focuses on fully open source and ASP.NET Core available on Github. You can develop  ASP.NET Core easily.
 
ASP.NET Core also focuses on another region. It's cross platform, which means you can use it on Windows, Mac or Linux. The previous version ASP.NET MVC was not cross-platform and worked only on Windows.

Thursday, 2 May 2019

Tab page navigation in ASP.net

Introducation:-

In this article we will learn how to navigate page after click tab in asp.. 

Download link:- download

Example:-


Script Js:-

$(document).ready(function () {
              $('#nav li a').each(function () {
                       var current = location.pathname;
                var $this = $(this);
                // if the current path is like this link, make it active
                if (current.indexOf($this.attr('href')) !== -1) {
                    $this.parents().addClass('active');
                }
            });
          });


CDN link:-

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


HTML:-

<div class="container">
  <h3>Tabs</h3>
  <ul id="nav" class="nav nav-tabs">
    <li><a href="Tab1.aspx">Home</a></li>
    <li><a href="Tab2.aspx">Menu 1</a></li>
    <li><a href="Tab3.aspx">Menu 2</a></li>
    <li><a href="#">Menu 3</a></li>
  </ul>
  <p><strong>Note:</strong> This example shows how to create a basic navigation tab. </p>
</div>

 
 



Wednesday, 1 May 2019

How to set Html.RadioButtonFor as selected by default in Asp.net MVC3

The below is the code snippet of how to use the Html helper for Radio Button in Asp.net MVC.
<td> Will Accept?</td>
 <td>
@Html.RadioButtonFor(x => x.WillAccept, true)
@Html.RadioButtonFor(x => x.WillAccept, false)
</td>

The first option is to pass the “checked” html attribute as a parameter to the Html helper method by creating an anonymous object as below
<td> Will Accept?</td>
<td>
@Html.RadioButtonFor(x => x.WillAccept, truenew { @checked = “checked” })
@Html.RadioButtonFor(x => x.WillAccept, false)
</td>
The Second option is to set the value of the corresponding model property in the controller itself
public ActionResult Feedback()
{
UserResponse usr= new UserResponse();
usr.WillAccept = false;
return View(“Feedback”,usr);
}
Both work perfectly, but note that, setting the value via model overrides passing via html parameter. So if both of the above options are used the default value of the radio button will be false.
Leave a reply if you find it useful

Tuesday, 30 April 2019

SQL Server INSERT Multiple Rows

In this tutorial, you have learned how to use another form of the SQL Server INSERT statement to insert multiple rows into a table using one INSERT statement

the following statement to create the table:-

CREATE TABLE sales.promotions (
    promotion_id INT PRIMARY KEY IDENTITY (1, 1),
    promotion_name VARCHAR (255) NOT NULL,
    discount NUMERIC (3, 2) DEFAULT 0,
    start_date DATE NOT NULL,
    expired_date DATE NOT NULL
);

The following statement adds multiple rows to the promotions table:

INSERT INTO sales.promotions (
    promotion_name,
    discount,
    start_date,
    expired_date
)
VALUES
    (
        '2019 Summer Promotion',
        0.15,
        '20190601',
        '20190901'
    ),
    (
        '2019 Fall Promotion',
        0.20,
        '20191001',
        '20191101'
    ),
    (
        '2019 Winter Promotion',
        0.25,
        '20191201',
        '20200101'
    );

SQL server issued the following message indicating that three rows have been inserted successfully.

(3 rows affected)

Let’s verify the insert by executing the following query:

SELECT
    *
FROM
    sales.promotions;

Here is the output:


I


Monday, 29 April 2019

Finding Logged in user /Domain using System.Security

To find the Domain name using System.Security.Principal.WindowsIdentity

#C Code:-

 //Get the access if the username exists in the group 

     private bool GetUserInfo()
        {
            bool isAccess = false;
            ClsMailParameters.UsrSourceKey = Environment.UserName;
            if (CheckIdentity() == true)
            {
                isAccess = true;
            }
            return isAccess;
        }

// function for check the user exists in the group or not
//If exists return true otherwise false

private bool CheckIdentity()
        {
            bool bIsGroupie = false;
            System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();

            var sourceKey = identity.Name.ToString();

            // get a list of group names for the user

            ArrayList groups2 = new ArrayList();

            foreach (System.Security.Principal.IdentityReference group in identity.Groups)
            {
                groups2.Add(group.Translate(typeof(System.Security.Principal.NTAccount)).ToString());

            }

            for (int i = 0; i < groups2.Count; i++)
            {
                var ii = groups2[i].ToString();
                string checkValue = "GroupName"; // Give the group name
                try
                {
                    if (ii.ToUpper() == checkValue.ToUpper())
                    {
                        bIsGroupie = true;
                        break;
                    }
                }
                catch { }
            }
            return bIsGroupie;
        }

Wednesday, 17 April 2019

Definition Of AngularJs

AngularJs:-  
  1. Angular is a java script framework that is used to build  application that run on the browser.
  2.  Angularjs is developed by Google
  3. Angularjs ia an open source project that means free to use, changed
Benefit of using AngularJs:-
  1. Dependency injection
  2. Two way Data-binding
  3. Easy to Test

You should have the knowledge:-
  • HTML
  • CSS
  • JavaScript   


MVC Folder Directory Struncture

Directory Structure:-

Some people for the fast-developing code doesn’t think about directory structure. but for the long project it will affect the project maintainability. There are lots of way to structure the application.

in this article we will learn how to create folder directory structure and what the meaning of folder.

In the directory structure, we will follow the following step: -

  1.  Open Visual Studio -> click new Project-> Asp.net web application
  2.  Give the Application Name that you want
  3. Right Click Application-> Add Folder ‘App’
then you see the application contain the folder as show in below image











































1.App_Data:- App_Data contains the data like .mdf ,Xml file and other data related files.
2. App_Start:- it contains the  class files like BundleConfig.cs, FilterConfig.cs, RouteConfig.cs etc.
     BundleConfig.cs contains the bundle of js and css , RouteConfig.cs contains the default path of the application.




2. Content:- content folder contains the file Likes CSS , icon, images etc. means related to the designing part.



3. Controller:- it the heart of the MVC application. Controller contains the class files. it is responsible for controlling the flow of application execution.



4. Model:- contains the class files that is used in the view.



5. Scripts:- it contains all the .Js Files



6. Views:- it contains the HTML files . it is the design part of the application















What is Agile,advantage and disadvantages

Introduction:- It is a software development life cycle used for software development, that is characterized by the division of tasks in...