Tuesday, 12 December 2017

Multilevel CheckBoxes



http://www.lidorsystems.com/support/articles/treeview-threestate.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function myPostBack() {
            var o = window.event.srcElement;
            if (o.tagName == "INPUT" && o.type == "checkbox") {
                __doPostBack("", "");
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <table>
            <tr>
                <td colspan="2">
                    <asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
                        <asp:ListItem Text="a" Value="a" />
                        <asp:ListItem Text="b" Value="b" />
                        <asp:ListItem Text="c" Value="c" />
                        <asp:ListItem Text="d" Value="d" />
                        <asp:ListItem Text="e" Value="e" />
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple"></asp:ListBox>
                </td>
                <td>
                    <asp:Button ID="Button1" runat="server" Text="Remove" OnClick="Button1_Click" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:TreeView ID="TreeView1" runat="server"  OnClick="myPostBack();" ShowCheckBoxes="All" OnTreeNodeCheckChanged="TreeView1_TreeNodeCheckChanged">
                    </asp:TreeView>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
public partial class listbox : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                TreeView1.Nodes.Add(new TreeNode("Fruits", "Fruits"));
                TreeView1.Nodes[0].ChildNodes.Add(new TreeNode("Mango", "Mango"));
                TreeView1.Nodes[0].ChildNodes.Add(new TreeNode("Apple", "Apple"));
                TreeView1.Nodes[0].ChildNodes.Add(new TreeNode("Pineapple", "Pineapple"));
                TreeView1.Nodes[0].ChildNodes.Add(new TreeNode("Orange", "Orange"));
                TreeView1.Nodes[0].ChildNodes.Add(new TreeNode("Grapes", "Grapes"));
                TreeView1.Nodes.Add(new TreeNode("Vegetables", "Vegetables"));
                TreeView1.Nodes[1].ChildNodes.Add(new TreeNode("Carrot", "Carrot"));
                TreeView1.Nodes[1].ChildNodes.Add(new TreeNode("Cauliflower", "Cauliflower"));
                TreeView1.Nodes[1].ChildNodes.Add(new TreeNode("Potato", "Potato"));
                TreeView1.Nodes[1].ChildNodes.Add(new TreeNode("Tomato", "Tomato"));
                TreeView1.Nodes[1].ChildNodes.Add(new TreeNode("Onion", "Onion"));
            }
        }
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox1.Items.Add(DropDownList1.SelectedValue);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            List<ListItem> deletedItems = new List<ListItem>();
            foreach (ListItem item in ListBox1.Items)
            {
                if (item.Selected)
                {
                    deletedItems.Add(item);
                }
            }
            if(deletedItems.Count>0)
            {
                foreach (ListItem item in deletedItems)
                {
                    ListBox1.Items.Remove(item);
                }
            }
            else
            {
                Response.Write("Please select an Item to delete");
            }
           
        }
        protected void TreeView1_TreeNodeCheckChanged(object sender, TreeNodeEventArgs e)
        {
            if (e != null && e.Node != null)
            {
                if (e.Node.ChildNodes.Count > 0)
                {
                    CheckTreeNodeRecursive(e.Node, e.Node.Checked);
                }
            }
        }
        private void CheckTreeNodeRecursive(TreeNode parent, bool fCheck)
        {
            foreach (TreeNode child in parent.ChildNodes)
            {
                if (child.Checked != fCheck)
                {
                    child.Checked = fCheck;
                }
                if (child.ChildNodes.Count > 0)
                {
                    CheckTreeNodeRecursive(child, fCheck);
                }
            }
        }
    }

Xml and webconfig file handling

<div dir="ltr" style="text-align: left;" trbidi="on">
<form id="form1" runat="server">
<script>
          
        </script>
    <br />
<div>
Text="&lt;% $Resources: MapRes, global_productName %&gt;"
        Text="&lt;%$  appsettings: gridPageSize %&gt;"
        <asp:dropdownlist id="DropDownList1" runat="server"></asp:dropdownlist>
    </div>
<br />
Text ='&lt;%# String.Format(HttpContext.GetGlobalResourceObject("MapRes", "parameterized_resourceKey").ToString(), "Every One") %&gt;'
  
        <asp:button id="Button1" onclick="Button1_Click" runat="server" text="Save">
        <asp:button id="SetSession" onclick="SetSession_Click" runat="server" text="SetSession">
        <asp:button id="EndSession" onclick="EndSession_Click" runat="server" text="EndSession">
    </asp:button></asp:button></asp:button></form>
public enum ConfigSettingName
    {
        mailConfig = 1,
        gridViewConfig
    }
    public enum ConfigAttribute
    {
        enableOutGoingMail=1,
        gridPageSize
    }
    public enum GlobalOption
    {
        paymentOption=1,
        statusOption,
        gridPageSizeOption
    }
    public enum AppSettingKey
    {
        enableMailSending=1,
        gridPageSize
    }


public partial class ResourcePlaying : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Page.DataBind();
                bind_ddl1();
                DateTime dt1 = new DateTime(1970, 01, 01);
                DateTime dt2 = DateTime.Now;
                Label3.Text = Convert.ToString((dt1 - dt2).TotalMilliseconds);
                Label3.Text = Label3.Text.Replace(".", "Hi");
            }
        }
        public void bind_ddl1()
        {
            //XmlDocument xdoc = new XmlDocument();
            //xdoc.Load(Server.MapPath("xml") + "\\default.xml");
            //string PreferenceXML = xdoc.InnerXml;
            //XmlNode paymentNode = xdoc.SelectSingleNode("globalOption");
            //XmlNodeList PaymentOption = paymentNode.SelectNodes("tab[@name='paymentOption']/option");
            //XmlNode statusNode = xdoc.SelectSingleNode("globalOption");
            //XmlNodeList statusOption = statusNode.SelectNodes("tab[@name='statusOption']/option");
            XmlNodeList statusOption = GetOptionNodeList(nameof(GlobalOption.gridPageSizeOption));
            DropDownList1.Items.Clear();
            foreach (XmlNode xnode in statusOption)
            {
                string name = xnode.Attributes["name"].Value;
                string value = xnode.Attributes["value"].Value;
                ListItem i = null;
                i = new ListItem(name, value);
                DropDownList1.Items.Add(i);
            }
            //DropDownList1.SelectedValue = GetConfigValueFromXML(nameof(ConfigSettingName.gridViewConfig),
            //                                                    nameof(ConfigAttribute.gridPageSize));
            DropDownList1.SelectedValue = GetAppSettingValue(nameof(AppSettingKey.gridPageSize));
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                // 1. Updating value in xml file
                // SetValueInXMLConfiguration(ConfigSettingName.gridViewConfig.ToString(),
                //                ConfigAttribute.gridPageSize.ToString(),
                //                DropDownList1.SelectedValue);
                // 2. Updating value in webconfig appsetting
                SetAppSettingValue(nameof(AppSettingKey.gridPageSize), DropDownList1.SelectedValue);
                if (IsMailingEnable())
                    Response.Write("Mail feature is enabled");
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString()); 
            }
        }
        private bool IsMailingEnable()
        {
            string val = string.Empty;
            //1. reading value from xml file
            val = GetConfigValueFromXML(nameof(ConfigSettingName.mailConfig), nameof(ConfigAttribute.enableOutGoingMail));
            //2. reading value from web.config file
            val = GetAppSettingValue(nameof(AppSettingKey.enableMailSending));
            bool staus = val == "1" ? true : false;
            return staus;
        }
        private void SetValueInXMLConfiguration(string settingName,string attributeName, string value, string fileType = "XML")
        {
            try
            {
                XmlDocument xdoc = new XmlDocument();
                xdoc.Load(Server.MapPath("xml") + "\\default.xml");
                string PreferenceXML = xdoc.InnerXml;
                //XmlNode mailConfig = xdoc.SelectSingleNode("globalOption/tab[@name='mailConfig']/setting");
                XmlElement xmlElement = (XmlElement)xdoc.SelectSingleNode("globalOption/tab[@name='configuration']/setting[@name='"+ settingName + "']");
                //XmlNode a = mailConfig.SelectSingleNode("setting/@id='1']");           
                if (xmlElement != null)
                {
                    //formData.SetAttribute("allowOutGoingMail", "1"); // Set to new value.
                    //formData.Attributes["enableOutGoingMail"].Value = value;
                    xmlElement.Attributes[attributeName].Value = value;
                    //Response.Write(xmlElement.Attributes[attributeName].Value);
                }
                xdoc.Save(Server.MapPath("xml") + "\\default.xml");
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
        private string GetConfigValueFromXML(string settingName, string attributeName)
        {
            string attributeValue = string.Empty;
            XmlDocument xdoc = new XmlDocument();
            xdoc.Load(Server.MapPath("xml") + "\\default.xml");
            string PreferenceXML = xdoc.InnerXml;
            XmlElement xmlElement = (XmlElement)xdoc.SelectSingleNode("globalOption/tab[@name='configuration']/setting[@name='" + settingName + "']");
            if (xmlElement != null)
                attributeValue = xmlElement.Attributes[attributeName].Value;
            return attributeValue;
        }
       
        public string GetAppSettingValue(string key)
        {
            string value = string.Empty;
            value= ConfigurationManager.AppSettings[key];
            return value;
        }
        public void SetAppSettingValue(string key, string newValue, string fileType="WebConfig")
        {
           
            //Helps to open the Root level web.config file.
            Configuration webConfigApp = WebConfigurationManager.OpenWebConfiguration("~");
            //Modifying the AppKey from AppValue to AppValue1
            webConfigApp.AppSettings.Settings[key].Value = newValue;
            //Save the Modified settings of AppSettings.
            webConfigApp.Save();
            //set value in aspx page directly
            //&lt;%$  appsettings: *KeyName * %&gt;
            //="&lt;%$ ConfigurationSettings.AppSettings["ImagePath"] %&gt;"
        }
        private XmlNodeList GetOptionNodeList(string optionField)
        {
            XmlDocument xdoc = new XmlDocument();
            xdoc.Load(Server.MapPath("xml") + "\\default.xml");
            string PreferenceXML = xdoc.InnerXml;
            XmlNode node = xdoc.SelectSingleNode("globalOption");
            XmlNodeList nodelist = node.SelectNodes("tab[@name='" + optionField + "']/option");
            //XmlNode statusNode = xdoc.SelectSingleNode("globalOption");
            //XmlNodeList statusOption = statusNode.SelectNodes("tab[@name='statusOption']/option");
            return nodelist;
        }
        protected void SetSession_Click(object sender, EventArgs e)
        {
            Session["IsUserValid"] = "Avi";
            ErrorReporting.Log.Info("Session Started: Logged form login page", "aspx page", "SetSession_Click");
        }
        protected void EndSession_Click(object sender, EventArgs e)
        {
            ErrorReporting.Log.Info("Logged form asax Session_End", "aspx page", "EndSession_Click");
            Session.Remove("IsUserValid");
            Session.RemoveAll();
            Response.Redirect("listbox.aspx");
        }
    }

default.xml
<globaloption>
  <tab id="1" name="paymentOption">
    <option name="Cash" value="Cash">
    <option name="Online" value="Online">
  </option></option></tab>
  <tab id="2" name="configuration">
    <setting enableoutgoingmail="1" name="mailConfig">
    <setting gridpagesize="150" name="gridViewConfig">
  </setting></setting></tab>
  <tab id="3" name="statusOption">
    <option name="Enable" value="1">
    <option name="Disable" value="0">
  </option></option></tab>
  <tab id="4" name="gridPageSizeOption">
    <option name="10" value="10">
    <option name="20" value="20">
    <option name="30" value="30">
    <option name="40" value="40">
    <option name="50" value="50">
    <option name="100" value="100">
    <option name="150" value="150">
    <option name="200" value="200">
  </option></option></option></option></option></option></option></option></tab>
</globaloption>

webconfig
<configuration>
 <appsettings>
    <add key="enableMailSending" value="1">
    <add key="gridPageSize" value="20">
  </add></add></appsettings>
</configuration></div>

Friday, 20 October 2017

SQL Basic

Create Database DatabaseName

Alter Database DatabaseName Modify Name= NewDatabaseName
Execute sp_renameDB'OldDatabaseName','NewDatabaseName'

Drop Database DatabaseName

Alter Database DatabaseName Set Single_User With Rollback Immediate

Use [DatabaseName]
Go
Create Table TableName,
(
FieldName1 Datatype Null/Not Null Primary Key,
FieldName2 Datatype Null/Not Null,
)

Foriegn Key relation mapping
--------------------------------
Alter Table ForeignKeyTable add constraint ForeignKeyTable_ForiegnKeyColumn_FK
FOREIGN KEY (ForiegnKeyColumn) references PrimaryKeyTable (PrimaryKeyColumn)

Altering an existing column to add a default constraint:
ALTER TABLE {TABLE_NAME}
ADD CONSTRAINT {CONSTRAINT_NAME}
DEFAULT {DEFAULT_VALUE} FOR {EXISTING_COLUMN_NAME}

Adding a new column, with default value, to an existing table:
ALTER TABLE {TABLE_NAME}
ADD {COLUMN_NAME} {DATA_TYPE} {NULL | NOT NULL}
CONSTRAINT {CONSTRAINT_NAME} CONSTRAINT_TYPE(e.g. Default, Check) {DEFAULT_VALUE}

Dropping a constraint:
ALTER TABLE {TABLE_NAME}
DROP CONSTRAINT {CONSTRAINT_NAME}


Cascading referential integrity
Options when setting up cascading referential integrity constraint:
1. No Action- this is default behaviour. No Action specifies that if an attempt is
made to delete or upgrade a row with a key referenced by foreign keys in existing
rows in the other tables, an erroe is raised and the DELETE or UPDATE is rollback.

2. Cascade- Specifies that if an attempt is made to delete or update a row with a
 key referenced by foreign keys in existing rows in other tables, all rows containing
 thoses foriegn keys are also deleted or updated.

3. Set NULL- Specifies that if an attempt is made to delete or update a row with a key
 referenced by foreign keys in existing rows in other tables, all rows containing
those foreign keys are set to NULL.

4. Set Default- Specifed that if an attemp is made to delete or upate a row with akey referenced
by foreign keys in existing rows in other tables, all rows containg those foreign keys are set to
 default values.


Check Constraint
CHECK Constraint is used to limit the range of the values, that can be entered for a column


Identity Column
To get last generated identity column value

Now: You can use SCOPE_IDENTITY(), @@IDENTITY, IDENT_CURRENT('TableName')

SCOPE_IDENTITY() :-Same Session and the same scope
@@IDENTITY :- Same session and across any scope
IDENT_CURRENT('TableName') :- Specific table across any session and any scope.


Primary Key and Unique Key
We use UNIQUE constraint to enforce uniqueness of a column i.e. the column should not
allow any duplicate values. We can add a Unique constraint thru the designer or uning a
query.


To create the unique key using a query.
Alter Table Table_Name
Add constraint constraint_Name Unique (Column_Name)

Difference between Primary Key and Unique Key
1. A table can have only one primary key, but more than one unique key
2. Primary key does not allow nulls, where as unique key allows one one null


Group By Clause


Inner Join- returns only the matching rows between both the tables. Non matching rows are eliminated.

Select LeftTableCoumns,RightTableColumns
from LeftTable
JOIN / INNER JOIN RightTable
ON LeftTable.MatchingColumn=RightColumn.MatchingColumn

Left Join / Left Outer Join- returns all the matching row + non matching rows from the left table

Select LeftTableCoumns,RightTableColumns
from LeftTable
LEFT JOIN / LEFT OUTER JOIN RightTable
ON LeftTable.MatchingColumn=RightColumn.MatchingColumn

Right Join / Right Outer Join - returns all the matching row + non matching row from the right table

Select LeftTableCoumns,RightTableColumns
from LeftTable
RIGHT JOIN / RIGHT OUTER JOIN RightTable
ON LeftTable.MatchingColumn=RightColumn.MatchingColumn

Full Join / Full Outer Join - returns all rows from both left and right table, including the non matching rows

Select LeftTableCoumns,RightTableColumns
from LeftTable
FULL JOIN / FULL OUTER JOIN RightTable
ON LeftTable.MatchingColumn=RightColumn.MatchingColumn


Cross Join- produces Cartesian product of the 2 tables involved in the join and does not require ON keyword

Select LeftTableCoumns,RightTableColumns
from LeftTable
CROSS JOIN RightTable

Monday, 11 September 2017

Elasticsearch

Elasticsearch

Introduction

ElasticSearch is a highly scalable open source search engine with a REST API that is hard not to love

Elasticsearch is a distributed RESTful search engine built for the cloud. Features include:
  • Distributed and Highly Available Search Engine.
    • Each index is fully sharded with a configurable number of shards.
    • Each shard can have one or more replicas.
    • Read / Search operations performed on any of the replica shards.
  • Multi Tenant.
    • Support for more than one index.
    • Index level configuration (number of shards, index storage, …).
  • Various set of APIs
    • HTTP RESTful API
    • Native Java API.
    • All APIs perform automatic node operation rerouting.
  • Document oriented
    • No need for upfront schema definition.
    • Schema can be defined for customization of the indexing process.
  • Reliable, Asynchronous Write Behind for long term persistency.
  • (Near) Real Time Search.
  • Built on top of Lucene
    • Each shard is a fully functional Lucene index
    • All the power of Lucene easily exposed through simple configuration / plugins.
  • Per operation consistency
    • Single document level operations are atomic, consistent, isolated and durable.
  • Open Source under the Apache License, version 2 (“ALv2”)

Elasticsearch is a highly available and distributed search engine. Each index is broken down into shards, and each shard can have one or more replica. By default, an index is created with 5 shards and 1 replica per shard (5/1). There are many topologies that can be used, including 1/10 (improve search performance), or 20/1 (improve indexing performance, with search executed in a map reduce fashion across shards).

Indexing

Elasticsearch is able to achieve fast search responses because, instead of searching the text directly, it searches an index instead.
This is like retrieving pages in a book related to a keyword by scanning the index at the back of a book, as opposed to searching every word of every page of the book.
This type of index is called an inverted index, because it inverts a page-centric data structure (page->words) to a keyword-centric data structure (word->pages).
Elasticsearch uses Apache Lucene to create and manage this inverted index.

How Elasticsearch represents data

In Elasticsearch, a Document is the unit of search and index.
An index consists of one or more Documents, and a Document consists of one or more Fields.
In database terminology, a Document corresponds to a table row, and a Field corresponds to a table column.

Schema

Unlike Solr, Elasticsearch is schema-free. Well, kinda.
Whilst you are not required to specify a schema before indexing documents, it is necessary to add mapping declarations if you require anything but the most basic fields and operations.
This is no different from specifying a schema!
The schema declares:
  • what fields there are
  • which field should be used as the unique/primary key
  • which fields are required
  • how to index and search each field
In Elasticsearch, an index may store documents of different "mapping types". You can associate multiple mapping definitions for each mapping type. A mapping type is a way of separating the documents in an index into logical groups.
To create a mapping, you will need the Put Mapping API, or you can add multiple mappings when you create an index.

Query DSL

The Query DSL is Elasticsearch's way of making Lucene's query syntax accessible to users, allowing complex queries to be composed using a JSON syntax.
Like Lucene, there are basic queries such as term or prefix queries and also compound queries like the bool query.
The main structure of a query is roughly:
curl -X POST "http://localhost:9200/blog/_search?pretty=true" -d
{"from": 0,
"size": 10,
"query" : QUERY_JSON,
FILTER_JSON,
FACET_JSON,
SORT_JSON
}

Summary


Elasticsearch is an open-source, broadly-distributable, readily-scalable, enterprise-grade search engine. Accessible through an extensive and elaborate API, Elasticsearch can power extremely fast searches that support your data discovery applications.


One of the options for indexing documents is the bulk indexing api. All we have is 10 JSON documents with very basic strings as properties. An "action_and_meta" tag is required for every document when bulk indexing to ensure Elasticsearch knows what we want to do. We have several options when bulk indexing (delete, update, and create), but we're just going to index our JSON documents. The name of our index is disney, and the type of documents we have is characters. We could use create, but that will fail if the document with the same index and type already exists. To make sure we don't run into problems with you already having a disney index with these documents, we will index every document. If you're looking to index from an existing dataset, we will go over some of those methods in the next episode. 


What is Elasticsearch
·         Open source search server based on Apache Lucene
·         Written in java
·         Cross-platform
·         Big focus on scalability-distributed from the ground up
·         Designed to take data from any souce, analyze it and search through it.
·         Communication with the search server is done through a HTTP REST API
·         Schema-less JSON documents
·         Near real-time search
                There is only a small latency i.e. fo one second from a document is indexed untill it is searchable.
 if one make changed into the index that change is propagated through clustr in one second and this is very impersive for a large cluster. this is because of distributed nature of the elasticsearch which makes it scalable.
Terminology
1.       Elasticsearch Cluster
·         A cluster is collection of nodes(server)
·         it may consists of one or more node depending on the scale or as many as node  require.
·         Nodes inside cluster contain all data which makes it extremely scalable.
·         A cluster provides indexing and search capability across all nodes. You don’t need worry about which node has the documents you are searching for.
·         Cluster has unique name, by which they can identified. By default, name is elastic search

2.       Node
·         A single server that is part of a cluster
·         Stores searchable data
o   Stores all data if there is only one node in the cluster, or part of teh data if there are multiple nodes.
·         Nodes participates in a cluster's indexing and search capabilities
·         Identified by a name (defaults to a random Marvel character)
·         A node joins a cluster named "elasticsearch" by default
·         Starting a single node on a network will by default create a new single-node cluster named "elasticsearch"

3.       Index = Equivalent to Database
·         A collection of documents (e.g. product, account, movie)
o   Each of the above example would be a type
·         Corresponds to a database withing a relational database system.
·         Identified by a name, which must be lowercased
o   Used when indexing, searching, updating and deleting documents within the index.
·         You can define as many index as you want within a cluster.

4.       Type = corresponds to a table
·         Represents a class/category of similar document, e.g. "User"
·         Consists of a name and mapping
·         Simplified, you can think of a type as a table within a relational database
·         An index can have one or more types defined, each with their own mapping
·         Stored within a metadata field named _type because Lucene has no concept of document types.
o   Searching for specific document types applies a filter on this field

5.       Mapping
·         Similar to a database schema for a table in a relational database
·         Describes the fields that a document of a given type may have
o   Includes the data type for each field, e.g. string, integer, date,...
o   Also includes information that it is optional to define a mapping explicitly.
·         Dynamic mapping means that it is optional to define a mapping explicitly.

6.       Document = corresponds to a row in a database table
·         A basic unit of information that can be indexed
·         Consists of fields, which are key/value pairs
o   A value can be a string, date, object, etc.
·         Corresponds to an object in object oriented programming language
o   A document can be a single user, order, product, etc.
·         Documents are expressed in JSON
·         Any no of documents can be stored within an index.

7.       Shards
·         An index can be divided into multiple piece called shards
o   Useful if an index contains more data than the hardware of a node can store (e.g. 1 TB data on a 500 GB disk.)
·         A shard is a fully functional and independent index
o   can be stored on any node in a cluster.
·         The number of shards can be specified when creating an index
·         Allows to scale horizontally by content volume (index space)
·         Allows to distribute and parallelize operation across shards, which increases performance.

8.       Replicas
·         A replica is a copy of shard
·         Provides high availability in case a shards or node fails
o   A replica never resides on the same nodes the original shards
·         Allows scaling search volume, because search queries can be executed on all replicas in parallel

·         By default, Elasticsearch adds 5 primary shards and 1 replicas for each index.


index- database
type- table in a db
document- row in a db table
field of document- column

mapping- schema 

Friday, 24 March 2017

Update progress in asp.net c# with master page

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="Life_Cycle.Site1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
        <style type="text/css">
        body {
            margin: 0;
            padding: 0;
            font-family: Arial;
        }

        .modal {
            position: fixed;
            z-index: 999;
            height: 100%;
            width: 100%;
            top: 0;
            background-color: Black;
            filter: alpha(opacity=60);
            opacity: 0.4;
            -moz-opacity: 0.6;
        }

        .center {
            z-index: 1000;
            margin: 300px auto;
            padding: 10px;
            width: 130px;
            background-color: White;
            border-radius: 10px;
            filter: alpha(opacity=100);
            opacity: 1;
            -moz-opacity: 1;
        }

            .center img {
                height: 128px;
                width: 128px;
            }
    </style>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                <ProgressTemplate>
                    <div class="modal">
                        <div class="center">
                            <img alt="Processing..." src="loader.gif" />
                        </div>
                    </div>
                </ProgressTemplate>
            </asp:UpdateProgress>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

                    </asp:ContentPlaceHolder>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>


In Child page

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <asp:Button ID="Button1" Text="Submit" runat="server" OnClick="Button1_Click" />
</asp:Content>

in child page code behind
protected void Button1_Click(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(5000);
        }