Be The Geek

Google Missing Profile View In Google Plus


Method Overloading And Method OverRiding

Method Overloading refers to Concept the defining the one or more functions or methods with same name with different Parameter Length or Parameter Types . So Functions are differenciated by their signature or Parameters .

Example For Method OverLoading

public class test
    public void getStuff(int id)
    public void getStuff(string name)
Method OverRiding is Totally Different Concept As Compared to Method Overloading . Method OverRiding Refers to Redefining the Function that Correspond to Some Other Class and Accessed Using Inheritance .

The Concept of Method OverRiding depends on Two Keywords - Virtual and OverRide

In Simple Scenario to Explain Method OverRiding with Example is Lets Assume We have a Base Class with function Sample() in Base Class then The Oher class that Derived From that Base Class Can Redefine the Functionality of That Sample() Function refers to Concept of Method OverRiding .

Example1  For Method OverRiding

class BC
  public virtual void Display()

class DC : BC
  public override void Display()

class Demo
  public static void Main()
     BC b;
     b = new BC();

     b = new DC();



Example1  For Method OverRiding

public class test
        public virtual getStuff(int id)
            //Get stuff default location

public class test2 : test
        public override getStuff(int id)
            //or - Get stuff new location



Value Types Vs Reference Types Dotnet

Stack and heap

In order to understand stack and heap, let’s understand what actually happens in the below code internally.

public void Method1()
    // Line 1
    int i=4;

    // Line 2
    int y=2;

    //Line 3
    class1 cls1 = new class1();

It’s a three line code, let’s understand line by line how things execute internally.
  • Line 1: When this line is executed, the compiler allocates a small amount of memory in the stack. The stack is responsible for keeping track of the running memory needed in your application.
  • Line 2: Now the execution moves to the next step. As the name says stack, it stacks this memory allocation on top of the first memory allocation. You can think about stack as a series of compartments or boxes put on top of each other.
  • Memory allocation and de-allocation is done using LIFO (Last In First Out) logic. In other words memory is allocated and de-allocated at only one end of the memory, i.e., top of the stack.
  • Line 3: In line 3, we have created an object. When this line is executed it creates a pointer on the stack and the actual object is stored in a different type of memory location called ‘Heap’. ‘Heap’ does not track running memory, it’s just a pile of objects which can be reached at any moment of time. Heap is used for dynamic memory allocation.

Why String Are Value Types Csharp Dotnet

The distinction between reference types and value types are basically a performance tradeoff in the design of the language. Reference types have some overhead on construction and destruction and garbage collection, because they are created on the heap. Value types on the other hand have overhead on method calls , because the whole object is copied rather than just a pointer.

Because strings can be  much larger than the size of a pointer, they are designed as reference types. Also, as Servy pointed out, the size of a value type must be known at compile time, which is not always the case for strings.

Strings aren't value types since they can be huge, and need to be stored on the heap. Value types are stored on the stack. Stack allocating strings would break all sorts of things: the stack is only 1MB, you'd have to box each string, incurring a copy penalty, you couldn't intern strings, and memory usage would balloon, etc

That is why a string is really immutable because when you change it even if it is of the same size the compiler doesn't know that and has to allocate a new array and assign characters to the positions in the array. It makes sense if you think of strings as a way that languages protect you from having to allocate memory on the fly 

Boxing And Unboxing in DotNet

Boxing and unboxing

I Recommend to Go to this link to Read about Value Types and Reference Types Before Going To Understand the concept of Boxing and Unboxing

Value Types Vs Reference Types Dotnet

Boxing and unboxing are the most important concepts you always get asked in your interviews. Actually, it's really easy to understand, and simply refers to the allocation of a value type (e.g. int, char, etc.) on the heap rather than the stack.


Implicit conversion of a value type (int, char etc.) to a reference type (object), is known as Boxing. In boxing process, a value type is being allocated on the heap rather than the stack.


Explicit conversion of same reference type (which is being created by boxing process); back to a value type is known as unboxing. In unboxing process, boxed value type is unboxed from the heap and assigned to a value type which is being allocated on the stack.

For Example
    // int (value type) is created on the Stack
    int stackVar = 12;
    // Boxing = int is created on the Heap (reference type)
    object boxedVar = stackVar;
    // Unboxing = boxed int is unboxed from the heap and assigned to an int stack variable
    int unBoxed = (int)boxedVar;

Real Life Example

    int Val_Var = 10;
    ArrayList arrlist = new ArrayList();
    //ArrayList contains object type value
    //So, int i is being created on heap
    arrlist.Add(Val_Var); // Boxing occurs automatically Because we are Converting int to Object Type This is Called Boxing
    int j = (int)arrlist[0]; // Unboxing occurs

Performance implication of boxing and unboxing

In order to see how the performance is impacted, we ran the below two functions 10,000 times. One function has boxing and the other function is simple. We used a stop watch object to monitor the time taken.
The boxing function was executed in 3542 ms while without boxing, the code was executed in 2477 ms. In other words try to avoid boxing and unboxing. In a project where you need boxing and unboxing, use it when it’s absolutely necessary.

Boxing And Unboxing in DotNet
Boxing And Unboxing in DotNet 



Difference Between Stored Procedure and Functions Sql

Stored Procedure and Functions


1. Function Must Return Value

   For Stored Procedure it's Not Must to return value it's optional 

2. Stored Procedures are pre-compile objects which are compiled for 
first time and its compiled format is saved which executes (compiled code) whenever it is called 

But Function is compiled and executed every time when it is called

3. Function can Accept only Input Parameters
   But Stored Procedure Can Accept Both Input and Output Parameters

4. Functions can be called from Procedure whereas Procedures cannot be called from Function

5. Functions Like Views only Accept Data Select Statements It does not Allow the Permanent Storage of data so it does not allows DML statements like Insert , Update , Delete

Whereas Store Procedure Allows All type of DML statements like Insert , Update and also Select Statements.

6. Funtions can be used in Select Statements like views to View data 
But Stored Procedure Cannot be Embedded in Select Statements


Difference Between Views And StoredProcedure Sql

Stored Procedure Vs Views

1. Stored Procedure are collection of pre-executed sql Statements that accepts parameters as input and depending on input parameters passed gives the Output Result

Views Act like Virtual Tables That Contains set of Rows and Columns from multiple original table of Database according to defined Query Commands

2. Stored Procedure Cannot be Used as Large Building Block or we can simply say It cannot be treated as tables in large queries 

But Views Can be treated like tables we can Use Views similar to table and execute select statements on Views Similar to Tables

3. Stored Procedures Allow the Use of Data Manipulation Command like Insert Data , Update data on Table or Schemas To Manipulate Data

But Views Cannot have Data Manipulation Command It can only give list of data or View of data based on set of Queries in it . Views cannot be used to Permanently store data in database it allows just to view the data.

4. Views  can have  only one Select Statement Allowed To Use

Store Procedure Can Use Various Set of Statements That also Include If-Else Statements

5. View is a virtual table that only exists when you use the view in a query. Its considered virtual table because it acts like a table, and the same operations that can be performed on a table can be performed on a view. Virtual table doesn't stay in the database, it gets created when we use the view and then delete it. 

But Stored Procedure Physically Exist 

6. Views are Used for Providing Security to data So that by using the Views we can View only Particular view of the schema to the user Not the Full View with required columns. Their is no physical presence of view data anywhere in database.

Stored Procedure allows to perform any type of data Manipulation operation But We can also Put Security Permission on Store Procedure In order to Restrict its Access From Unauthorized User

7. Code Sample For Stored Procedure and Views
This Stored procedure is used to Insert value into the table tbl_students. 

Create Procedure InsertStudentrecord
 @StudentFirstName Varchar(200),
 @StudentLastName  Varchar(200),
 @StudentEmail     Varchar(50)
   Insert into tbl_Students (Firstname, lastname, Email)
   Values(@StudentFirstName, @StudentLastName,@StudentEmail)
View Example
CREATE VIEW [Category Sales For 1997] AS

SELECT DISTINCT CategoryName,Sum(ProductSales) AS CategorySales

FROM [Product Sales for 1997]

GROUP BY CategoryName 

Jquery Full Calender Integrated With ASP.NET

Jquery Full Calender Integrated With ASP.NET

- First you need to define the function in Code-Behind using c# or that will make a Class that contains the similar properties that is required by Jquery full calendar to Fill the Calendar

- Then We Use Jquery Ajax and make request to that function that will pass some data that you can fill manually or you can also fetch that from database and then return that to this Ajax Request

- Now use the Code below to Plot then on Full Calendar

If you have any problem setting this please tell me in comments I am here to help you setting this up

Download Full Solution Code Here . Don't Forget to Share Us on Social Media

Code To Fetch Events Using Jquery

 <script type="text/javascript">
        $(document).ready(function () {
                type: "POST",
                contentType: "application/json",
                data: "{}",
                url: "Default.aspx/GetEvents",
                dataType: "json",
                success: function (data) {

                        header: {
                            left: 'prev,next today',
                            center: 'title',
                            right: 'month,agendaWeek,agendaDay'
                        editable: true,
                        events: $.map(data.d, function (item, i) {
                            var event = new Object();
                   = item.EventID;
                            event.start = new Date(item.StartDate);
                            event.end = new Date(item.EndDate);
                            event.title = item.EventName;
                            event.url = item.Url;
                            event.ImageType = item.ImageType;
                            return event;
                        }), eventRender: function (event, eventElement) {
                            if (event.ImageType) {
                                if (eventElement.find('span.fc-event-time').length) {

                                } else {

                        loading: function (bool) {
                            if (bool) $('#loading').show();
                            else $('#loading').hide();
                error: function (XMLHttpRequest, textStatus, errorThrown) {
        function GetImage(type) {
            if (type == 0) {
                return "<br/><img src = 'Styles/Images/attendance.png' style=

            else if (type == 1) {
                return "<br/><img src = 'Styles/Images/not_available.png' style=

                return "<br/><img src = 'Styles/Images/not_available.png' style=



Web Method In C# that Pass the Event to Jquery Ajax Request

        public static IList GetEvents()
            IList events = new List<Event>();
            for (int i = 0; i < DateTime.DaysInMonth(DateTime.Now.Year, 

DateTime.Now.Month); i++)

                events.Add(new Event
                    EventName = "My Event " + i.ToString(),
                    StartDate = DateTime.Now.AddDays(i).ToString("MM/dd/yyyy"),
                    EndDate = DateTime.Now.AddDays(i+1).ToString("MM/dd/yyyy"),
                    ImageType = i % 2,
                    Url = @""
            return events;

Class To Define the Event

 public class Event
        public Guid EventID { get { return new Guid(); } }
        public string EventName { get; set; }
        public string StartDate { get; set; }
        public string EndDate { get; set; }
        public int ImageType { get; set; }
        public string Url { get; set; }

Using Report Viewer with Dataset Csharp and vb

For Using Report Viewer in or Desktop Application using Csharp or Visual basic I am today providing a simple step by step solution -

Demo File is also available to Download so that you can have a demo for how to use or Use Reports With Dataset in . I have provided Both Csharp and Vb code

Step 1 - First of Start a C# Project or Vb Project and then Add an Empty Webform to it .

Step 2 :- Now Right Click on Solution in Solution Explorer and Click on Add then click on New Item . Then Click On DataSet and Give a Name and Click Ok . This will add a Dataset in your Project . I will recommend it give dataset a name similar to database table whose data you want to show in Report Viewer

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 3 :- Now After Dataset is added Right Click on Dataset Page and Click on Add then click on DataTable It will add a DataTable

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 4:- Now Add Columns to DataTable and Must Ensure that the name of these DataTable column must be same to Names of Columns in Database that Corresponds to this DataTable

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 5 :- Now Again Right click on solution in Solution Explorer and Click on Add then click on New and then click on Report give it a name and click on ok . This will add a Report to your Project

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 6 :- Now From You Controls Toolbox in Visual Studio . Place a Report Viewer Control on your WebPage as shown in image below

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

 Step 7 :- Now Open your Recently Added Report file you will see it same as shown below

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 8 :- Now we need to Add the Previously added dataset or need to link the dataset we added in previous steps to the report file

Step 9 :- So for that linking Right Click on Dataaset folder in sidebar of Report Then Click on Add Dataset then you will see the following screen

Step 10 :- Now select the Added Dataset from Combox for DataSource and then after that Choose the DataTable from Next Last Combobox

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 11  :- Now Dataset Fields will be added Under Dataset folder in Left Sidebar of Report . Now you can Drag drop fields from Left Sidebar and also Place the Textbox for Labelling like I have added for ID,Name and heading etc

Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet
Using Report Viewer with Dataset Csharp and vb , Using Reporting in asp .net dotnet

Step 13:-  Now we need to Add the Code so Open Cshar Code side of Webpage where you have added the Report viewer control And Add the following code according to your choose language c# or vb

Now At Page_Load Event of your WebPage Add the Following Code According to C# or VB

Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.Reporting.WebForms

        'VB CODE
        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc")

        Dim dsUsersInfo As New DataSet1
        Dim con As New SqlConnection("Your Connection String")
        Dim cmd As New SqlCommand("select * from YourTableName", con)
        Dim da As New SqlDataAdapter()
        da.SelectCommand = cmd

        'DataTable1 is the DataTable we have created in Dataset1 that contains our columns
        da.Fill(dsUsersInfo, "DataTable1")

        Dim datasource As New ReportDataSource("DataSet1", dsUsersInfo)

        'CSharp Code
        'ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local
        'ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc")

        ' DataSet1 dsUsersInfo = new DataSet1();

        '        SqlConnection con = new SqlConnection("Your Connection String"));

        '            con.Open();
        '            SqlCommand cmd1 = new SqlCommand("select * from TableName", con);

        '            SqlDataAdapter da = new SqlDataAdapter(cmd1);
        '            da.Fill(dsUsersInfo, "DataTable1");
        '            con.Close();

        '        ReportDataSource datasource = new ReportDataSource("DataSet1", dsUsersInfo.Tables[0]);


Step 12 :- Now when you run the Page where you have added the Report viewer control It will show the Report with data from database

Parse Error The base class includes the field ‘reportViewer’, but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms

Parse Error Message:the base class include the field 'reportviewer1',but its type (Microsoft.reporting.webforms.reportviewer) is not compatible with the type of control (Microsoft.reporting.webforms.reportviewer)

This Error Occur due to Usage of different version of ReportViewer in Same .Net Project . It may happen when you have referenced a different version of ReportViewer dll files as compared to Version of Report Viewer dll ReportViewer Control is using and referenced in web.config file

So we need have same version of Report Viewer dll file in web.config file that matches with Control using and as well as version that we have referenced .

So Dll File we are using is - Microsoft.Reporting.WebForms .

Fix For This Error - 

Go to your web.config file and Search for following code -

    <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>


STEP FOR FIX Parse Error 

1. Right Click on your Website or WebApplication in Solution Explorer
2. Then Click on Add Reference 
3. Then Search For Reporting
4. Then Checkmark the Checkbox for Microsoft.ReportViewer.WebForms with Same Version or other that is available in your web.config
5. Now Click ok 
6. Rebuild Your Solution and Now Error Should be Resolved

If Any Problem Exist Still then Feel Free to Put your Query In Comment Here .

Bootstrap dropdown menu not working

Today Twitter Bootstrap has become a basic need of the Website Development . Today i am giving some explanation regarding a common mistake while using Twitter Bootstrap . This mistake will happen only when you are trying to create a Navigation Bar for your website / webapplication using Bootstrap NavBar .

So , In order to create a NavBar we must require 3 files -

1. Bootstrap.css file
2. Jquery.js file
3. Bootstrap.js file

So Bootstrap.css file is used for Design and look of Navbar and Now the most important thing due to this you may suffer from an error -

Bootstrap dropdown menu not working 

So , Ever you suffer from this a simple solution is you must first include the jquery.js file or any version of jquery.js file as you wish as shown in example below and then after jquery file you can include bootstrap.js file 

If it still does not work just include the following script code after including the above two js files

    $(document).ready(function () {

A Simple Example of Twitter Bootstrap Navbar is Below :-

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <link href="css/bootstrap.css" rel="stylesheet" />
    <link href="css/bootstrap.min.css" rel="stylesheet" />

  <script src=""></script>
    <script src=""></script>
    $(document).ready(function () {

    <asp:ContentPlaceHolder ID="head" runat="server">
    <form id="form1" runat="server">

         <nav class="navbar navbar-default">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      <a class="navbar-brand" href="#">Brand</a>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
        <li><a href="#">Link</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Manage Users <span class="caret"></span></a>
          <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu4">
  <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Regular link</a></li>
  <li role="presentation" class="disabled"><a role="menuitem" tabindex="-1" href="#">Disabled link</a></li>
  <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another link</a></li>
    <div class="btn-group">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
    Action <span class="caret"></span>
  <ul class="dropdown-menu" role="menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li class="divider"></li>
    <li><a href="#">Separated link</a></li>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#">Link</a></li>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->


ASP.NET MVC Action Return View Not Changing URL

The return View(.......) in Action of Controller is the statement that we use to return the view View for a Particular Controller Request . But Return view will return the view exactly you want and render the view but it will not change or target the user to target url  . The simple solution is below -

Code For an Action -

public ActionResult Start(SomeViewModel someViewModel)
  return RedirectToAction("SomeOtherAction");


  return RedirectToAction("Action Name", "Controller Name");

So , In code above We are using RedirectToAction instead of using  return view this can be used in total of 6 variants .

I have give 2 of simple one . In Parameter to these actions you need to pass the controller and action name according to variant you choose