Jquery datepicker set value in textbox

Jquery datepicker 

Today I going to show you how you set value in textbox using Jquery date picker in asp.net or any other control (like HTML). Here we take a simple HTML textbox to pick date using Jquery UI , in this process we use 3 ajax-offical script link.
Here we match the id of HTML Textbox (id="datepick") with the jquery id selector.

<html xmlns="http://www.w3.org/1999/xhtml">
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.js" type="text/javascript"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.js" type="text/javascript"></script>
    <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/themes/humanity/jquery-ui.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {

            <input type="text" id="datepick" />

Read More

Sealed class in c# with real time example

Sealed classes and Sealed methods in C#.NET

Sealed class:

A sealed class is a class that does not allow inheritance. Some object model designs need to allow the creation of new instances but not inheritance, if this is the case, the class should be declared as sealed.To create a sealed class in C#, the class declaration should be done as:

using System;

sealed class SealedClass   // Sealed class
    public int Add(int x, int y)
        return x + y;

class Class1 : SealedClass
    static void Main(string[] args)
        SealedClass sealedCls = new SealedClass();
      //Object creation of sealed class
        int total = sealedCls.Add(4, 5);                  
      //Calling the function
        Console.WriteLine("Total = " + total.ToString());

When you try to derive a class from sealed class compiler throw an error."'Class1': cannot derive from sealed type 'SealedClass' "

The actual mean of using sealed class is to prevent inheritance of a class, we do not want to allow some class  to extend the functionality of a class.

Advantages of sealed class in c# 

1.Sealed keyword in C# applies restrictions on the class and method
2.At class level sealed modifier prevents a class from being inherited. 

Some true fact about a sealed class in c#

* Can we create instance of sealed class in c#
   Yes, you can

* Purpose of sealed class in c# net
  Is to prevent class being inherit

* Sealed class is like the normal class but the sealed class can't inherited but it's possible can be instantiated like normal class.

* To declare sealed class we should use the sealed keyword with the class declaration.

* The sealed classes are useful in order to protect our classes not to be used by any other classes.

Sealed Method:

We can also use the sealed modifier on a method or property that overrides a virtual method or property in a base class. If we want to stop the derivation of class for the next level then we need to mark method as sealed in previous class.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SealedClass
    class Boss
        virtual public void Work()
            Console.WriteLine("In class A");

    class TL : Boss
        sealed override public void Work()
            Console.WriteLine("In class B");
    class Employee : TL
        override public void Work() //Error: cannot override inherited member 
        {                               //TL.Work() because it is sealed  


 Also Read:

Read More

Hello world program in typescript

Hello world program

Today I am going to show you how to write hello world program in TypeScript, it is very simple to write helloword program and run it. Also we will talk about how to write a class in typescript and constructor in typescript.

Open the vs code and type the following single line of code and save it in your system's folder and follow the given steps.

console.log("Hello Word");

Step to compile and run the typescript program.

1.Save it with name helloword.ts
2.Open NodeJs Command Prompt , go to the directory where your helloword.ts file is saved.
3.In my case file available in E:\typescriptprtcl\New folder
4.So I am trying to go to in E:\typescriptprtcl\New folder using command.
Hello world program in typescript

5.Now do the following steps

1. tsc helloword.ts  when you type this command and hit enter the typescript program will be compile and one more file created with the name helloword.js  .See in your folder,here tsc means typescript compiler.
2. node helloword.js whenever you hit this command your helloword.js result show in picture.


tsc is compiler which convert the typescript file into javascript file so that we can run javacript, we can’t run directly typescript first we need to convert it.

Hello world program in typescript

How to write class in typescript and create object of class

class office
   empcode:any  ="Helloword";
   let obj=new office();

In above example any is a variable which is able to store any datatype in typescript. Let key use to create an object of a class so that we can call variable of the class. console.log  is same as Console.Write function in c#.

Constructor In typescript:

Constructor is special type of function which name same as class name in other language.  But in typescript if we want to create constructor , we need to write constructor keyword. See Example

class office
   let obj=new office(101);

Read More

Operator overloading in c# definition with example

Operator overloading in c# | Example 

In this article , I am going to discuss about operator overloading and it's example, Sometimes developers confused about it and they think operator overloading and function overloading is same but both are very different.

Definition of Operator overloading

Class allow to create user define type or extract datatype.If we create a variable of that type is set to be an object but that object doesn't support all the operators it support few operator like . and (Assignment operator) ,by using operator loading we can enhance the capabilities of an object to support the operator.

1.Operator overloading works on early binding approach.
2.We can't operator overload at that function which approach decide at run-time.

Why we use operator overloading in c#
Used for to achieve object addition.

Steps for implementing operator overloading in c#
Here are some step that you need to follow while you are implementing operator overloading in c#.

1.Operator is a function is to be applied to support in built operator to given an object
2.Opeartor function should be static(See Example).
3.This function always takes two parameter ,can't have three parameter and must be public.
4.Note:We can't overload AND,OR,NOT like logical operator.
5.Operator function return the  object of containing class.

Example of Operator overloading

using System;
class office
    double salary;
    public office()
        salary = 0;
    public office(double sal)
        salary = sal;
    public void Display()
    public static office operator +(office o,office ob//it must be public static otherwise get compiler error
        office obj = new office();
        obj.salary = o.salary + ob.salary;
        return obj;

    static void Main()
        office a = new office(1212);
        office b = new office(7888);
        office accuntant = new office();
        accuntant = a + b;



Read More

21 Typescript interview questions and answers for beginners

Welcome Typescript interview questions and answers for beginners,Here are the some tricky typescript interview question and answers collection which is ask in interview. May it will help you to crack you typescript interview.

Typescript interview questions and answers for beginners
Typescript interview questions and answers

1.What is namespace in Typescript? Write the declaration of namespace.

I think Everyone familiar with namespace  of other languages , here also in TypeScript a namespace is just a collection of classes by which we can logically categories. If we want to access any class from out side of the namespace then we need to  export  keyword.

namespace People
      export class Boss
      export class Employee
      export interface Iofficework

2.What is Typescript?

TypesScript is known as Object oriented programming language developed and maintained by Microsoft. Which is provide you to optional parameters,classes and interfaces.TypeScript is nothing but JavaScript and some additional features i.e. ES6 features.Whenever we compile the TypeScript code it first convert in JavaScript then it run and we get output

3Difference between typescript and javascript?

1.Typescript is a superset of JavaScript whereas JavaScript is a scripting language.
2.Typescript have interface concept but JavaScript havan't.
3.TypeScript dosen't run in browser where JavaScript runs.
4.TypeScript have classes whereas JavaScript have functions.
5.Typescript support module whereas JavaScript dosen't support modules.
6.In typescript Number,string are the interfaces whereas In, JavaScript Number,string are the Object.

4.What are the key features of typescript?

TypeScript supports different browsers or node.js versions, and optimizes the resulting JavaScript. It is much easier to write clean, consistent code across a project and development team..

5.When to use super keyword in typescript.

In typescript,Super keyword is used to reference base class properties and the base class constructor.

6.How to access static methods in TypeScript

7.What Are Classes In Typescript?

The concept of classes is very similar to .NET/Java. A Class can have constructor, member variables, properties and methods. TypeScript also allows access modifiers “private” and “public” for member variables and functions.

8.Tell me the command for installing typescript.

npm install -g typescript

9.What Are The Benefits Of Typescript?

TypeScript has following benefits:

2Impose coding guidelines
3.Offers type checking
4.It helps in code structuring
5.Compile time error checking
6.Use class based object oriented programming

10.What is the typescript extension and how you compile.

Typescript extension is '.ts'. It is just a javascript file ,when we compile typescript file, just after compilation it convert into '.js' file.

Step to complie typescript program
1. tsc 'your typeScript File Name'
For example, to compile “program.ts”:
tsc program.ts

After complilation you will get

11.How to declare variable in Typescript ?

var name:string="sham"
var phone:string="123456"

12.How do you declare undefined variable?

var name:string;
var phone:int;

13.How to declare and initialize array in Typescript ?

var names:string[];       -- Declaration
names=["a","b","c","d"]   -- Initialization

14.How to achieve inheritance in Typescript ?

15.How to make a module in Typescript ?

16.What is role of constructor in Typescript ?

Constructor is responsible for initializing the variables of the class.

17.How to initialize the static variables ?

class office
   static phoneNo:number=101;
   console.log(office.phoneNo) ;

18.What is the difference between var and let in Typescript?

1.var declaration done at function scoped and let declaration done at block scoped.
2.var allow you to re-declare the same variable in the same scope. whereas let will not

19.How to define a global variable in a typescript module.

20.How to export a variable.

export var demo = [1,2,3];

21.What is the role of var keyword in typescript.

var is key it helps us to creating an object of a class.

Read More
Designed By © 2018 Dot Net Tutorial Published.. Dot Net Tutorial