Shalvin Interests

Tuesday, August 30, 2016

Bootstrap MVC Layout with Left navigation bar


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

</head>
<body>
        
    <div class="nav navbar-fixed-top">
        @Html.ActionLink("Shalvin Institute Management", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
    </div>

    <div class="row">
        <div class="row col-md-2">
            <div class="navbar navbar-inverse">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                       
                    </div>

                    <div class="row">
                        <ul class="nav">
                            <li>@Html.ActionLink("Home", "Index", "Home")</li>
                            <li>@Html.ActionLink("About", "About", "Home")</li>
                            <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <div class="row col-md-10">
            @RenderBody()
        </div>
    </div>
    
    <div class="container body-content">
       
        <hr />
        <footer>
            <p>&copy; @DateTime.Now.Year - Shalvin P D</p>
        </footer>
    </div>

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>



Bootstrap TextBox with DropDown


<div>Name <div class ="dropdown">
     <input type="text" data-toggle="dropdown"/>
           <ul class ="dropdown-menu">
               <li>Shalvin</li>
               <li>Bibbin</li>
           </ul>
</div> 


Thursday, August 25, 2016

Abstract Class C#

An Abstract class is a class with incomplete functionality.
It shall or shall not have abstract methods. As in the case with Interface you can't create an object of Abstract class.



abstract class Person
{
        public abstract void Print();
        public void Blog()
        {
            Console.WriteLine("ShalvinPD.blogspot.com");
        }
}

class Shalvin : Person
{
        public override void Print()
        {
            Console.WriteLine("Shalvin P D");
        }
}
   
class Program
{
        static void Main(string[] args)
        {
            //Error cannot create an object of Abstract Class
            //Person p = new Person();

            Shalvin s = new Shalvin();
            s.Print();
            s.Blog();
            Console.ReadLine();
        }
}

Here I am having an Abstract class called person with an abstract method called Print and an ordinary method called blog. In the sub class I am overriding the abstract Print method.


Method overriding C#




class  Person
    {
        public virtual  void Print()
        {
            Console.WriteLine("Hello Person");
        }
    }

    class Shalvin : Person
    {
        public override void Print()
        {
            Console.WriteLine("Hello Shalvin");
        }
        
    }

   class ShalvinPD : Shalvin
    {

    }
    class Reshma : Person
    {
        public override void Print()
        {
            Console.WriteLine("Hello Reshma");
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            Person p = new Person();
            p.Print();

            Shalvin s = new Shalvin();
            s.Print();

            ShalvinPD spd = new ShalvinPD();
            spd.Print();

            Reshma r = new Reshma();
            r.Print();

            Console.ReadLine();
        }
    }
}