Wednesday, September 6, 2023

Jquery MultiSelect DropDown






















using System.Data.SqlClient;
using System.Collections;


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("user id=sa;password=uday;database=mydb;data source=localhost");
        SqlCommand cmd = new SqlCommand("select empno,ename from emp",con);
        con.Open();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        da.Fill(dt);
        List<Emp> listemp = new List<Emp>();
       
        foreach (DataRow dr in dt.Rows)
        {
            Emp obj = new Emp();
            obj.Empno = Convert.ToInt16(dr[0]);
            obj.EmpName = Convert.ToString(dr[1]);
            listemp.Add(obj);
        }
        Context.Session["EMPDETAILS"] = listemp;
        con.Close();

    }
}

Default.aspx.cs Image



Default.aspx

<head runat="server">
 <link rel="stylesheet" href="css/common.css" type="text/css" />
    <link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/ui-lightness/jquery-ui.css" />
    <link type="text/css" href="css/ui.multiselect.css" rel="stylesheet" />
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/plugins/localisation/jquery.localisation-min.js"></script>
    <script type="text/javascript" src="js/plugins/scrollTo/jquery.scrollTo-min.js"></script>
    <script type="text/javascript" src="js/ui.multiselect.js"></script>
    <script type="text/javascript">
        $(function () {
            $.localise('ui-multiselect', {/*language: 'en',*/ path: 'js/locale/' });
            $(".multiselect").multiselect();
            $('#switcher').themeswitcher();
        });
    </script>
    </head>
<body>
    <form id="form1" runat="server">
    <div>
        <%
            List<Emp> obj = new List<Emp>();
             %>
        <% if (Context.Session["EMPDETAILS"] != null)
           {

               obj = (List<Emp>)Context.Session["EMPDETAILS"];
           }
       
            %>

        <select size="4" id="EmpName" class="multiselect" multiple="multiple" name="EmpName[]">
                                                      <%
                                                   if (obj != null && obj.Count != 0)                  {
                                                        for (int i = 0; i < obj.Count; i++)           {
                                           
Emp listemp = (Emp)obj[i];                                                 %>
  <option value="<%=listemp.Empno%>">                          <%=listemp.EmpName%></option>                                                  <%
                                                                }
 }
 %>
   </select>
        <br/>
         <asp:Button ID="Button1" runat="server" Text="Save Reports" />
    </div>
    </form>
</body>


==================================================


Friday, February 11, 2022

TypeScript Part 4

Static Member

The term static refers to memory.

The static memory once allocated for an object will be used for all other objects.

It occupies more memory

The static members are declared by using the keyword static and they are accessible by using class name.

Non Static Member

It uses dynamic memory.

The dynamic memory is allocated for every object individually. Hence it is more secure, and occupies less memory.

The non static members are accessible with in the class by using "this" keyword.

Example

class Demo1 {
public n:number=0;
public static s:number=0;
constructor()
{
    this.n+1;
    Demo1.s++;
}
public print():void {
    console.log("s=" + Demo1.s);
    console.log("n=" + this.n);
}
}
let obj1 =new Demo1();
obj1.print();
let obj2=new Demo1();
obj2.print();
let obj3=new Demo1();
obj3.print();


Output

s=1

n=0

s=2

n=0

s=3

n=0


Static Keyword  /Access Specifier 


 -------------------------------
 *static keyword can be applied to a field (or) method
  1.static field
  2.static method

 static field:
 -------------
 *the field attached to a class is called "static field"
 *static field will be allocated with memory only single time, it will be
  shared by all the objects of a class
 *static field can be referenced only with class name, not with object variable


 static method:
 --------------
 *the method attached to a class is called "static method"
 *static method can access only static fields
 *static method can be referenced only with class name, not with object variable

Tuesday, February 8, 2022

TypeScript Part 3

Before going into OOPS, we need to know about the Object based programming system

Object Based Programming System

Features: Supports code reusability and code separation

Support Dynamic Memory Allocation

Can be Integrated with other programming system

Issues:

It will not support Inheritance

It will not support dynamic polymorphism

Code Extensibiity Issues

Ex: Javascript , VB Script

Object Oriented Programming 

Features

Code Reusability

Code Separation

Dynamic Memory Allocation

Code Extensibility

Issues

Uses more memory

Slow than other programming system

Complex in configuration



OOPS IN TypeScript

Object oriented programming is provided with 4 Synopsis

1 Data Encapsulation

 Combing/Binding related fields and methods as one unit is Called as "Data Encapsulation"

Practical:

Class is an implementation of data Encapsulation.

2 Data Abstraction

Hiding secured Data and functionality from user with the help of access specifiers is Called "Data Abstraction"

Practical:

Object is an implementation of data Abstraction.

TypeScript part 2

Variables in TypeScript

Variables are named storage locations in memory where you can store a value and use it as part of any expression.

TypeScript is in strict Mode of JavaScript and hence declaring variables in mandatory.

Variables in typescript can be declared by using the following reasons.

a) Var

b) let  

c) const


var is used to define function scope variables so that it is accessible from any location within the function.

let is used to define block scope variable and hence it cannot be accessed outside the block.

const is used to define block scope variables which must be initialized with a value and cannot be shadowed.

shadowing is the process of using the same name identifier with different value within the scope.

Syntax

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...