DOT NET



                                   /*-----Short Key of Visual Studio ----------*/


Ctrl + N Opens the New Project Dialogue Box
Ctrl + Shift + O Opens the Open File Dialog Box

Ctrl + Shift + A Opens Add New Item window
Ctrl + D Opens Add Existing Item window
Ctrl + S Saves Current Form
Ctrl + Shift + S Saves everything from Application

Alt + Q Exits Visual Studio. NET
Ctrl + Z Undo
Ctrl + Shift + Z Redo
Ctrl + X Cuts your selection
Ctrl + C Copies your selection
Ctrl + V Pastes your selection
Ctrl + A Selects All
Del Deletes your selection
Ctrl + F Opens Find window
Ctrl + H Opens Find and Replace window
Ctrl + Shift + H Opens Replace 
in Files window
Ctrl + Alt + Shift + F12 Opens Find Symbol window
F7 Opens Code Designer window
Shift + F7 Gets you back 
to Design View 
Ctrl + R Opens the Solution Explorer window
Ctrl + Alt + S Opens the Server Explorer window

Ctrl + Shift + C Opens the Class View window
F4 Opens the Properties window
Ctrl + Shift + E Opens the Resource view window
Ctrl + Alt + X Opens the Toolbar window
Shift + Alt + Enter Takes you 
to Full Screen View
Alt+F8 Opens Macro Explorer window
F2 Opens Object Browser window

Ctrl + Alt + T Opens Document Outline window
Ctrl + Alt + K Opens Task List window
Ctrl + Alt + A Opens Command window
Ctrl + Alt + O Opens Output window
Ctrl + Alt + Y Opens Find Symbol Results window
Ctrl + Alt + F Lists Items under the Favorites Menu 
in your Internet Explorer 

Ctrl + Shift + B Builds your project
F5 Runs your Application
Ctrl + F5 Runs your Application without Debugging
Ctrl + Alt + E Opens the Exceptions Dialog Box
F8 Used while Debugging Applications
Shift + F8 Used While Debugging Applications
Ctrl + B Inserts a New Breakpoint
Ctrl + Shift + F9 Clears All Breakpoints
Ctrl + Alt + P Opens the Processes Dialog box
Ctrl + T Opens Customize Toolbox window
Ctrl + Shift + P Runs Temporary Macro
Ctrl + Shift + R Records Temporary Macro
Alt + F11 Opens Macros IDE
Ctrl + F1 Opens Dynamic Help window
Ctrl +Alt + F1 Opens Help window sorted by Contents
Ctrl + Alt + F2 Opens Help window sorted by Index
Ctrl + Alt + F3 Opens Help Search window
Shift + Alt + F2 Opens Index Results window
Shift + Alt + F3 Opens Search Results window
Ctrl + E +C Comment out the current selected section

Ctrl + E +U Uncomment the current selected section

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


Posted by: Suresh Dasari
Labels: OOPS Concepts

OOPS Concepts
Class:
 It is a collection of objects.
Object:
It is a real time entity.
An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behavior. For example, the hand can grip something or a Student (object) can give the name or address. In pure OOP terms an object is an instance of a class
The above template describe about object Student
Class is composed of three things name, attributes, and operations
  public class student
{
}
student objstudent=new student ();

According to the above sample we can say that Student object, named objstudent, has created out of the student class.
In real world you will often find many individual objects all of the same kind. As an example, there may be thousands of other bicycles in existence, all of the same make and model. Each bicycle has built from the same blueprint. In object-oriented terms, we say that the bicycle is an instance of the class of objects known as bicycles. In the software world, though you may not have realized it, you have already used classes. For example, the Textbox control, you always used, is made out of the Textbox class, which defines its appearance and capabilities. Each time you drag a Textbox control, you are actually creating a new instance of the Textbox class.

Encapsulation:
Encapsulation is a process of binding the data members and member functions into a single unit.
Example for encapsulation is class. A class can contain data structures and methods.
Consider the following class
public class Aperture
{
public Aperture ()
{
}
protected double height;
protected double width;
protected double thickness;
public double get volume()
{
Double volume=height * width * thickness;
if (volume<0)
return 0;
return volume;
}
}
In this example we encapsulate some data such as height, width, thickness and method Get Volume. Other methods or objects can interact with this object through methods that have public access modifier

Abstraction:
Abstraction is a process of hiding the implementation details and displaying the essential features.
Example1: A Laptop consists of many things such as processor, motherboard, RAM, keyboard, LCD screen, wireless antenna, web camera, usb ports, battery, speakers etc. To use it, you don't need to know how internally LCD screens, keyboard, web camera, battery, wireless antenna, speaker’s works.  You just need to know how to operate the laptop by switching it on. Think about if you would have to call to the engineer who knows all internal details of the laptop before operating it. This would have highly expensive as well as not easy to use everywhere by everyone.
So here the Laptop is an object that is designed to hide its complexity.
How to abstract: - By using Access Specifiers
.Net has five access Specifiers
Public -- Accessible outside the class through object reference.
Private -- Accessible inside the class only through member functions.
Protected -- Just like private but Accessible in derived classes also through member functions.
Internal -- Visible inside the assembly. Accessible through objects.
Protected Internal -- Visible inside the assembly through objects and in derived classes outside the assembly through member functions.
Let’s try to understand by a practical example:-
public class Class1
    {
        int  i;                                                                //No Access specifier means private
        public  int j;                                                 // Public
        protected int k;                                         //Protected data
        internal int m;                                        // Internal means visible inside assembly
        protected internal int n;                  //inside assembly as well as to derived classes outside assembly
        static int x;                                          // This is also private
        public static int y;                           //Static means shared across objects
        [DllImport("MyDll.dll")]
        public static extern int MyFoo();       //extern means declared in this assembly defined in some other assembly
        public void myFoo2()
        {
            //Within a class if you create an object of same class then you can access all data members through object reference even private data too
            Class1 obj = new Class1();
            obj.i =10; //Error can’t access private data through object.But here it is accessible.:)
            obj.j =10;
            obj.k=10;
            obj.m=10;
            obj.n=10;
       //     obj.s =10;  //Errror Static data can be accessed by class names only
            Class1.x = 10;
         //   obj.y = 10; //Errror Static data can be accessed by class names only
            Class1.y = 10;
        }
    }

Now lets try to copy the same code inside Main method and try to compile
[STAThread]
        static void Main()
        {
           //Access specifiers comes into picture only when you create object of class outside the class
            Class1 obj = new Class1();
       //     obj.i =10;             //Error can’t access private data through object.
            obj.j =10;
      //      obj.k=10;     //Error can’t access protected data through object.
            obj.m=10;
            obj.n=10;
       //     obj.s =10;  //Errror Static data can be accessed by class names only
            Class1.x = 10;  //Error can’t access private data outside class
         //   obj.y = 10; //Errror Static data can be accessed by class names only
            Class1.y = 10;
        }
What if Main is inside another assembly
[STAThread]
        static void Main()
        {
           //Access specifiers comes into picture only when you create object of class outside the class
            Class1 obj = new Class1();
       //     obj.i =10;             //Error can’t access private data through object.
            obj.j =10;
      //      obj.k=10;     //Error can’t access protected data through object.
     //     obj.m=10; // Error can’t access internal data outside assembly
    //      obj.n=10; // Error can’t access internal data outside assembly

       //     obj.s =10;  //Errror Static data can be accessed by class names only
            Class1.x = 10;  //Error can’t access private data outside class
         //   obj.y = 10; //Errror Static data can be accessed by class names only
            Class1.y = 10;
        }
In object-oriented software, complexity is managed by using abstraction.
Abstraction is a process that involves identifying the critical behavior of an object and eliminating irrelevant and complex details.
Inheritance:
Inheritance is a process of deriving the new class from already existing class
C# is a complete object oriented programming language. Inheritance is one of the primary concepts of object-oriented programming. It allows you to reuse existing code. Through effective use of inheritance, you can save lot of time in your programming and also reduce errors, which in turn will increase the quality of work and productivity. A simple example to understand inheritance in C#.

Using System;
Public class BaseClass
{
    Public BaseClass ()
    {
        Console.WriteLine ("Base Class Constructor executed");
    }
                                 
    Public void Write ()
    {
        Console.WriteLine ("Write method in Base Class executed");
    }
}
                                 
Public class ChildClass: BaseClass
{
                                 
    Public ChildClass ()
    {
        Console.WriteLine("Child Class Constructor executed");
    }
   
    Public static void Main ()
    {
        ChildClass CC = new ChildClass ();
        CC.Write ();
    }
}
  • In the Main () method in ChildClass we create an instance of childclass. Then we call the write () method. If you observe the ChildClass does not have a write() method in it. This write () method has been inherited from the parent BaseClass.
  • The output of the above program is

    Output:
      Base Class Constructor executed
      Child Class Constructor executed
      Write method in Base Class executed

    this output proves that when we create an instance of a child class, the base class constructor will automatically be called before the child class constructor. So in general Base classes are automatically instantiated before derived classes.
  • In C# the syntax for specifying BaseClass and ChildClass relationship is shown below. The base class is specified by adding a colon, ":", after the derived class identifier and then specifying the base class name.
Syntax:  class ChildClassName: BaseClass
              {
                   //Body
              }
  • C# supports single class inheritance only. What this means is, your class can inherit from only one base class at a time. In the code snippet below, class C is trying to inherit from Class A and B at the same time. This is not allowed in C#. This will lead to a compile time error: Class 'C' cannot have multiple base classes: 'A' and 'B'.
public class A
{
}
public class B
{
}
public class C : A, B
{
}
  • In C# Multi-Level inheritance is possible. Code snippet below demonstrates mlti-level inheritance. Class B is derived from Class A. Class C is derived from Class B. So class C, will have access to all members present in both Class A and Class B. As a result of multi-level inheritance Class has access to A_Method(),B_Method() and C_Method().

    Note: Classes can inherit from multiple interfaces at the same time. Interview Question: How can you implement multiple inheritance in C#? Ans : Using Interfaces. We will talk about interfaces in our later article.
Using System;
Public class A
{
    Public void A_Method ()
    {
        Console.WriteLine ("Class A Method Called");
    }
}
Public class B: A
{
    Public void B_Method ()
    {
        Console.WriteLine ("Class A Method Called");
    }
}
Public class C: B
{
    Public void C_Method ()
    {
        Console.WriteLine ("Class A Method Called");
    }
                   
    Public static void Main ()
    {
        C C1 = new C ();
        C1.A_Method ();
        C1.B_Method ();
        C1.C_Method ();
    }
}
  • When you derive a class from a base class, the derived class will inherit all members of the base class except constructors. In the code snippet below class B will inherit both M1 and M2 from Class A, but you cannot access M2 because of the private access modifier. Class members declared with a private access modifier can be accessed only with in the class. We will talk about access modifiers in our later article.

    Common Interview Question: Are private class members inherited to the derived class?
    Ans: Yes, the private members are also inherited in the derived class but we will not be able to access them. Trying to access a private base class member in the derived class will report a compile time error.
Using System;
Public class A
{
    Public void M1 ()
    {
    }
    Private void M2 ()
    {
    }
}
         
Public class B: A
{
    Public static void Main ()
    {
        B B1 = new B ();
        B1.M1 ();
        //Error, Cannot access private member M2
        //B1.M2 ();
    }
}
Method Hiding and Inheritance We will look at an example of how to hide a method in C#. The Parent class has a write () method which is available to the child class. In the child class I have created a new write () method. So, now if I create an instance of child class and call the write () method, the child class write () method will be called. The child class is hiding the base class write () method. This is called method hiding.

If we want to call the parent class write () method, we would have to type cast the child object to Parent type and then call the write () method as shown in the code snippet below.
Using System;
Public class Parent
{
    Public void Write ()
    {
        Console.WriteLine ("Parent Class write method");
    }
}
 
Public class Child: Parent
{
    Public new void Write ()
    {
        Console.WriteLine ("Child Class write method");
    }
   
    Public static void Main ()
    {
        Child C1 = new Child ();
        C1.Write ();
        //Type caste C1 to be of type Parent and call Write () method
        ((Parent) C1).Write ();
    }
}
Polymorphism:
When a message can be processed in different ways is called polymorphism. Polymorphism means many forms.
 
Polymorphism is one of the fundamental concepts of OOP.
 
Polymorphism provides following features: 
  • It allows you to invoke methods of derived class through base class reference during runtime.
  • It has the ability for classes to provide different implementations of methods that are called through the same name.
Polymorphism is of two types: 
  1. Compile time polymorphism/Overloading
  2. Runtime polymorphism/Overriding
Compile Time Polymorphism
 
Compile time polymorphism is method and operators overloading. It is also called early binding.
 
In method overloading method performs the different task at the different input parameters.
 
Runtime Time Polymorphism
 
Runtime time polymorphism is done using inheritance and virtual functions. Method overriding is called runtime polymorphism. It is also called late binding.
 
When overriding a method, you change the behavior of the method for the derived class.  Overloading a method simply involves having another method with the same prototype.
 
Caution: Don't confused method overloading with method overriding, they are different, unrelated concepts. But they sound similar.
 
Method overloading has nothing to do with inheritance or virtual methods.
 
Following are examples of methods having different overloads:
 
void area(int side);
void area(int l, int b);
void area(float radius);
 
Practical example of Method Overloading (Compile Time Polymorphism)
 
using System;
 
namespace method_overloading
{
    class Program
    {
        public class Print
        {
           
            public void display(string name)
            {
                Console.WriteLine ("Your name is : " + name);
            }
 
            public void display(int age, float marks)
            {
                Console.WriteLine ("Your age is : " + age);
                Console.WriteLine ("Your marks are :" + marks);
            }
        }
       
        static void Main(string[] args)
        {
 
            Print obj = new Print ();
            obj.display ("George");
            obj.display (34, 76.50f);
            Console.ReadLine ();
        }
    }
}
 
Note: In the code if you observe display method is called two times. Display method will work according to the number of parameters and type of parameters.

When and why to use method overloading
 
Use method overloading in situation where you want a class to be able to do something, but there is more than one possibility for what information is supplied to the method that carries out the task.
 
You should consider overloading a method when you for some reason need a couple of methods that take different parameters, but conceptually do the same thing.
 
Method overloading showing many forms.
 
using System;
 
namespace method_overloading_polymorphism
{
    Class Program
    {
        Public class Shape
        {
            Public void Area (float r)
            {
                float a = (float)3.14 * r;
                // here we have used function overload with 1 parameter.
                Console.WriteLine ("Area of a circle: {0}",a);
            }
 
            Public void Area(float l, float b)
            {
                float x = (float)l* b;
                // here we have used function overload with 2 parameters.
                Console.WriteLine ("Area of a rectangle: {0}",x);
 
            }
 
            public void Area(float a, float b, float c)
            {
                float s = (float)(a*b*c)/2;
                // here we have used function overload with 3 parameters.
                Console.WriteLine ("Area of a circle: {0}", s);
            }
        }
 
        Static void Main (string[] args)
        {
            Shape ob = new Shape ();
            ob.Area(2.0f);
            ob.Area(20.0f,30.0f);
            ob.Area(2.0f,3.0f,4.0f);
            Console.ReadLine ();
        }
    }
}
 
Things to keep in mind while method overloading
 
If you use overload for method, there are couple of restrictions that the compiler imposes.
 
The rule is that overloads must be different in their signature, which means the name and the number and type of parameters.
 
There is no limit to how many overload of a method you can have. You simply declare them in a class, just as if they were different methods that happened to have the same name.

Constructors and Destructors:
Classes have complicated internal structures, including data and functions, object initialization and cleanup for classes is much more complicated than it is for simple data structures. Constructors and destructors are special member functions of classes that are used to construct and destroy class objects. Construction may involve memory allocation and initialization for objects. Destruction may involve cleanup and deallocation of memory for objects.
  • Constructors and destructors do not have return types nor can they return values.
  • References and pointers cannot be used on constructors and destructors because their addresses cannot be taken.
  • Constructors cannot be declared with the keyword virtual.
  • Constructors and destructors cannot be declared static, const, or volatile.
  • Unions cannot contain class objects that have constructors or destructors.
Constructors and destructors obey the same access rules as member functions. For example, if you declare a constructor with protected access, only derived classes and friends can use it to create class objects.
The compiler automatically calls constructors when defining class objects and calls destructors when class objects go out of scope. A constructor does not allocate memory for the class object it’s this pointer refers to, but may allocate storage for more objects than its class object refers to. If memory allocation is required for objects, constructors can explicitly call the new operator. During cleanup, a destructor may release objects allocated by the corresponding constructor. To release objects, use the delete operator.
Example of Constructor
class C
{
       private int x;    
       private int y;
       public C (int i, int j)
       {
                 x = i;
                 y = j;
       }
       public void display ()     
       {
               Console.WriteLine(x + "i+" + y);
       }
}
Example of Destructor
class D
{
        public D ()
        {
            // constructor
        }         
        ~D ()
        {
           // Destructor
        }
}










ExecuteNonQuery

ExecuteNonQuery method will return number of rows effected with INSERT, DELETE or UPDATE operations. This ExecuteNonQuery method will be used only for insert, update and delete, Create, and SET statements.

ExecuteScalar

Execute Scalar will return single row single column value i.e. single value, on execution of SQL Query or Stored procedure using command object. It’s very fast to retrieve single values from database.

ExecuteReader

Execute Reader will be used to return the set of rows, on execution of SQL Query or Stored procedure using command object. This one is forward only retrieval of records and it is used to read the table values from first to last.






Purpose

State management is the process by which you maintain state and page information over multiple requests for the same or different pages.


Types of State Management

There are 2 types State Management:

1. Client – Side State Management
This stores information on the client's computer by embedding the information into a Web page, a uniform resource locator(url), or a cookie. The techniques available to store the state information at the client end are listed down below:

a. View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state.

b. Control State – If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state.

c. Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user's browser. The data is available only when the form is processed.

d. Cookies – Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site.

e. Query Strings - Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL.

2. Server – Side State Management
a. Application State - Application State information is available to all pages, regardless of which user requests a page.

b. Session State – Session State information is available to all pages opened by a user during a single visit.

Both application state and session state information is lost when the application restarts. To persist user data between application restarts, you can store it using profile property

...................................................................................................................................................................

Asp .Net Page Life Cycle Events
At each stage of the page life cycle, the page raises some events, which could be coded. An event handler is basically a function or subroutine, bound to the event, using declarative attributes like Onclick or handle. Asp.Net 3.5 & 4.0 page life cycle has following events in sequence :
1.     PreInit
It is is entry point of page life cycle. It checks IsPostBack property to check or recreate dynamic controls. In this we can set master pages dynamically & set and get profile property values.
2.     Init
It is is raised after all controls of page are initilised and skin properties are set. It is used to read or initialise control properties.
3.     InitComplete
This indicates that page is completely initialised.
4.     Preload
This event is called before loading the page in the RAM(memory). If any processing on a control or on page is required we use it.
5.     Load
This invokes the onload event of the page. In this we create connection to the database, get/set controls values and get/set view state values.
6.     loadComplete
This indicates that page is completely loaded into memory.
7.     Prender
we use this event to make final changes to the controls or page before rendering it to the browser.
8.     SaveStateComplete
View state of each control is saved before this event occurs. If we want to change the view state of any control then we use this event. This event can not be used to change the other properties of the controls.
9.     Render/PrenderComplete
This indicates that page is completely rendered to the browser.Before rendering, view state is saved for the page and all controls. During the rendering stage, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream object of the page's Response property.
10.Unload
The Unload event is raised after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and cleanup is performed.We can use this event for closing files & database connection. This event occurs for each control.



………………………………………………………………………………………………………………………………………………………..

We have Different Resources for Asp.Net Life Cycle . According to me Asp.Net Page Life Cycle is

1.Page_PreInit

in thsi event ,if we want to change master page dynamically all changes are done in this event.

2.Page_Init

in this event all control properties are initialized

3.Page_Load

in this event all controls are loaded to asp page

4.Page_Prerender

in this event asp page is sent to server and processed there

5.Page_Render

in this event processed page is given to browser understandable format.

6.Page_Unload

All Controls are unloaded.

..........................................................................................................................................................
............................................................................................................
  
 protected void btnexcel_Click1(object sender, EventArgs e)
    {
        Response.Clear();
        Response.Buffer = true;
        Response.AddHeader("content-disposition",
        "attachment;filename=ActualsAndBudgets.xls");
        Response.Charset = "";
        Response.ContentType = "application/ms-excel";
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        gvdetails.AllowPaging = false;
        fillgrid();
        gvdetails.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.End();
        gvdetails.AllowPaging = true;
        fillgrid();

    }
    public override void VerifyRenderingInServerForm(Control control)
    {
   
    }
.................................................................................................................................
protected void btnword_Click1(object sender, EventArgs e)
    {
        Response.Clear();
        Response.AddHeader("content-disposition", "attachment;filename=Gridviewdata.doc");
        Response.Charset = "";
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.ContentType = "application/vnd.word";
        System.IO.StringWriter _objstringWrite = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter _objhtmlWrite = new HtmlTextWriter(_objstringWrite);
        gvdetails.RenderControl(_objhtmlWrite);
        Response.Write(_objstringWrite.ToString());
        Response.End();
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
    }
    }
EnableEventValidation="false"
...................................................................................................................................
Ajax Calender
         <asp:TextBox ID="txtDate" runat="server"></asp:TextBox>    </td>
        <%-- <asp:TextBox ID="txtDate" runat="server"></asp:TextBox>  --%>

<asp:CalendarExtender
    ID="CalendarExtender1"
    TargetControlID="txtDate"
    runat="server" />
   <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>

-----------------------------------------------------------------------------------------------
Canonical url Redirect in asp dot net

<rule name="Redirect URL to WWW version" stopProcessing="true">
  <match url=".*" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="^indoglobal.edu.in$" />
    </conditions>
  <action type="Redirect" url="http://www.indoglobal.edu.in/{R:0}" redirectType="Permanent" />
</rule>


<link rel="canonical" href="http://www.indoglobal.edu.in/"/>

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

Array


  if (!Page.IsPostBack)
        {
            List<string> lstStr = new List<string>();
            lstStr.Add("Item 1");
            lstStr.Add("Item 2");
            lstStr.Add("Item 3");
            lstStr.Add("Item 4");
            CheckBoxList1.DataSource = lstStr;
            CheckBoxList1.DataBind();
            RadioButtonList1.DataSource = lstStr;
            RadioButtonList1.DataBind();
        }
  <asp:CheckBoxList ID="CheckBoxList1" runat="server">
        </asp:CheckBoxList>   
        <asp:RadioButtonList ID="RadioButtonList1" runat="server">
        </asp:RadioButtonList>


  for (int counter = 0; counter <= 10; counter++)
        {
            TextBox tb = new TextBox();
            tb.Width = 150;
            tb.Height = 18;
            tb.TextMode = TextBoxMode.SingleLine;
            tb.ID = "TextBoxID" + (counter + 1).ToString();
            // add some dummy data to textboxes
            tb.Text = "Enter Title " + counter;
            Page.Form.Controls.Add(tb);
            Page.Form.Controls.Add(new LiteralControl("<br/>"));


        }













Auto Complete

using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Default2 : System.Web.UI.Page
{
   
  sessonion["name"].ToString();-->use
 protected void Page_Load(object sender, EventArgs e)
    {

    }
  
    [System.Web.Script.Services.ScriptMethod()]
    [System.Web.Services.WebMethod]
    public static List<string> GetCountries(string prefixText)
    {
        clsDB objDB = new clsDB();
        string sql = "";
        DataSet dsCommon = new DataSet();
        sql = "select Service from tblservices where Service LIKE '%" + prefixText + "%'";
        dsCommon = objDB.openDataset(sql, httpcontext.current.sesson["Nam"].ToString(););
        List<string> Service = new List<string>();   
        for (int i = 0; i < dsCommon.Tables[0].Rows.Count; i++)
        {
            Service.Add(dsCommon.Tables[0].Rows[i][0].ToString());
        }
        return Service;
    }
}

 Application_BeginRequest(this, new EventArgs());

  protected void Application_BeginRequest(object sender, EventArgs e)
    {
        if (!Request.Url.Host.StartsWith("www") && !Request.Url.IsLoopback)
        {
            UriBuilder builder = new UriBuilder(Request.Url);
            builder.Host = "www." + Request.Url.Host;
            Response.StatusCode = 301;
            Response.AddHeader("Location", builder.ToString());
            Response.End();
        }
    }



Number count at button click


    static int count = 0; 
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        count++;

        Button1.Text = count.ToString();


    }


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)

            ViewState["Count"] = 0;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        ViewState["count"] = Convert.ToInt32(ViewState["count"]) + 1;

        Button1.Text = ViewState["count"].ToString();

    }

string v = Request.QueryString["param"];
        if (v != null)
        {
            Response.Write("param is ");
            Response.Write(v);
        }
        string x = Request.QueryString["id"];
        if (x != null)
        {
            Response.Write("   id detected");

        }


protected void page_Load(object sender, System.EventArgs e) { 
        if(!this.IsPostBack) 
        { 
            TextBox1.Text = "apple."; 
            TextBox2.Text = "Apple."; 
        } 
    } 
    protected void Button1_Click(object sender, System.EventArgs e)



        string testString1 = TextBox1.Text.ToString(); 
        string testString2 = TextBox2.Text.ToString(); 
        int result = string.Compare(testString1, testString2); 
        Label1.Text = ""; 
 
        if(result == 0) 
        { 
            Label1.Text += "Two strings are equal"; 
        } 
        else if(result == -1) 
        { 
            Label1.Text += "Test String1 is less than Test String2"; 
         
        } 
        else if(result == 1) 
        { 
            Label1.Text += "Test String1 is greater than Test String2"; 
         
        } 
         
    }  







for (j = 0; j < 6j++)
        {
            TableRow tRow = new TableRow();

            for (i = 0; i < 2; i++)
            {
                TableCell tCell = new TableCell();
                try
                {
                 
                    pnlDishItem = new Panel();
                    pnlDishItem.ID = "pnlDI" + dsCommon.Tables[0].Rows[k]["ID"].ToString();
                   
               

                    lnkDesc = new LinkButton();
                    lnkDesc.Text = dsCommon.Tables[0].Rows[k]["MenuItem"].ToString() + " - " + dsCommon.Tables[0].Rows[k]["Price"].ToString();
                    lnkDesc.ID = dsCommon.Tables[0].Rows[k]["ID"].ToString();
                    lnkDesc.Attributes.Add("runat", "server");
                    lnkDesc.BackColor = System.Drawing.Color.Red;
                    lnkDesc.ForeColor = System.Drawing.Color.White;
                    lnkDesc.BorderStyle = BorderStyle.Ridge;
                    lnkDesc.Width = Unit.Pixel(200);

                    lnkDesc.Click += new System.EventHandler(this.DishItem_Click);
                   
              

                    pnlDishItem.Controls.Add(lnkDesc);
                
                   
                    tCell.Controls.Add(pnlDishItem);

                    //createCP(pnlDishItem.ID, lblMsg.ID);
                  
                }
                catch (Exception ex)
                {
                    //throw ex;
                }

                tRow.Cells.Add(tCell);
             
              
            }


            tblMenuItems.Rows.Add(tRow);
   


        }



                  Read Code



$(document).ready(function(){
LossAnalysisMananger={
init:function(){
LossAnalysisMananger.attachEventToLossReportTabs();
},
      showATCLossProgressReport:function(){
LossAnalysisMananger.ATCProgressReport.init();
},
attachEventToLossReportTabs:function(){
LossAnalysisMananger.showATCLossProgressReport();
},
ATCProgressReport:{
atcProgressReportData:[],
decremenetDay:30,
index:0,
regionSelected:'New Delhi',
duration:4,
frequency:'Weekly',
unfilteredField:{"ExpectedTimeScale":1},
abbrevatedMonthName:{"0":"Jan","1":"Feb","2":"Mar","3":"Apr","4":"May","5":"Jun","6":"Jul","7":"Aug","8":"Sept","9":"Oct","10":"Nov","11":"Dec"},
reportTemplate:'<div class="row">'+
' <div class="cell odd MaxLoss"></div>'+
' <div class="cell even MinLoss"></div>'+
' <div class="cell odd AvgLoss"></div>'+
' <div class="cell even addhight LossDurationInHoursWhereLossis4"></div>'+
' <div class="cell ExpectedTimeScale"></div>'+
'</div>',
init:function(){

var regionSelected=LossAnalysisMananger.ATCProgressReport.regionSelected;
var duration=LossAnalysisMananger.ATCProgressReport.duration;
var frequency=LossAnalysisMananger.ATCProgressReport.frequency;
var index=LossAnalysisMananger.ATCProgressReport.index;

regionSelected=regionSelected.toUpperCase();
//initially check daily report checkbox
var frequencyElementId=frequency.charAt(0).toLowerCase() +frequency.slice(1);
$("#atcLossProgressReportMainDiv #"+frequencyElementId).prop("checked",true);

DataLayer.ATCLossProgressReportHandlerLayer.fetchTableData(regionSelected,duration,frequency,index,function(atcProgressReportData){
LossAnalysisMananger.ATCProgressReport.atcProgressReportData=atcProgressReportData;

var data=atcProgressReportData;

LossAnalysisMananger.ATCProgressReport.setLowerAndUpperLimitOfData();
LossAnalysisMananger.ATCProgressReport.updateATCProgressReportTemp(data);
LossAnalysisMananger.ATCProgressReport.bindEventsToATCReport();

});

},
bindEventsToATCReport:function(){

LossAnalysisMananger.ATCProgressReport.bindEventToFilter();
LossAnalysisMananger.ATCProgressReport.loadMoreData();
LossAnalysisMananger.ATCProgressReport.attachPerfectScrollBar();
LossAnalysisMananger.ATCProgressReport.bindEventToRegionSelection();
LossAnalysisMananger.ATCProgressReport.bindEventToFrequencyChkBx();

//initially set scrollbar of progress report cell active
var perfectScrollBarElement=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
var row=$(perfectScrollBarElement).find(".row");
$(row[0]).find('.date').addClass('currentScrolledCell');
},
bindEventToFrequencyChkBx:function(){

$("#atcLossProgressReportMainDiv .frequencyRadioBtn").click(function(){
var frequency=$(this).val();

var regionSelected=LossAnalysisMananger.ATCProgressReport.regionSelected;
var duration=LossAnalysisMananger.ATCProgressReport.duration;
var index=LossAnalysisMananger.ATCProgressReport.index;

LossAnalysisMananger.ATCProgressReport.frequency=frequency;


regionSelected=regionSelected.toUpperCase();


DataLayer.ATCLossProgressReportHandlerLayer.fetchTableData(regionSelected,duration,frequency,index,function(atcProgressReportData){
LossAnalysisMananger.ATCProgressReport.atcProgressReportData=atcProgressReportData;

var data=atcProgressReportData;

LossAnalysisMananger.ATCProgressReport.setLowerAndUpperLimitOfData();
LossAnalysisMananger.ATCProgressReport.updateATCProgressReportTemp(data);
//LossAnalysisMananger.ATCProgressReport.bindEventsToATCReport();


var perfectScrollBarElement=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
//$(perfectScrollBarElement).perfectScrollbar('destroy');
//LossAnalysisMananger.ATCProgressReport.attachPerfectScrollBar();
LossAnalysisMananger.ATCProgressReport.setScrollBarPosition();
});
});
},
setScrollBarPosition:function(){
var progressReport=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
var row=$(progressReport).find(".row");
var widthPerCell=$(row).outerWidth();
var totalWidthOfAllCell=row.length*widthPerCell;

var perfectScrollBarElement=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
var left=totalWidthOfAllCell-$(perfectScrollBarElement).find(".ps-scrollbar-x-rail").width();
$(perfectScrollBarElement).scrollLeft(left);

$(perfectScrollBarElement).find('.ps-scrollbar-x').css('left',left);

},
attachPerfectScrollBar:function(){
setTimeout(function(){

var progressReport=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
var row=$(progressReport).find(".row");
var widthPerCell=$(row).outerWidth();
var totalWidthOfAllCell=row.length*widthPerCell;

$(".progressReportOuter .ProgressReport").width(totalWidthOfAllCell);
$('.progressReportOuter').perfectScrollbar({
suppressScrollY: true,
suppressScrollX: false,
minScrollbarLength: 120
});

$('.progressReportOuter').perfectScrollbar('update');

try{
$("#region_selection").selectbox();
}
catch(err){
console.log(err);
}

var perfectScrollBarElement=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
//var left=totalWidthOfAllCell-$(perfectScrollBarElement).find(".ps-scrollbar-x-rail").width();
//$(perfectScrollBarElement).scrollLeft(left);

//$(perfectScrollBarElement).find('.ps-scrollbar-x').css('left',left);

$(perfectScrollBarElement).scroll(function(){
$(perfectScrollBarElement).find(".cell").removeClass("currentScrolledCell");
var xRailElem=$(perfectScrollBarElement).find(".ps-scrollbar-x-rail");
var widthOfXRail =$(xRailElem).width();
//var leftOfWidthRail=$(xRailElem).attr("left");

var psContainerX=$(xRailElem).find(".ps-scrollbar-x");
var psContainerxWidth=$(psContainerX).width();
var psContainerLeft=$(psContainerX).position().left;

var currentPosition=psContainerLeft+psContainerxWidth;
//alert(psContainerLeft);
var  rowArray=$(perfectScrollBarElement).find("#aTCprogressReportRowDetail").find(".row");
var perElementWidth=widthOfXRail/rowArray.length;
var widthPerCell=Math.ceil(widthOfXRail/rowArray.length);
var totalTraverablePath=widthOfXRail-psContainerxWidth;
var unitTraversableWidth=totalTraverablePath/rowArray.length;

console.log("width of xrail "+widthOfXRail +" current position "+currentPosition +" : left "+psContainerLeft +" : wid "+ psContainerxWidth +" unit transverable "+unitTraversableWidth);
var rowToShown;
/*
if(psContainerLeft<100){
rowToShown =Math.floor(psContainerLeft/widthPerCell)+1;
}
else{
rowToShown =Math.floor(currentPosition/widthPerCell);
}
*/
rowToShown =Math.floor(psContainerLeft/unitTraversableWidth)+1;

if(psContainerLeft >=0 && psContainerLeft < (unitTraversableWidth-2) ){
console.log("extreme left");
var row=$(perfectScrollBarElement).find(".row");
$(row[0]).find('.ExpectedTimeScale').addClass('currentScrolledCell');
return ;
}

else if((currentPosition+unitTraversableWidth-2) >=  widthOfXRail){
console.log("extreme right ");
$(rowArray[rowArray.length-1]).find(".ExpectedTimeScale").addClass('currentScrolledCell');
//$(perfectScrollBarElement).find("."+rowArray.length).addClass('filteredCell');
return ;
}
else{
console.log("other");
$(rowArray[rowToShown]).find(".ExpectedTimeScale").addClass('currentScrolledCell');

}

//LossAnalysisMananger.ATCProgressReport.setScrollBarPosition();
//console.error("show row "+(rowToShown+2));

});
LossAnalysisMananger.ATCProgressReport.setScrollBarPosition();
},100);
},
bindEventToRegionSelection:function(){
$("#atcLossProgressReportMainDiv #region_selection").change(function(){

LossAnalysisMananger.ATCProgressReport.lowerIndex=0;
LossAnalysisMananger.ATCProgressReport.upperIndex=0;

LossAnalysisMananger.ATCProgressReport.regionSelected=$(this).val();

var regionSelected=LossAnalysisMananger.ATCProgressReport.regionSelected;
var duration=LossAnalysisMananger.ATCProgressReport.duration;
var frequency=LossAnalysisMananger.ATCProgressReport.frequency;
var index=LossAnalysisMananger.ATCProgressReport.index;
regionSelected=regionSelected.toUpperCase();

DataLayer.ATCLossProgressReportHandlerLayer.fetchTableData(regionSelected,duration,frequency,index,function(atcProgressReportData){
LossAnalysisMananger.ATCProgressReport.atcProgressReportData=atcProgressReportData;

var data=atcProgressReportData;

LossAnalysisMananger.ATCProgressReport.setLowerAndUpperLimitOfData();
LossAnalysisMananger.ATCProgressReport.updateATCProgressReportTemp(data);
//LossAnalysisMananger.ATCProgressReport.bindEventsToATCReport();
var perfectScrollBarElement=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
//$(perfectScrollBarElement).perfectScrollbar('destroy');
//LossAnalysisMananger.ATCProgressReport.attachPerfectScrollBar();
LossAnalysisMananger.ATCProgressReport.setScrollBarPosition();
});

/*
var perfectScrollBarElement=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
var row=$(perfectScrollBarElement).find(".row");
$(row[0]).find('.date').addClass('currentScrolledCell');

$(perfectScrollBarElement).scrollLeft(0);
*/
});
},
setLowerAndUpperLimitOfData:function(moveMonthBy){

var index=LossAnalysisMananger.ATCProgressReport.index;

var loadPrevDataBtn=$("#loadprevdataBtn");
var loadNextDataBtn=$("#loadnextdataBtn");

//alert((index == 0));
if(index == 0){
$(loadNextDataBtn).removeClass('enable');
$(loadNextDataBtn).addClass('disable');

$(loadPrevDataBtn).removeClass("disable");
$(loadPrevDataBtn).addClass("enable");
}else{


$(loadNextDataBtn).removeClass('disable');
$(loadNextDataBtn).addClass('enable');

//$(loadPrevDataBtn).removeClass("enable");
//$(loadPrevDataBtn).addClass("disable");
}




},
generateData:function(){

var abbreviateMonthMap=LossAnalysisMananger.ATCProgressReport.abbrevatedMonthName;

var date=new Date(2014,0,1);
var genereatedArray=[];
for(var i=0;i<364;i++){

var hrCount=generateRandomNumber(1,30);
var avgLoss= generateRandomNumber(1,30);
var minimiumLoss=generateRandomNumber(1,30);
var maximumLoss=generateRandomNumber(1,30);


//var randomDayToAdd=Math.floor(generateRandomNumber(1,10));
date.setDate(date.getDate()+1);

var year=date.getFullYear();
var month=date.getMonth();
var d=date.getDate();

month=month+1;
if(parseInt(month)<10){
month="0"+month;
//month=parseInt(month);
}

console.log("is date less than 10 "+(parseInt(d)<10));
if(parseInt(d)<10){
d="0"+d;
//d=parseInt(d);
}

var formattedDate= year+"-"+month+"-"+d ;
//var abbreviatedDate=abbreviateMonthMap[month] +" "+d+" "+year;

console.log("datde "+formattedDate);
//alert(formattedDate);

var obj={};
obj['time-in-hrs']= hrCount;
obj['avg-loss']   = avgLoss;
obj['min-loss']   = minimiumLoss;
obj['max-loss']   = maximumLoss;
obj['date']   = formattedDate.replace(/-/g, "/");
obj['original-date']   =new Date(formattedDate.replace(/-/g, "/"));
//obj['date-abrev']   = abbreviatedDate;

genereatedArray.push(obj);
}
LossAnalysisMananger.ATCProgressReport.atcProgressReportData=genereatedArray;
/*
$(genereatedArray).each(function(i,obj1){
for(key in obj1){
console.log("key  "+key +" : obj val "+obj1[key]);
}
});
*/


},
bindEventToFilter:function(){
var isopenAndClosezBtnClicked=false;
$(document).on('click',"#atcprogressreportfilter .sign",function(){
isopenAndClosezBtnClicked=!isopenAndClosezBtnClicked;
if($("#atcprogressfilerdrp").css('display') == 'none'){
$("#atcprogressfilerdrp").show();
}
else{
$("#atcprogressfilerdrp").hide();

}
event.stopPropagation();
});

var isColumnFilterBtnClicked=false;
$(document).on('click',"#timedurationfilter  .sign",function(event){
isColumnFilterBtnClicked=!isColumnFilterBtnClicked;
if($("#timedurationfilterdrp").css('display') == 'none'){
$("#timedurationfilterdrp").show();
}
else{
$("#timedurationfilterdrp").hide();

}
event.stopPropagation();
});


$(document).on('click',"#atcLossProgressReportMainDiv .filterSign",function(){

var parentDivOfDrpDwn=$(this).parents('div');
var btn=$(parentDivOfDrpDwn).prev().prev().prev();

var iconToChange=$(btn).find("i");
if($(this).hasClass("rightArrow")){
$(btn).find(".equalSign").hide();
$(btn).attr('class','btn-open-close greater');

$(iconToChange).show();
$(iconToChange).attr('class',"fa fa-angle-right sign");
}else if($(this).hasClass("leftArrow")){
$(btn).find(".equalSign").hide();
$(btn).attr('class','btn-open-close less');

$(iconToChange).show();
$(iconToChange).attr('class',"fa fa-angle-left sign");
}else{
$(btn).attr('class','btn-open-close equal');
$(btn).find(".equalSign").show();

$(iconToChange).hide();
}

$(parentDivOfDrpDwn).find('.filterCriteriaDrp').hide();
/*
isopenAndClosezBtnClicked=false;

var criteriaInput=$("#dtViewofATCLossSummary .filter-criteria input");
if(criteriaInput!=""){
$(criteriaInput).trigger('change');
}*/

if($(btn).attr("id") == "timedurationfilter"){
//filter by timeduration
var timeDurationInput=$("#timedurationfilterInput");
if($(timeDurationInput).val()!=""){
$(timeDurationInput).trigger('change');
isColumnFilterBtnClicked=false;
}
}else{
//filter by generice
var genericFilterInputElem=$("#genericFilter");
if($(genericFilterInputElem).val()!=""){
$(genericFilterInputElem).trigger('change');
isopenAndClosezBtnClicked=false;
}
}
});


$(document).on('change',"#genericFilter",function(){
if($("#atcprogressreportfilter").hasClass('down')){
alert("Please select filter criteria ");
return ;
}

var filteredCriteriaInput=$(this).val();
filteredCriteriaInput=parseFloat(filteredCriteriaInput).toFixed(2);
filteredCriteriaInput=parseFloat(filteredCriteriaInput);

var filteredSelectionBtn=$("#atcprogressreportfilter");
var filterCriteria=$(filteredSelectionBtn);

var data=LossAnalysisMananger.ATCProgressReport.atcProgressReportData;
var rowElements=$("#aTCprogressReportRowDetail .row");
$(rowElements).find(".cell").removeClass('filteredCell');

for(key in data[0]){

if(key.indexOf("(")!=-1){
key=key.replace("(",'');
}
if(key.indexOf(")")!=-1){
key=key.replace(")",'');
}
if(key.indexOf(">")!=-1){
key=key.replace(">",'');
}
if(key.indexOf("<")!=-1){
key=key.replace("<",'');
}

var keyName=key.split(" ").join('');

if(!(LossAnalysisMananger.ATCProgressReport.unfilteredField[keyName])){
var columnsElement=$(rowElements).find('.'+keyName);
$(columnsElement).each(function(i,obj){
var objVal=parseFloat(($(obj).html())).toFixed(2);
objVal=parseFloat(objVal);

console.log("filter "+($(filterCriteria).hasClass('greater')) +" filter val "+$(filterCriteria).attr('class') +" is greater "+(filteredCriteriaInput>objVal) +" input "+filteredCriteriaInput +" loop "+objVal);
if($(filterCriteria).hasClass('greater')){
if(objVal>filteredCriteriaInput){
$(obj).addClass('filteredCell');

}
}else if($(filterCriteria).hasClass('less')){
if(objVal<filteredCriteriaInput){
$(obj).addClass('filteredCell');
}
}else if($(filterCriteria).hasClass('equal')){
if(filteredCriteriaInput == objVal){
$(obj).addClass('filteredCell');
}
}
});
}
}
});

$(document).on('change',"#timedurationfilterInput",function(){
if($("#timedurationfilter").hasClass('down')){
alert("Please select filter criteria ");
return ;
}

var filteredCriteriaInput=$(this).val();
filteredCriteriaInput=parseFloat(filteredCriteriaInput).toFixed(2);
filteredCriteriaInput=parseFloat(filteredCriteriaInput);

var filteredSelectionBtn=$("#timedurationfilter");
var filterCriteria=$(filteredSelectionBtn);

var data=LossAnalysisMananger.ATCProgressReport.atcProgressReportData;
var rowElements=$("#aTCprogressReportRowDetail .row");
$(rowElements).find(".cell").removeClass('filteredCell');

var timeDurationColumnElem=$(rowElements).find('.LossDurationInHoursWhereLossis4');

$(timeDurationColumnElem).each(function(i,obj){
var objVal=parseFloat(($(obj).html())).toFixed(2);
objVal=parseFloat(objVal);

console.log("filter "+($(filterCriteria).hasClass('greater')) +" filter val "+$(filterCriteria).attr('class') +" is greater "+(filteredCriteriaInput>objVal) +" input "+filteredCriteriaInput +" loop "+objVal);
if($(filterCriteria).hasClass('greater')){
if(objVal>filteredCriteriaInput){
$(obj).addClass('filteredCell');

}
}else if($(filterCriteria).hasClass('less')){
if(objVal<filteredCriteriaInput){
$(obj).addClass('filteredCell');
}
}else if($(filterCriteria).hasClass('equal')){
if(filteredCriteriaInput == objVal){
$(obj).addClass('filteredCell');
}
}
});

});
},
loadMoreData:function(){
$(document).on('click','#loadprevdataBtn',function(event){

event.stopPropagation();
LossAnalysisMananger.ATCProgressReport.index=LossAnalysisMananger.ATCProgressReport.index-1;

var regionSelected=LossAnalysisMananger.ATCProgressReport.regionSelected;
var duration=LossAnalysisMananger.ATCProgressReport.duration;
var frequency=LossAnalysisMananger.ATCProgressReport.frequency;
var index=LossAnalysisMananger.ATCProgressReport.index;

LossAnalysisMananger.ATCProgressReport.setLowerAndUpperLimitOfData();
//
DataLayer.ATCLossProgressReportHandlerLayer.fetchTableData(regionSelected,duration,frequency,index,function(atcProgressReportData){
LossAnalysisMananger.ATCProgressReport.atcProgressReportData=atcProgressReportData;

var data=atcProgressReportData;


LossAnalysisMananger.ATCProgressReport.updateATCProgressReportTemp(data);
//LossAnalysisMananger.ATCProgressReport.bindEventsToATCReport();

var perfectScrollBarElement=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
//$(perfectScrollBarElement).perfectScrollbar('destroy');
//LossAnalysisMananger.ATCProgressReport.attachPerfectScrollBar();
LossAnalysisMananger.ATCProgressReport.setScrollBarPosition();
});


});
$(document).on('click','#loadnextdataBtn',function(event){
event.stopPropagation();

LossAnalysisMananger.ATCProgressReport.index=LossAnalysisMananger.ATCProgressReport.index+1;
var regionSelected=LossAnalysisMananger.ATCProgressReport.regionSelected;
var duration=LossAnalysisMananger.ATCProgressReport.duration;
var frequency=LossAnalysisMananger.ATCProgressReport.frequency;
var index=LossAnalysisMananger.ATCProgressReport.index;

LossAnalysisMananger.ATCProgressReport.setLowerAndUpperLimitOfData();
DataLayer.ATCLossProgressReportHandlerLayer.fetchTableData(regionSelected,duration,frequency,index,function(atcProgressReportData){
LossAnalysisMananger.ATCProgressReport.atcProgressReportData=atcProgressReportData;

var data=atcProgressReportData;


LossAnalysisMananger.ATCProgressReport.updateATCProgressReportTemp(data);
//LossAnalysisMananger.ATCProgressReport.bindEventsToATCReport();

var perfectScrollBarElement=$("#atcLossProgressReportMainDiv").find(".progressReportOuter");
//$(perfectScrollBarElement).perfectScrollbar('destroy');
//LossAnalysisMananger.ATCProgressReport.attachPerfectScrollBar();
LossAnalysisMananger.ATCProgressReport.setScrollBarPosition();
});
});
},
updateATCProgressReportTemp:function(data){
var reportParentDiv=$("#aTCprogressReportRowDetail");
$(reportParentDiv).find('.row').remove();


//alert("lower :"+lowerLimit +"   upper: "+upperLimit);
var abbreviateMonthMap=LossAnalysisMananger.ATCProgressReport.abbrevatedMonthName;
for(var i=0;i<data.length;i++){

var obj=data[i];
var progressReportTemplate=$(LossAnalysisMananger.ATCProgressReport.reportTemplate);
var j=1;
for(key in obj){
var keyValue=obj[key];

if(key.indexOf("(")!=-1){
key=key.replace("(",'');
}
if(key.indexOf(")")!=-1){
key=key.replace(")",'');
}
if(key.indexOf(">")!=-1){
key=key.replace(">",'');
}
if(key.indexOf("<")!=-1){
key=key.replace("<",'');
}

var keyName=key.split(" ").join('');

var element=$(progressReportTemplate).find("."+keyName);

if((LossAnalysisMananger.ATCProgressReport.unfilteredField[keyName])){
var className='cell '+" "+keyName +" "+(i+1);
element=$(element).attr('class',className);
}

/*
if(key == 'date'){

var d=new Date(keyValue.replace(/-/g, "/"));
var month=abbreviateMonthMap[d.getMonth()];
var date=d.getDate();
var yr=d.getFullYear();

element=$(element).addClass((i+1));
$(element).html(month +" "+date +"<br>"+yr);
console.log("html "+$(element).html() +"month "+month +" date "+date);
//$(progressReportTemplate).find("."+key).addClass((i+1));
//alert($(element).attr('class'));

}else{
$(element).html(keyValue);
}
*/
$(element).html(keyValue);

//alert($(element).html());
console.log("key "+key +" value "+keyValue +" html "+$(element).html());
}
//alert($(progressReportTemplate).html());
$(reportParentDiv).append(progressReportTemplate);
}

var genericFilterElem=$("#genericFilter");
if($(genericFilterElem).val()!=""){
$("#genericFilter").trigger('change');
}

var timeDurationFilterElem=$("#timedurationfilterInput");
if($(timeDurationFilterElem).val()!=""){
$(timeDurationFilterElem).trigger('change');
}
}
},

}
//LossAnalysisMananger.ATCProgressReport.init();
//LossAnalysisMananger.init();
//alert(window.parent.test);
});