<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3426742870147240265</id><updated>2026-10-09T00:18:39.932-07:00</updated><category term="jQuery"/><category term="Javascript"/><category term="silverlight"/><category term="Asp.Net AJAX"/><category term="OpenCV"/><category term="jQuery CreateTable Plug-in"/><category term="Google API&#39;s"/><category term="HttpHandlers"/><category term="HttpWebRequest"/><category term="LINQ to SQL"/><category term="Web Application Architecute"/><category term="configuration"/><category term="webservice"/><title type='text'>Asp.Net: How Do I?</title><subtitle type='html'>How to start developing better asp.net applications</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-9222410828606418881</id><published>2012-03-10T13:46:00.000-08:00</published><updated>2012-03-10T13:46:11.666-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="configuration"/><category scheme="http://www.blogger.com/atom/ns#" term="silverlight"/><category scheme="http://www.blogger.com/atom/ns#" term="webservice"/><title type='text'>simple Web Service Agent Pattern Webservice Endpoint configuration for local/live hosting</title><content type='html'>Setting up webservice to consume is difficult as it has to be hosted in different enviornements and sometime it is difficult to understand the webservice call errors when moving from local to live hosting. Most of the time we rely on auto generated Urls in configuration files. &lt;br /&gt;
&lt;br /&gt;
Best way to handle such situation is to properly configure Urls in local and hosting enviornements. But if it is required to configure the webservice from code behind, i have a simple solution.&lt;br /&gt;
&lt;br /&gt;
Other than that i am going to introduce you to service agent pattern. This is a very simple and generic pattern for Asynchoronous web clients like silverlgiht. This helps configure webservice in reuseable way and makes testing easier. Helps in plugable webservice, and specially in IoC/Dependecny injections.&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;namespace FileUploader.ServiceAgents
{
    public interface IImageServiceAgent
    {
        void SaveImage(byte[] buffer, string fileName, EventHandler&lt;SaveImageCompletedEventArgs&gt; callback);
    }

    public class ImageServiceAgent : IImageServiceAgent
    {
        private readonly ImageServiceSoapClient _proxy;


        public ImageServiceAgent()
        {
            Binding binding = new BasicHttpBinding();
            var endpoint = new EndpointAddress(
                new Uri(Application.Current.Host.Source, &quot;../Webservices/ImageService.asmx&quot;));
            _proxy = new ImageServiceSoapClient(binding, endpoint);
        }

        #region IImageServiceAgent Members

        public void SaveImage(byte[] buffer, string fileName, EventHandler&lt;SaveImageCompletedEventArgs&gt; callback)
        {
            _proxy.SaveImageCompleted += callback;
            _proxy.SaveImageAsync(buffer,fileName);
        }

        #endregion
    }
}
&lt;/pre&gt;&lt;br /&gt;
Lets start with the inteface. First line defines the IImageServiceAgent. This interface lists all the functions of webservice along with their call backs.&lt;br /&gt;
&lt;br /&gt;
In the implemenations, it has service client that is using basicHttpBinding with endpoint configuraiton in such a way that it will automatically handle any enviornment given that your client and web service is hosted in the same hosting url.&lt;br /&gt;
&lt;br /&gt;
Implementaion of SaveImage is simple, first it subscribes to SaveImageCompleted call back and then calls the Async client.&lt;br /&gt;
&lt;br /&gt;
This is a good way as it can helps using anonymous functions in a good way. Let me know if this helps you or you have a better solution to today world coding standards.</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/9222410828606418881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2012/03/simple-web-service-agent-pattern.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/9222410828606418881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/9222410828606418881'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2012/03/simple-web-service-agent-pattern.html' title='simple Web Service Agent Pattern Webservice Endpoint configuration for local/live hosting'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-2806966818603928551</id><published>2011-04-19T03:36:00.000-07:00</published><updated>2011-04-19T04:01:25.969-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>single line news/feed scroller with jQuery</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;How Do I? Single Line news/feed Scroller with jQuery&lt;/h1&gt;&lt;/div&gt;&lt;div class=&quot;subhead&quot;&gt;Working Preview:&lt;br /&gt;
&lt;/div&gt;&lt;style type=&quot;text/css&quot;&gt;
#dvHeadlines
{
    width:200px;
    background-color:lightgray;
}
li
{
    list-style-type: none;
}
&lt;/style&gt;&lt;br /&gt;
&lt;div id=&quot;dvHeadlines&quot;&gt;&lt;ul id=&quot;ulHeadlines&quot;&gt;&lt;li&gt;scroll headline 1&lt;/li&gt;
&lt;li&gt;scroll headline 2&lt;/li&gt;
&lt;li&gt;scroll headline 3&lt;/li&gt;
&lt;li&gt;scroll headline 4&lt;/li&gt;
&lt;li&gt;scroll headline 5&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;script type=&quot;text/javascript&quot;&gt;
//call the function when document is ready to start the scrolling
$(function(){
    ScrollMessages(&quot;ulHeadlines&quot;,true,3000,1000);
});

function ScrollMessages(ulId,isFirstTime,scrollTimeInterval,animationTimeInterval) 
{
    //Get the Unordered List
    var ul=$(&quot;#&quot;+ulId);
    //Get all List Items
    var lis=$(&quot;li&quot;, ul);
    //If it is not the first time, Current item is the visible one
    var current = $(&quot;li:visible:first&quot;, ul);
    //if it is the first time, it is the first item of list. Show the first item of list 
    if(isFirstTime)
    {
        //hide all list items
        lis.hide();  
        //get the first list item
        current=$(&quot;li:first&quot;,ul);
        //show only the first item
        current.show();
    }
    //if it is not the first time then calculate the next item to show and show that item.
    else
    {
        //Get the index of item that will be shown 
        var index=current.index();
        //if it is the last item then current items should be the first item of list else it should be the next item of list
        if (index + 1 == lis.size()) {
            index = 0;
        }
        else {
           index += 1;
        }
        //slide up and hide the current item
        current.slideUp(animationTimeInterval);
        //slide down the next item that is going to be shown 
        $(&quot;li:eq(&quot; + index + &quot;)&quot;, ul).slideDown(animationTimeInterval);
    }
    //re call this funcation to continue the scroll news recursively
    setTimeout(function(){ScrollMessages(ulId,false,scrollTimeInterval,animationTimeInterval);}, scrollTimeInterval);
}
&lt;/script&gt;&lt;br /&gt;
While working on my own, I decided to implement a very simple news/feed one line scroller. Idea is simple and in use a lot of websites. Doing it with jQuery is a pleasure. &lt;br /&gt;
&lt;br /&gt;
It will use the Unordered List and will scroll each List Item according to predefined scroll interval. Also while this scrolling is going on, each item will do it with Scroll animation of jQuery.&lt;br /&gt;
&lt;br /&gt;
It is a recursive function and it will schedule call with itself again and again to continue scrolling. It has no stopping criteria as associated with must do recursive functions as it required to be scrolled all the time.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Parameters Detail&lt;/div&gt;It takes 4 parameters.&lt;br /&gt;
Unordered List Id: ulId&lt;br /&gt;
If you call it firstTime then this bit will be true : isFirstTime&lt;br /&gt;
Time between next news/feed:  scrollTimeInterval&lt;br /&gt;
Time of animation when changing news/feed: animationTimeInterval&lt;br /&gt;
&lt;br /&gt;
Please see the code as listed below and download link is at the end of this article.&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;//call the function when document is ready to start the scrolling
$(function(){
    ScrollMessages(&quot;ulHeadlines&quot;,true,3000,1000);
});

function ScrollMessages(ulId,isFirstTime,scrollTimeInterval,animationTimeInterval) 
{
    //Get the Unordered List
    var ul=$(&quot;#&quot;+ulId);
    //Get all List Items
    var lis=$(&quot;li&quot;, ul);
    //If it is not the first time, Current item is the visible one
    var current = $(&quot;li:visible:first&quot;, ul);
    //if it is the first time, it is the first item of list. Show the first item of list 
    if(isFirstTime)
    {
        //hide all list items
        lis.hide();  
        //get the first list item
        current=$(&quot;li:first&quot;,ul);
        //show only the first item
        current.show();
    }
    //if it is not the first time then calculate the next item to show and show that item.
    else
    {
        //Get the index of item that will be shown 
        var index=current.index();
        //if it is the last item then current items should be the first item of list else it should be the next item of list
        if (index + 1 == lis.size()) {
            index = 0;
        }
        else {
           index += 1;
        }
        //slide up and hide the current item
        current.slideUp(animationTimeInterval);
        //slide down the next item that is going to be shown 
        $(&quot;li:eq(&quot; + index + &quot;)&quot;, ul).slideDown(animationTimeInterval);
    }
    //re call this funcation to continue the scroll news recursively
    setTimeout(function(){ScrollMessages(ulId,false,scrollTimeInterval,animationTimeInterval);}, scrollTimeInterval);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;a href=&#39;https://rapidshare.com/files/458154604/Single_Line_News_Feed_Scroller_jQuery_aspilham.blogspot.com.html&#39;&gt;Click here to download sample&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/2806966818603928551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/04/single-line-newsfeed-scroller-with.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/2806966818603928551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/2806966818603928551'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/04/single-line-newsfeed-scroller-with.html' title='single line news/feed scroller with jQuery'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-4634423880611404820</id><published>2011-04-18T02:37:00.000-07:00</published><updated>2011-04-18T02:37:50.746-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>check/uncheck all records using jQuery</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;How Do I? check/uncheck all checkboxed on header check box click using jQuery&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;
Working with tables using javascript became easy with jQuery or even with any sort of DOM manipulation. There is one task we repeatedly do i.e. to check/uncheck all the records. Even though its not a difficult problem and usually everybody has its own implementation of this activity. There is perhaps a generic code written which is used by all.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Small challenge:&lt;/div&gt;There is one complexity with this scenario. If all checkbox are selected, then header checkbox should be checked. So in any case if a user uncheck any of record checkbox, it should uncheck the header checkbox also and vice versa if user manually select all records then header checkbox should be checked&lt;br /&gt;
The following code is written to overcome such situation in minimum line of codes. Please see the comments and implementation and let me know if you like this approach.&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;//call the function when document is ready to bind the events with header checkbox to select/unselect all
$(function(){
    //call the function on document ready function
    SelectAll(&quot;tblTest&quot;,&quot;cbHeader&quot;);
});

function SelectAll(tableID,cbHeaderID)
{
    //select the table that has the checkboxes
    var table=$(&quot;table[id$=&#39;&quot;+tableID+&quot;&#39;]&quot;);
    //bind event with header checkbox change event
    $(&quot;input[id$=&#39;&quot;+cbHeaderID+&quot;&#39;]&quot;,table).change(function(){
    //check/uncheck all the checkboxes based on header element status
    $(&quot;input:checkbox&quot;,table).attr(&#39;checked&#39;,$(this).attr(&#39;checked&#39;));});
    //bind event with all the other checkboxes 
    $(&quot;input:checkbox:gt(0)&quot;,table).change(
    function(){  
        // if number of checked checkboxes are les than number of checkboxes than uncheck the header checkbox
        var isAllChecked=$(&quot;input:checkbox:gt(0)&quot;,table).size() &gt; $(&quot;input:checkbox:checked:not(#&quot;+cbHeaderID+&quot;)&quot;,table).size()?false:true;
        $(&quot;input:checkbox:first&quot;,table).attr(&#39;checked&#39;,isAllChecked);
    });
    
}
&lt;/pre&gt;&lt;br /&gt;
&lt;a href=&#39;https://rapidshare.com/files/457969981/Check_UnCheck_All_Records_jQuery.html&#39;&gt;Click here to download the sample page&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/4634423880611404820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/04/checkuncheck-all-records-using-jquery.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/4634423880611404820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/4634423880611404820'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/04/checkuncheck-all-records-using-jquery.html' title='check/uncheck all records using jQuery'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-898305543237363733</id><published>2011-04-18T00:23:00.000-07:00</published><updated>2011-04-18T02:42:27.355-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>show hide columns of table in jQuery</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;How Do I? Show/hide columns of table based on Multi Select list box in jQuery&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;
Large reports with many columns you must give some extra customization. One of them is to show hide columns based on a multi select list. This article describes the easiest way of doing it with a generic code.&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Assumption:&lt;/div&gt;Table is well formatted i.e.  it has a thead and tbody tag. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Brief Description:&lt;/div&gt;When page load and document ready function is fired, it will bind a function to change event of multiple select list.&lt;br /&gt;
It then loop over the whole select options to see the selected items and hide then if they are selected or show them if they are not selected.&lt;br /&gt;
Here is the code,&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;$(function(){
// add an function on multiple select list ddlcolumns change event
    $(&quot;#ddlColumns&quot;).change(function(){
        //get the table whose columns will be manipulated
        var table=$(&quot;#tblTest&quot;);
        //get the first row or thead row
        var headerRow=$(&quot;tr:first&quot;,table);
        // loop over each option in multiple select list
        $(&quot;option&quot;,this).each(function(){
            //get the index of current option value e.g. &quot;Header 1&quot;
            var index=$(&quot;th:contains(&quot;+this.value+&quot;)&quot;).index();
            // if current option is selected then hide the column along with header else show the column if it is already hidden
            if($(this).attr(&#39;selected&#39;))
            {
                $(&quot;td:nth-child(&quot;+(index+1)+&quot;),th:nth-child(&quot;+(index+1)+&quot;)&quot;,table).hide();
            }
            else
            {
                $(&quot;td:nth-child(&quot;+(index+1)+&quot;),th:nth-child(&quot;+(index+1)+&quot;)&quot;,table).show();
            }
        });
    });
});
&lt;/pre&gt;&lt;br /&gt;
I hope this will help.&lt;br /&gt;
&lt;a href=&#39;https://rapidshare.com/files/457957836/Show_Hide_Table_Columns_Based_On_Multi_Select_Box.html&#39;&gt; Click here to Download sample&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/898305543237363733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/04/show-hide-columns-based-of-table-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/898305543237363733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/898305543237363733'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/04/show-hide-columns-based-of-table-in.html' title='show hide columns of table in jQuery'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-6845438497044801023</id><published>2011-03-05T02:17:00.000-08:00</published><updated>2011-03-05T04:54:38.570-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net AJAX"/><category scheme="http://www.blogger.com/atom/ns#" term="HttpHandlers"/><category scheme="http://www.blogger.com/atom/ns#" term="HttpWebRequest"/><title type='text'>File uploading in chunks using HttpHandler and HttpWebRequest</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;How Do I? File uploading in chunks using HttpHandler and HttpWebRequest&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;
This is a sample code that shows how to upload file using HttpHandler in chunks. This may not seems like a very good idea in isolation but this could help when creating a file upload control in Silverlight.  I already have an article that shows how to upload file using web service in chunk.&lt;a href=&#39;http://aspilham.blogspot.com/2010/04/file-upload-in-chunks-using-silverlight.html&#39;&gt; You can read this article here&lt;/a&gt;. When talk about file uploading using web service, it has many disadvantages like 1- it has a limit of sending and receiving data and 2- it pads data that increase the sending data, to name a few problems.&lt;br /&gt;
&lt;br /&gt;
HttpHandlers are better in many ways; this technique could be used to enable huge files. It will understand the entire authentication and authorization constrains already implemented in your web application.&lt;br /&gt;
This article has two distinct parts&lt;br /&gt;
1- How to send data in chunks using HttpWebRequest&lt;br /&gt;
2- How to receive and save data in HttpHandler&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Sending data in chunks&lt;/div&gt;The implementation of HttpWebRequest is very simple. It has the following steps&lt;br /&gt;
1- Open a file&lt;br /&gt;
2- Start reading a chunk &lt;br /&gt;
3- Convert the chunk in Base64 String&lt;br /&gt;
4- Send the chunk to HttpHandler along with some basic file information e.g. file name&lt;br /&gt;
&lt;br /&gt;
HttpWebRequest will post data to HttpHandler because of data limitation and sercurity of data in a Key-Value pair.&lt;br /&gt;
&lt;br /&gt;
And here is the code&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Function that will convert the file into chunk requests&lt;/div&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;c-sharp&quot;&gt;private void ConvertToChunks()
{
 //Open file
 string file = MapPath(&quot;~/temp/1.xps&quot;);
 FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read);
 //Chunk size that will be sent to Server
 int chunkSize = 1024;
 // Unique file name
 string fileName = Guid.NewGuid() + Path.GetExtension(file);
 int totalChunks = (int)Math.Ceiling((double)fileStream.Length / chunkSize);
 // Loop through the whole stream and send it chunk by chunk;
  for (int i = 0; i &lt; totalChunks; i++)
  {
    int startIndex = i * chunkSize;
    int endIndex = (int)(startIndex + chunkSize &gt; fileStream.Length ?   fileStream.Length : startIndex + chunkSize);
    int length = endIndex - startIndex;

    byte[] bytes = new byte[length];
    fileStream.Read(bytes, 0, bytes.Length);
    ChunkRequest(fileName, bytes);
  }
}
&lt;/pre&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Function that will send the chunk to httpHandler&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;c-sharp&quot;&gt;private void ChunkRequest(string fileName,byte[] buffer)
{
 //Request url, Method=post Length and data.
 string requestURL = &quot;http://localhost:63654/hello.ashx&quot;;
 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestURL);
 request.Method = &quot;POST&quot;;
 request.ContentType = &quot;application/x-www-form-urlencoded&quot;;

 // Chunk(buffer) is converted to Base64 string that will be convert to Bytes on  the handler.
 string requestParameters = @&quot;fileName=&quot; + fileName +
&quot;&amp;data=&quot; + HttpUtility.UrlEncode( Convert.ToBase64String(buffer) );

 // finally whole request will be converted to bytes that will be transferred to HttpHandler
 byte[] byteData = Encoding.UTF8.GetBytes(requestParameters);

 request.ContentLength = byteData.Length;

 Stream writer = request.GetRequestStream();
 writer.Write(byteData, 0, byteData.Length);
 writer.Close();
// here we will receive the response from HttpHandler
 StreamReader stIn = new StreamReader(request.GetResponse().GetResponseStream());
 string strResponse = stIn.ReadToEnd();
 stIn.Close();
}
&lt;/pre&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Receiving and saving Chunk data in HttpHandler&lt;/div&gt;It will&lt;br /&gt;
1- Receive the chunk and file information&lt;br /&gt;
2- Convert back the chunk to byte[] from Base64 string&lt;br /&gt;
3- Save the chunk by&lt;br /&gt;
a. Creating a new file if file not existed&lt;br /&gt;
b. Opening the existing file&lt;br /&gt;
&lt;br /&gt;
Here is the Code&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Function that will receive the request in HttpHandler&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;c-sharp&quot;&gt;public void ProcessRequest(HttpContext context)
{
 //write your handler implementation here.

 string fileName = context.Request.Params[&quot;fileName&quot;].ToString();
 byte[] buffer = Convert.FromBase64String ( context.Request.Form[&quot;data&quot;]);
 SaveFile(fileName, buffer);
}
&lt;/pre&gt;&lt;div class=&quot;subhead&quot;&gt;Function that will Save the file &lt;/div&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;c-sharp&quot;&gt;public void SaveFile(string fileName, byte[] buffer)
{
 string Path = HttpContext.Current.Server.MapPath(&quot;~/upload&quot;) +&quot;\\&quot;+ fileName;
 FileStream writer = new FileStream(Path,File.Exists(Path)?FileMode.Append:FileMode.Create, FileAccess.Write);

 writer.Write(buffer, 0, buffer.Length);
 writer.Close();
}
&lt;/pre&gt;&lt;br /&gt;
To use HttpHandler, it must be configured in web.conf like shown below&lt;br /&gt;
&amp;lt;add verb=&quot;*&quot; path=&quot;*.ashx&quot; type=&quot;handlertest.IISHandler1, handlertest&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hope this will help , &lt;a href=&#39;http://rapidshare.com/files/451027618/AspIlham.blogspot.com_File_Upload_In_Chunks_HttpHandler_HttpWebRequest.rar&#39;&gt;Please click here to download the sample application.&lt;/a&gt; Please see the Default.aspx.cs for HttpWebRequest section and IISHandler1.cs for HttpHandler section.</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/6845438497044801023/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/03/file-uploading-in-chunks-using.html#comment-form' title='187 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/6845438497044801023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/6845438497044801023'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/03/file-uploading-in-chunks-using.html' title='File uploading in chunks using HttpHandler and HttpWebRequest'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>187</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-2931990403816309309</id><published>2011-02-12T13:15:00.000-08:00</published><updated>2011-03-05T05:01:55.451-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery CreateTable Plug-in"/><title type='text'>Using jQuery CreateTable Plug-in to convert JSON into Table</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;How Do I? Explanation of jQuery Create Table Plug-in to convert JSON into table easily&lt;/h1&gt;&lt;/div&gt;&lt;a href=&#39;http://rapidshare.com/files/447601523/jQuery_CreateTable_Plug-in_Samples.zip&#39;&gt;Download Plug-in and sample&lt;/a&gt;&lt;br /&gt;
&lt;a href=&#39;http://rapidshare.com/files/447601524/jQuery_Plug-in_CreateTable_Asp.Net_Ajax_Sample.zip&#39;&gt;Download Asp.Net ajax sample and Plug-in&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Template &lt;/div&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot; id=&#39;tbl&#39;&gt;&lt;thead&gt;
&lt;tr&gt; &lt;th&gt;{sr}&lt;/th&gt; &lt;th&gt;{Name}&lt;/th&gt; &lt;th&gt;{Mobile}&lt;/th&gt; &lt;th&gt;{isActive}&lt;/th&gt; &lt;/tr&gt;
&lt;/thead&gt; &lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;{sr}&lt;/td&gt; &lt;td style=&quot;text-align:left;&quot;&gt;{FirstName} {LastName}&lt;/td&gt; &lt;td&gt;{Mobile}&lt;/td&gt; &lt;td&gt;{isActive}&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt; &lt;tfoot&gt;
&lt;tr&gt; &lt;td colspan=&quot;4&quot;&gt;{Pager}&lt;/td&gt; &lt;/tr&gt;
&lt;/tfoot&gt; &lt;/table&gt;&lt;br /&gt;
This is a complete template that contains a header, body and footer. It must have thead/tbody and tfoot for properly converting a table.&lt;br /&gt;
&lt;br /&gt;
After creating a templat, get the data from server and pass it by using the following syntax&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;$(&quot;table&quot;).CreateTable({ Body: data });&lt;/pre&gt;&lt;br /&gt;
That leads us to all available configuration and options. Here are the list of options that can be passed with their default values.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;{ Head: null, Body: null, AjaxPager: false, CurrentPage: 0, TotalPages: 0, PageSize: 10, Pager: true,OnRow_Bounded:null,OnPager_Clicked:null }&lt;/pre&gt;&lt;br /&gt;
To build a simple talbe only data is required and it automatically do the rest. But to use ajax pager that will be called on each page change and doing extra when data binding with each row requires more options to configure.&lt;br /&gt;
&lt;br /&gt;
If You want to pass a function that will be called on each row creation, here is what you should you&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;$(&quot;table&quot;).CreateTable({ Body: data,OnRow_Bounded:yourCallBackFunction });&lt;/pre&gt;&lt;br /&gt;
This function will be passed the row type (head,body) as first argument and the data that is being bounded to this row and the row (tr) itself. Here you can do special tasks like convert the bounded boolan to a checkbox as you can see in the below code&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;function OnRow_Bounded(rowData, row, rowType) 
{
    if (rowType == &quot;body&quot;) 
    {
      var status_checkbox = $(&quot;&amp;lt;input type=&#39;checkbox&#39;/&amp;gt;&quot;).attr(&#39;checked&#39;, rowData[&quot;isActive&quot;]).bind(&#39;click&#39;, rowData, EmployeeStatus_Change);
      $(&quot;td:contains(&quot; + rowData[&quot;isActive&quot;] + &quot;)&quot;, row).text(&#39;&#39;).append(status_checkbox);

    }
  return row;
}
&lt;/pre&gt;&lt;div class=&quot;subhead&quot;&gt;Pager:&lt;/div&gt;You can turn off pager by setting Pager:false.&lt;br /&gt;
&lt;br /&gt;
Using ajax data source with pager.&lt;br /&gt;
&lt;br /&gt;
Pager will generate next/previous according to total records and page size but it can be forsed to set as an Ajax pager. In this mode, total pages will be set in options along with ajax pager set to true as shown blow&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;$(&quot;table&quot;).CreateTable({ Body: null, TotalPages: 10, AjaxPager: true });
&lt;/pre&gt;&lt;br /&gt;
This will give an object that could be used to refresh table when a record is received. A sample is included in the download that shows how to do it in Asp.Net.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Exposed Object:&lt;/div&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;Var tble=$(&quot;table&quot;).CreateTable({ Body: null, TotalPages: 10, AjaxPager: true });&lt;/pre&gt;&lt;br /&gt;
Gives an object of type Table that is created to build a table from template using the provided data. This object has the exposure to all the internal data and functions. Lets assume that you just want to change the data source but not the current page or anything else. This situation can be handled by simply using the following code&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;tble.Body= your new data source here;
tble.Refresh();
&lt;/pre&gt;and here you go with your new data source.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#39;http://rapidshare.com/files/447601523/jQuery_CreateTable_Plug-in_Samples.zip&#39;&gt;Download Plug-in and sample&lt;/a&gt;&lt;br /&gt;
&lt;a href=&#39;http://rapidshare.com/files/447601524/jQuery_Plug-in_CreateTable_Asp.Net_Ajax_Sample.zip&#39;&gt;Download Asp.Net ajax sample and Plug-in&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/2931990403816309309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/02/using-jquery-createtable-plug-in-to.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/2931990403816309309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/2931990403816309309'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/02/using-jquery-createtable-plug-in-to.html' title='Using jQuery CreateTable Plug-in to convert JSON into Table'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-5775145410952616473</id><published>2011-02-12T08:48:00.000-08:00</published><updated>2011-03-05T05:08:56.717-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery CreateTable Plug-in"/><title type='text'>Create a jquery plug-in : creating a jquery plug-in that can convert JSON array into table</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;How Do I? Create a jquery plug-in : creating a jQuery plug-in that can convert JSON array into table&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;
&lt;a href=&#39;http://rapidshare.com/files/447560766/jQuery-CreateTable-PlugIn.zip&#39;&gt;Download Plug-in with Samples&lt;/a&gt;&lt;br /&gt;
&lt;a href=&#39;http://rapidshare.com/files/447561561/jQuery_CreateTable_Plugin.zip&#39;&gt;Download Plug-in with Asp.net Ajax Sample&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This article is about learning how to create jQuery plug-in by actually creating one. I have prepared a sample plug-in that can convert a JSON array into a table. This table is a template table already present in the page and this plug-in will get this table and insert the values of variables in the desired places whether they are in table attributes or inside td’s. &lt;br /&gt;
&lt;br /&gt;
Creating a plug-in is not a big task but creating a reusable plug-in needs deep understanding and better decisions at design time so it can be real reusable component later. If you want to simple know the syntax of creating a plug-in in jQuery, jQuery website has all the information and you can check it from this link&lt;br /&gt;
&lt;a href=&#39;http://docs.jquery.com/Plugins/Authoring&#39; &gt;jQuery Plug-in Authoring&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
However this article is about creating jQuery plug-in, it’s about doing better decision while creating a plug-in. Here are some considerations&lt;br /&gt;
&lt;br /&gt;
1- Plug-in should work even without binding it to jQuery&lt;br /&gt;
2- Plug-in should be able to maintain its state(data) for event handling&lt;br /&gt;
3- Plug-in should be able to attach to as much elements as we want in a page&lt;br /&gt;
(That means it should be object orient rather than procedural)&lt;br /&gt;
&lt;br /&gt;
I am assuming that before reading this article you arefamiliar with javascript prototype programming. But if you are not, please read this article before proceedint &lt;a href=&#39;http://aspilham.blogspot.com/2009/10/javascript-object-oriented-programming.html&#39;&gt;&quot;Object Oriented Programming in JavaScript&quot;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In this article I will discuss in detail about all of these aspects of a plug-in. It’s a very simple plug-in and let start building it and while on it, I will discuss the above listed points. Following is the main constructor and possible listed options of table plug-in&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;function Table(tbl, data)
{
    //data for head and body
    this.Body = data.Body; 
    // table object
    this.RTable = tbl;
    // template for head and body and footer
    this.BodyTemplate;


    // call back function to be called on row data bound
    this.OnRow_Bounded=data.OnRow_Bounded;

    this.GatherTemplate();
    if (this.Body != null) 
    {
      this.Create();
    }
}
&lt;/pre&gt;&lt;br /&gt;
This is the function that will gather the template from header/footer and body from the passed table object and this template will be used to bind data&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;Table.prototype.GatherTemplate = function() {

    this.BodyTemplate = $(&quot;tbody&quot;, this.RTable).html();
    $(&quot;tbody tr:first&quot;, this.RTable).remove();

}
&lt;/pre&gt;&lt;br /&gt;
After getting all the templates, this will save the required templates that will help in building table.&lt;br /&gt;
After gathering template, this next function will build the table and display it on the screen&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;Table.prototype.Create = function() 
{
  var i = this.CurrentPage == 0 ? 0 : this.CurrentPage * this.PageSize;

  var limit = i + this.PageSize &gt; this.Body.length ? this.Body.length : i + this.PageSize;

  for (; i &lt; limit; i++) 
  {
    this.RTable.append(this.CreateRow(this.BodyTemplate, this.Body[i]));
  }
            
}
&lt;/pre&gt;




This function will create a row and will optionally call a row bound function that can be used for doing different options.

&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;Table.prototype.CreateRow = function(template, rowData) 
{

  for (var i in rowData) 
  {
    var exp = new RegExp(&quot;{&quot; + i + &quot;}&quot;, &quot;g&quot;);
    template = template.replace(exp, rowData[i]);
  }
  var row = $(template);
  if (typeof OnRow_Bounded == &#39;function&#39;) 
  {
    row = OnRow_Bounded(rowData, row, &quot;body&quot;);
  }
  return row;
}
&lt;/pre&gt;
Now this is a complete plug-in and when Table function will be called. It will generate a table and display it the place where the template table is placed.
Now if you see that this is not a jQuery plug-in yet but it can be used as a plug-in by using it following way
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;  Var table=new Table($(“table:first”),{Body:yourJSONData});
&lt;/pre&gt;
What it takes it to convert it to a jQuery plug-in is very simple.
1- Initilize a default options object
var options = { Head: null, Body: null, AjaxPager: false, CurrentPage: 0, TotalPages: 0, PageSize: 10, Pager: true,OnRow_Bounded:null,OnPager_Clicked:null }
2- Extend the jQuery library
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;$.fn.CreateTable = function(data) 
{
  //if (this.length &gt; 0) {
  $.extend(options, data);
  var index = 0;
  var objArray = new Array();
  this.each(function() 
  {
    objArray[index] = new Table($(this), options);
    index++;
  });
  return objArray;
  //}
}
&lt;/pre&gt;
Inside this on using a each loop for all tables in the page will bind data to all tables. Default options are extended with extend jQuery object and now this is a complete jQuery plug-in that you can call using jQuery by using the following syntax
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;  $(“table”).CreateTable({options});
&lt;/pre&gt;As you can see inside the each loop , a new Table object is created and it works the way it should be.

About the second point, where I mentioned it should maintain its state. This plug-in will give back the array of Table objects. These objects can be used to get or set state. These objects can be used in many ways.

This article does not cover the whole plug-in but it has the taste of what it is capable of. This article includes various working examples  that can be downloaded from the below link.
&lt;a href=&#39;http://rapidshare.com/files/447560766/jQuery-CreateTable-PlugIn.zip&#39;&gt;http://rapidshare.com/files/447560766/jQuery-CreateTable-PlugIn.zip&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/5775145410952616473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/02/create-jquery-plug-in-creating-jquery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/5775145410952616473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/5775145410952616473'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/02/create-jquery-plug-in-creating-jquery.html' title='Create a jquery plug-in : creating a jquery plug-in that can convert JSON array into table'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-4795967663843880695</id><published>2011-01-24T11:08:00.000-08:00</published><updated>2011-03-05T05:13:44.572-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenCV"/><title type='text'>Face Detection based on Skin colour point pixel processing using OpenCV</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;How Do I? Face Detection based on Skin colour point pixel processor using &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;OpenCV&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596516134&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;
This was my project for Digital Image Processing in NUST taught by a great teacher Naveed Sarfaraz Khattak. Thanks all for giving such knowledge and making it easy to study.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Problem Description:&lt;/div&gt;&lt;br /&gt;
The program will input colour triples, or subimages, that are training samples of human face colour. Let&#39;s refer to this colour as C. (Human face colour should NOT be built into the program. By doing this, we should be able to use the same program to extract water, green grass, etc.)&lt;br /&gt;
The program will read some constraints on the features of the regions targeted, such as the range of area, elongation, etc.&lt;br /&gt;
The program will identify all pixels of the input image that have colour similar to the training samples.&lt;br /&gt;
The program will identify each connected region of colour C as an object and measure features of each such region. The program will report only those regions that have properties similar to a human face.&lt;br /&gt;
The program will output the input image in P3 format with the bounding box of each face candidate overlaid in white (225,225,225) &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Summary of Choices:&lt;/div&gt;I have done this project in OpenCV library using Visual Studio 2010. I am using &lt;br /&gt;
1- &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;OpenCV &lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596516134&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;for Image Analysis&lt;br /&gt;
2- &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/WPF-4-Unleashed-Adam-Nathan/dp/0672331195?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;WPF &lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0672331195&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;for presentation Layer along with C#&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Skin colour detection Methods:&lt;/div&gt;There are two ways of detecting skins,&lt;br /&gt;
1- Region based detection&lt;br /&gt;
2- Point pixel processing&lt;br /&gt;
&lt;br /&gt;
This project requires doing the pixel processing.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Colour Models:&lt;/div&gt;There are different types of colour models. Most used and known colour model is RGB. This colour model presents the colour in three bytes with each byte present a property of colour. To process skin colour in this model requires processing all three byte values.&lt;br /&gt;
&lt;br /&gt;
HSV is the other well known format. This format presents the colour detail in one byte the other two bytes used to store the strength and brightness of colour. Using this colour model has added benefit of one dimension processing rather than three dimensions processing in RGB colour model.&lt;br /&gt;
&lt;br /&gt;
For this project, I have chosen to use the HSV colour model. By going through the different research publishing on point processing and their result, HSV produces the best pixel processing results as you can see in figure 1.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz12nhZH_hENyO_YiAmqhKI0-1JFaBcYGvt83oLtdU7MUQu4U8E0tApNN20STnUjEWJADgVz9v3JRvCDJAfFOobIaNva11fJ7S70t6kxdubZvcR3TbDUXWZExFHxkuC0xbd1MtQHuvUM8/s1600/Skin_Pixel_Detection.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;292&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz12nhZH_hENyO_YiAmqhKI0-1JFaBcYGvt83oLtdU7MUQu4U8E0tApNN20STnUjEWJADgVz9v3JRvCDJAfFOobIaNva11fJ7S70t6kxdubZvcR3TbDUXWZExFHxkuC0xbd1MtQHuvUM8/s400/Skin_Pixel_Detection.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;HSV for colour detection:&lt;/div&gt;&lt;br /&gt;
HSV colour model uses H for saving the colour. Only using H for skin detection can very successful. Skin colour is different between different races. Using the result of “Comparative Study of Statistical Skin Detection Algorithms for Sub-Continental Human Images” determines that &lt;br /&gt;
&lt;table cellpadding=&quot;4&quot; cellspacing=&quot;4&quot; border=&quot;1&quot; style=&quot;background-color:white;color:black;&quot;&gt;&lt;tr&gt; &lt;td&gt;Range&lt;/td&gt;&lt;td&gt; Result&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;br /&gt;
2&amp;lt;h&amp;lt;45&lt;/td&gt;&lt;td&gt; 95.4&lt;br /&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;br /&gt;
4&amp;lt;h&amp;lt;40 &lt;/td&gt;&lt;td&gt;93.2&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;br /&gt;
5&amp;lt;h&amp;lt;35 &lt;/td&gt;&lt;td&gt;91.1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;br /&gt;
10&amp;lt;h&lt;30&lt;/td&gt;&lt;td&gt; 84.8&lt;/td&gt;&lt;br /&gt;
&lt;/tr&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/table&gt;&lt;br /&gt;
Using the above table and by experimenting with different range of H, I end up using 6&amp;lt;h&amp;lt;18 that produces the good result in my selected images from internet.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Skin colour detection Algorithm:&lt;/div&gt;&lt;br /&gt;
Algorithm is based on the study of HSV “Skin Detection using HSV colour space”. Following figure shows the details&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqd5MmQNukOpKd4FqLtPqxOa1Zt09H8dCpUS4jlCdXvapdcoPV7RY4WGK-2cE3tPhjMeonjhO51dvscu3R4aVgxkVb78D2C52if8W7iA-ZuHS_Zyqiycyosh4sn17FG5iTZPX1xY8IKHM/s1600/SKIN_Pixel_Detection_Algorith_Block_Diagram.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;325&quot; width=&quot;369&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqd5MmQNukOpKd4FqLtPqxOa1Zt09H8dCpUS4jlCdXvapdcoPV7RY4WGK-2cE3tPhjMeonjhO51dvscu3R4aVgxkVb78D2C52if8W7iA-ZuHS_Zyqiycyosh4sn17FG5iTZPX1xY8IKHM/s400/SKIN_Pixel_Detection_Algorith_Block_Diagram.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Figure 2 : Algorithm Detail&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Algorithm:&lt;/div&gt;Open Image&lt;br /&gt;
Convert Image to HSV colour model&lt;br /&gt;
For each row of height&lt;br /&gt;
For each column in width&lt;br /&gt;
If pixel’s H is between 6 and 18&lt;br /&gt;
Tag this as skin pixel&lt;br /&gt;
Else&lt;br /&gt;
Tag this as a white pixel&lt;br /&gt;
End For&lt;br /&gt;
End For&lt;br /&gt;
&lt;br /&gt;
Dilate Image with 5x5 Kernel&lt;br /&gt;
Erode Image with same 5x5 Kernel &lt;br /&gt;
Median Smooth with 3x3 Kernel&lt;br /&gt;
&lt;br /&gt;
Use the Label Image Project 2&lt;br /&gt;
After Objects has been labelled&lt;br /&gt;
Draw Rectangle on every Object find&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Code:&lt;/div&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;cpp&quot;&gt;// Detecting skin inside the picture
String^ SkinDetection(String^ filePath,String^ savePath,String^ extension)
{
  // Primary image
  IplImage *primaryImage = cvLoadImage( StringToChar(filePath),1);
  // creating image from the source
  IplImage *source=cvCreateImage( cvGetSize(primaryImage), 8, 3 );
  // creating HSV image from the source
  cvCvtColor(primaryImage,source,CV_BGR2HSV);
  // Destination image that will be created from the image, binary image
  IplImage *destination=cvCreateImage( cvGetSize(source), 8, 1 );
  // intermediate image that will only have SKIN
  IplImage *intermediateImage=cvCreateImage(cvGetSize(source),8,3);

  int height= source-&gt;height; // number of lines
  int bytesPerRow= source-&gt;width * source-&gt;nChannels; // total number of element per line
  int channels=source-&gt;nChannels;
  int step= source-&gt;widthStep; // effective width

  unsigned char *data= reinterpret_cast&amp;lt;unsigned char *&amp;gt;(source-&gt;imageData);
  unsigned char *dData= reinterpret_cast&amp;lt;unsigned char *&amp;gt;(destination-&gt;imageData);
  unsigned char *iData= reinterpret_cast&amp;lt;unsigned char *&amp;gt;(intermediateImage-&gt;imageData);
  unsigned char *pData= reinterpret_cast&amp;lt;unsigned char *&amp;gt;(primaryImage-&gt;imageData);


  int dIndex=0;
  int dStep=destination-&gt;widthStep;

  //start of parsing each pixel
  for (int i=0; i&amp;lt;height; i++) 
  {
    dIndex=0;
    for (int j=0; j&amp;lt;bytesPerRow; j+= channels) 
    {
      int value=data[i*step+j];
      if(value&amp;gt; 6 &amp;&amp; value&amp;lt;18) // if skin is in this pixel
      {
         iData[i*step+j]=pData[i*step+j];
         iData[i*step+j+1]=pData[i*step+j+1];
         iData[i*step+j+2]=pData[i*step+j+2];
         dData[i*dStep+dIndex]=0; 
      }
      else // if skin is not in this pixel
      {
         iData[i*step+j]=255;
         iData[i*step+j+1]=255;
         iData[i*step+j+2]=255;
         dData[i*dStep+dIndex]=255;
      }
      dIndex+=destination-&gt;nChannels;
   }

  }

    // 
    SaveImage(source,savePath+&quot;_HSV.jpg&quot;);
    SaveImage(destination,savePath+&quot;_Skin.jpg&quot;);
    // Dilate the image
    destination =Dilate(destination);
    SaveImage(destination,savePath+&quot;_Dilated.jpg&quot;);
    // Erode the image
    destination=Erode(destination);
    SaveImage(destination,savePath+&quot;_Eroded.jpg&quot;);
    // Smoothing image
    destination=MedianSmooth(destination);
    SaveImage(destination,savePath+&quot;_MedianSmooth.jpg&quot;);
    //Labeling image and showing bounding box
    SaveImage(intermediateImage,savePath+&quot;_Intermediate.jpg&quot;);
    String^ objects=LabelIamge(SaveImage(destination,savePath+&quot;_Label.jpg&quot;),savePath,primaryImage);
    return objects;
}
&lt;/pre&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Description:&lt;/div&gt;With the look at above algorithm, it becomes relatively easy to do the skin detection. Using the last project code, I was able to label the output image of skin detection. Skin detection function output the binary image that became the input for label image. Label image function goes through each object and trashes the objects with regions that have less than twenty pixels. Than using the bounding box details of each object found in the labelled image, a red circle drawn as the bounding box.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Results:&lt;/div&gt;&lt;br /&gt;
Many images are used to test the result of this program. Algorithm goes through the image and output the eight images on every stage of processing&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Original Images:&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVKBxUqnODOTfrN3YZ33A0lqQEMkim_lmdRzna1_SgFKzuCFjSPeEa3sqOc_58uu-xIq8AKSw1t3ysZd7Yt9juWMX-CGU879gJ3ZQTU-zahk1FDpE5o366SzLBvm0f6TbV3mbecQAt52E/s1600/Skin_Detection_Original_Images.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;179&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVKBxUqnODOTfrN3YZ33A0lqQEMkim_lmdRzna1_SgFKzuCFjSPeEa3sqOc_58uu-xIq8AKSw1t3ysZd7Yt9juWMX-CGU879gJ3ZQTU-zahk1FDpE5o366SzLBvm0f6TbV3mbecQAt52E/s400/Skin_Detection_Original_Images.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;HSV images:&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHbVDFH0T1AEbm5TcPcdsGtR9n8Ss6zckvMBw3Pl2w12AyzgfolYuMJ9IyPuAF9Z7WqVz5L1SzegRg9J1E6ZUeHY5Sq63-nWv_jTr1ntdP93bXxxJZ_GdPAUJjOm7ltEKdw24xwSTPbtA/s1600/skin_detection_hsv_images.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;178&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHbVDFH0T1AEbm5TcPcdsGtR9n8Ss6zckvMBw3Pl2w12AyzgfolYuMJ9IyPuAF9Z7WqVz5L1SzegRg9J1E6ZUeHY5Sq63-nWv_jTr1ntdP93bXxxJZ_GdPAUJjOm7ltEKdw24xwSTPbtA/s400/skin_detection_hsv_images.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Skin Detected:&lt;/div&gt;Notice all the noise in binary images&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0UVB3IWfN2y-nZVCG4oN2zP-GpwAm-WqPLt71FybtCfvtFcxRyT_ZwNaz3rmnGWkMBcaFRLZLvJktl1yO1uuET8W8a5jcVC1RQkF53MG372IMLN8dr2JJuntvavZ2IgA5VF0efz_XnpU/s1600/Skin_Detected_.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;176&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0UVB3IWfN2y-nZVCG4oN2zP-GpwAm-WqPLt71FybtCfvtFcxRyT_ZwNaz3rmnGWkMBcaFRLZLvJktl1yO1uuET8W8a5jcVC1RQkF53MG372IMLN8dr2JJuntvavZ2IgA5VF0efz_XnpU/s400/Skin_Detected_.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Dilation:&lt;/div&gt;&lt;br /&gt;
Notice all noise is removed&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiBk5lz1J5kGOzxgB6BFEo_DKGymqJgAax_8ABmjCluRGoH18bHD7LaEu3vBzb6sd2QG1Q-FcwkuWobbrYqol7E2kUPvFYguwq6mUaz979iLTN6XwBAF196f9RFl6XjncijUXBGC6Vuc8/s1600/skin_detected_after_dilation.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;190&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiBk5lz1J5kGOzxgB6BFEo_DKGymqJgAax_8ABmjCluRGoH18bHD7LaEu3vBzb6sd2QG1Q-FcwkuWobbrYqol7E2kUPvFYguwq6mUaz979iLTN6XwBAF196f9RFl6XjncijUXBGC6Vuc8/s400/skin_detected_after_dilation.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Erode:&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwjfSb-CsM4czb3M1mgc1s73fYsM9bkV-Xh_FaUv-fgSSAC2eYajTWS5EiwqFuC_q5dbqS-1hV4_outATAFyIDFNsNyx3r5F20j_DVYxgYJonZx_mRKCUBeb22ycw5Jfdje_ChIJlfLo4/s1600/skin_detected_Erode.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;169&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwjfSb-CsM4czb3M1mgc1s73fYsM9bkV-Xh_FaUv-fgSSAC2eYajTWS5EiwqFuC_q5dbqS-1hV4_outATAFyIDFNsNyx3r5F20j_DVYxgYJonZx_mRKCUBeb22ycw5Jfdje_ChIJlfLo4/s400/skin_detected_Erode.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Median Smooth:&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMjv4-6SFuTGksMa_CFFQnx0k7ynQWLpmRLyPmyNHlRkigGF16VYjPKQozHRKuIE877htOtqOOmKaSfKNx9Hk9v6qXIEONgwa_hOweO6_66ZKCfZKCtgSijCRqlfRinOJm6Bu47ViVuYo/s1600/skin_detected_median_filter.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;182&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMjv4-6SFuTGksMa_CFFQnx0k7ynQWLpmRLyPmyNHlRkigGF16VYjPKQozHRKuIE877htOtqOOmKaSfKNx9Hk9v6qXIEONgwa_hOweO6_66ZKCfZKCtgSijCRqlfRinOJm6Bu47ViVuYo/s400/skin_detected_median_filter.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Labelled Image:&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx9WipJeHAq-CB_nIDtvTyYPg0Y6QT9Tt5rg1tuHX2aJbnVkM-oP840DXK8yyr31HNMeepy4wBJW3cz0shA8qwr6ND6Yq_BFPMx9XQrl15yaUz_UW9vkutFpT62It80i-Pl7qOddW_lws/s1600/skin_detected_rectangular.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;178&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx9WipJeHAq-CB_nIDtvTyYPg0Y6QT9Tt5rg1tuHX2aJbnVkM-oP840DXK8yyr31HNMeepy4wBJW3cz0shA8qwr6ND6Yq_BFPMx9XQrl15yaUz_UW9vkutFpT62It80i-Pl7qOddW_lws/s400/skin_detected_rectangular.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Main program screen:&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNKmpp0TrtTJMvHFp6t1QQdvwQwSaK8iDXvWfxvnwaJGx0OOUyqpKx94sCgDfQdRAg7Z7llwQ2_nOcawqg0OE2jB6emkP_6z7ZoMTrKt36QUMnLfNeWndCPqxkoVvg9WHlGlb51aNJSW8/s1600/skin_detected_program.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;266&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNKmpp0TrtTJMvHFp6t1QQdvwQwSaK8iDXvWfxvnwaJGx0OOUyqpKx94sCgDfQdRAg7Z7llwQ2_nOcawqg0OE2jB6emkP_6z7ZoMTrKt36QUMnLfNeWndCPqxkoVvg9WHlGlb51aNJSW8/s400/skin_detected_program.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Reference Materials:&lt;/div&gt;&lt;br /&gt;
1- Skin Detection using HSV colour space by V. A. OLIVEIRA, A. CONCI&lt;br /&gt;
&lt;br /&gt;
2- Comparative Study of Statistical Skin Detection Algorithms for Sub-Continental Human Images by M. R. Tabassum, A. U. Gias, M. M. Kamal, H. M. Muctadir, M. Ibrahim, A. K. Shakir, A.Imran, S. Islam, M. G. Rabbani1, S. M. Khaled, M. S. Islam, Z. Begum&lt;br /&gt;
&lt;br /&gt;
3- Color Space for Skin Detection – A Review by Nikhil Rasiwasia Fondazione Graphitech, University of Trento, (TN) Italy&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#39;http://rapidshare.com/files/444325761/Skin_Detection_Using_OpenCV_Point_Pixel_Processing.zip&#39;&gt;Download source project + document + sample images + resulted images&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/4795967663843880695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/01/face-detection-based-on-skin-colour.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/4795967663843880695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/4795967663843880695'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/01/face-detection-based-on-skin-colour.html' title='Face Detection based on Skin colour point pixel processing using OpenCV'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz12nhZH_hENyO_YiAmqhKI0-1JFaBcYGvt83oLtdU7MUQu4U8E0tApNN20STnUjEWJADgVz9v3JRvCDJAfFOobIaNva11fJ7S70t6kxdubZvcR3TbDUXWZExFHxkuC0xbd1MtQHuvUM8/s72-c/Skin_Pixel_Detection.JPG" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-8703732314124471929</id><published>2011-01-24T10:32:00.000-08:00</published><updated>2011-03-05T05:20:27.151-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenCV"/><title type='text'>Finding objects inside image using Classical Connected Component binary image analysis method using OpenCV</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;How Do i? Find objects inside image using Classical connected component in binary image using &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;OpenCV&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596516134&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This was my project for Digital Image Processing in NUST taught by a great teacher Naveed Sarfaraz Khattak. Thanks all for giving such knowledge and making i easy to study.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Problem Description:&lt;/div&gt;&lt;br /&gt;
The objective of this project is to gain experience with connected components analysis and the use of features computed within it for recognition of objects. This problem is to implement a connected components program so that it will report on all objects found in the input image and computes all inter object distances.&lt;br /&gt;
&lt;br /&gt;
This Project will&lt;br /&gt;
&lt;br /&gt;
1- Find objects&lt;br /&gt;
2- Calculate their area&lt;br /&gt;
3- Calculate Centroid&lt;br /&gt;
4- Distance between each object (distance matrix)&lt;br /&gt;
5- Bounding box&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Summary of Choices:&lt;/div&gt;&lt;br /&gt;
I have done this project in OpenCV library using Visual Studio 2010. I am using &lt;br /&gt;
1- &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;OpenCV &lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596516134&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;for Image Analysis&lt;br /&gt;
2- WPF for presentation Layer along with C#&lt;br /&gt;
&lt;br /&gt;
This project requires &lt;br /&gt;
&lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;OpenCV 2.0+&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596516134&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;&lt;br /&gt;
&lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Professional-Visual-Studio-2010-Programmer/dp/0470548657?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Visual Studio 2010&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0470548657&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Sample Images:&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpePj1yK7rYZnOqr3NcPmHiD8jt36b5iwoZtpfAyAyFTHVKgFMKdHabWGxBQXgVN5vlZyagVELUMyqKW1u0wAfn7EtvGMgHph6-SF5Pj3No8Vt3_nCg2KRAy15cbL0-zuvi5zE0DV5Asw/s1600/Classical_Connected_Component_Binary_Image_Analysis.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;321&quot; width=&quot;396&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpePj1yK7rYZnOqr3NcPmHiD8jt36b5iwoZtpfAyAyFTHVKgFMKdHabWGxBQXgVN5vlZyagVELUMyqKW1u0wAfn7EtvGMgHph6-SF5Pj3No8Vt3_nCg2KRAy15cbL0-zuvi5zE0DV5Asw/s400/Classical_Connected_Component_Binary_Image_Analysis.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Result Discussion and Algorithms:&lt;/div&gt;&lt;br /&gt;
This program is written in &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;OpenCV &lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596516134&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;to learn and implement the open standard of image processing system. This program can run on any Windows machine where OpenCV is installed and .Net FrameWork 4.0 is available.&lt;br /&gt;
&lt;br /&gt;
This program used Connected Component union find algorithm to find the neighbours of each pixel and tag that pixel in this the image.  Where there are more than one neighbours for one pixel value, a confilict note is made.&lt;br /&gt;
&lt;br /&gt;
After going through whole image, conflicts are resolved. There was a problem in conflict resolution and it was not possible to solve the labels in two go, instead it took k iterations to resolve the whole k conflicts due to the problem that one connected component can hold more than 2 labels if it is has a difficult shape.&lt;br /&gt;
&lt;br /&gt;
After finding all the objects, each object than processed for its features. Finding area was easy so does the centroids. Bounding region takes a while but the real problem and time consumed in finding connected objects. After working 4 days and nights I am able to complete the project but there is no time to write the whole story before submission of this report.&lt;br /&gt;
&lt;br /&gt;
This program is using the layout as described below. &lt;br /&gt;
&lt;br /&gt;
1- It has a button to open the image,&lt;br /&gt;
2- Open the image will trigger the binary analysis&lt;br /&gt;
3- It will show the image analysis &lt;br /&gt;
4- To see the distance matrix, click on the distance matrix tab &lt;br /&gt;
&lt;br /&gt;
Please see the image below for reference&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDnSxaD6BLLZ8QKGjra1QDYcALwKgxDqYZI2SIqou5K1k6MFp7yH7pRO7rEsU_VUThxpFYRdc8zZD9yTtHZSddFahE7CMTQAnc3Lv-l-kBNIADSuNKOJP2328q3ZN9QIKqQbliigEorKs/s1600/Classical_Connected_Component_Binary_Analysis_GUI.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;357&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDnSxaD6BLLZ8QKGjra1QDYcALwKgxDqYZI2SIqou5K1k6MFp7yH7pRO7rEsU_VUThxpFYRdc8zZD9yTtHZSddFahE7CMTQAnc3Lv-l-kBNIADSuNKOJP2328q3ZN9QIKqQbliigEorKs/s400/Classical_Connected_Component_Binary_Analysis_GUI.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8DcgzJzEYuRjaLlpDvSzY1lz0dvQg8_4Y55BaUIP7sMrKUAoNButMe5dtYmTDobVq1bJGmDJ879cJGTw23qRoxYPSgcrVRkVPSSU2PCZ4FLW4CyMBxuJrNwdeZdWLwy33Rb-_aMJ7b_s/s1600/Binary_Image_Analysis_Classical_Connected_Component_Distance_Matrix.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;359&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8DcgzJzEYuRjaLlpDvSzY1lz0dvQg8_4Y55BaUIP7sMrKUAoNButMe5dtYmTDobVq1bJGmDJ879cJGTw23qRoxYPSgcrVRkVPSSU2PCZ4FLW4CyMBxuJrNwdeZdWLwy33Rb-_aMJ7b_s/s400/Binary_Image_Analysis_Classical_Connected_Component_Distance_Matrix.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Results:&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8Wu0tNbpSFL_FoyfYVb1KSMhyfySqPW3nQ56tKMRAESzjlNHxO14K-JIRDUxZ7dt1cDv5xAMfj3agnvT2ZCX-P8v5Q4gYjK9CZggoDRhhbztUwaFO4KDybyR3NFZWebHVoa4y4GvRjgA/s1600/Classical_Connected_Component_Result.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;386&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8Wu0tNbpSFL_FoyfYVb1KSMhyfySqPW3nQ56tKMRAESzjlNHxO14K-JIRDUxZ7dt1cDv5xAMfj3agnvT2ZCX-P8v5Q4gYjK9CZggoDRhhbztUwaFO4KDybyR3NFZWebHVoa4y4GvRjgA/s400/Classical_Connected_Component_Result.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Code:&lt;/div&gt;&lt;br /&gt;
This is a very long function and its not all of it. You can download the whole project, document and image dump at the end of this article.&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;cpp&quot;&gt;//This is the main function that will label the image
String^ LabelIamge(String^ filePath,String^ savePath)
{
  IplImage *source = cvLoadImage( StringToChar(filePath),0);
  int height= source-&amp;gt;height; // number of lines
int bytesPerRow= source-&amp;gt;width * source-&amp;gt;nChannels; // total number of element per line
int step= source-&amp;gt;widthStep; // effective width

unsigned char *data= reinterpret_cast&amp;lt;unsigned char *&amp;gt;(source-&amp;gt;imageData);

//number of objects in the picture
int objects=1;
//if a number is already used to add new number
bool isConsumed=false;
//Four neighbours of the concerned picture
int neighbours[4];
//This will register all confilicts
Hashtable mapTable;

//start of parsing each pixel
for (int i=0; i&amp;lt;height; i++) {
for (int j=0; j&amp;lt;bytesPerRow; j+= source-&amp;gt;nChannels) 
{
//if the current pixel is a black pixel
if(data[i*step+j]==0)
{
//left neighbour
if(j&amp;gt;0)
{
if(data[i*step+(j-1)]&amp;gt;255)
neighbours[LEFT]=data[i*step+(j-1)];
else
neighbours[LEFT]=-1;
}

//left top neighbour
if(j&amp;gt;0 &amp;&amp; i&amp;gt;0)
{
if(data[(i-1)*step+(j-1)]&amp;lt;255)
neighbours[LEFTTOP]=data[(i-1)*step+(j-1)];
else
neighbours[LEFTTOP]=-1;
}

//top neighbour
if(i&amp;gt;0)
{
if(data[(i-1)*step+(j)]&amp;lt;255)
neighbours[TOP]=data[(i-1)*step+(j)];
else
neighbours[TOP]=-1;
}

//right top neighbour
if(i&amp;gt;0 &amp;&amp; j+1&amp;gt;bytesPerRow)
{
if(data[(i-1)*step+(j+1)]&amp;lt;255)
neighbours[RIGHTTOP]=data[(i-1)*step+(j+1)];
else
neighbours[RIGHTTOP]=-1;
}

//number of neighbours found
int totalNeighbours=Neighbours(neighbours);
int* sNeighbours;
//if neighbours are there, serialize the neighbours in asc order and find the numbers of real neighbours
if(totalNeighbours&amp;gt;0)
{
SerializedData data=NeighboursSerial(neighbours);

sNeighbours=data.ary;
totalNeighbours=data.size;

BubbleSort(sNeighbours,totalNeighbours);
}

//if no neighbour, assign the new number
if(neighbours[LEFT]==-1 &amp;&amp; neighbours[LEFTTOP]==-1 &amp;&amp; neighbours[TOP]==-1 &amp;&amp; neighbours[RIGHTTOP]==-1)
{
data[i*step+j]=objects;
isConsumed=true;
}
//if there are one neighbour, then assign the neighbour lable to the pixel
else if(totalNeighbours==1)
{
data[i*step+j]=sNeighbours[0];
}
// if there are more than one neighbours, then assign the minimum neighbour from the sorted neighbour array and add the next neighbour to conflict table
else
{
data[i*step+j]=sNeighbours[0];

//add the conflict only if it doesnot exist before
if(mapTable.ContainsKey(sNeighbours[1])==false)
{
mapTable.Add(sNeighbours[1],sNeighbours[0]);
}
}
}
// if pixel is not black, then increment the object number if it is not already used.
else
{
if(isConsumed)
{
isConsumed=false;
objects+=1;//+;
}
}
}
}

//translate all the map table into desc order and resolve the conflict by using the conflict table
ICollection^ keyColl = mapTable.Keys;
int mtLength=mapTable.Count;
int* a=new int[mtLength];
int index=0;

for each( int s in keyColl )
{
a[index]=s;
index++;
}

BubbleSortDesc(a,mapTable.Count);
for(int k=0;k&amp;lt;mtLength;k++)
{
for (int i=0; i&amp;lt;height; i++) {
for (int j=0; j&amp;lt;bytesPerRow; j+= source-&amp;gt;nChannels) 
{
if(data[i*step+j]==a[k])
{
data[i*step+j]=(int)mapTable[a[k]];
}
}
}
}

//find the number of objects in the table
ConnectedObject* totalObjects=CountObjects(source,objects);
int count=0;
//discart the objects that are less than threshhold i.e. 20 pixels
totalObjects=RealObjects(totalObjects,objects,threshHold,count);
//find the centroids
Centroids(source,totalObjects,count);
//find the distance between each object
String^ distances=EuclideanDistance(totalObjects,count);
//color the image to display friendly colors and distinguish each object
IplImage *destination=LabeledToColorImage(source,totalObjects,count,objects);
//save image
SaveImage(destination,savePath);
// return the report in JSON format for data exchange between .Net and openCV
return ConnectedObjectToJSON(totalObjects,count,distances);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;a href=&#39;http://rapidshare.com/files/444320649/Classical_Connected_Component_Binary_Image_Analysis_OpenCV.zip&#39;&gt; click here for Source Project + Sample Images + Project Results + Document &lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/8703732314124471929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/01/finding-objects-inside-image-using.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8703732314124471929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8703732314124471929'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/01/finding-objects-inside-image-using.html' title='Finding objects inside image using Classical Connected Component binary image analysis method using OpenCV'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpePj1yK7rYZnOqr3NcPmHiD8jt36b5iwoZtpfAyAyFTHVKgFMKdHabWGxBQXgVN5vlZyagVELUMyqKW1u0wAfn7EtvGMgHph6-SF5Pj3No8Vt3_nCg2KRAy15cbL0-zuvi5zE0DV5Asw/s72-c/Classical_Connected_Component_Binary_Image_Analysis.JPG" height="72" width="72"/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-493067101974127406</id><published>2011-01-23T11:42:00.000-08:00</published><updated>2011-01-23T12:13:11.950-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>Comparision of String and JavaScript/jQuery based Dom Element Creation Result and Conclusion</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;Comparision of String and JavaScript/jQuery based Dom Element Creation Result and Conclusion&lt;br /&gt;
&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;
Please read &lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/creating-dom-elements-in.html&#39;&gt;Part no.1&lt;/a&gt; and &lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no1-displaying-data-with-string.html&#39;&gt;&lt;br /&gt;
Part no.2&lt;/a&gt;  and &lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no2-displaying-data-with-jquery.html&#39;&gt;&lt;br /&gt;
Part no.3&lt;/a&gt;&lt;br /&gt;
and &lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no34-extending-string-and-jquery.html&#39;&gt;&lt;br /&gt;
Part no.4&lt;/a&gt; &lt;br /&gt;
before reading this Part no.4&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Result: &lt;/div&gt;Time Spent to generate 100 tables in Minute : Seconds : MilliSeconds&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding=&quot;4&quot; cellspacing=&quot;4&quot; border=&quot;1&quot; style=&quot;color:black;background-color:white;text-align:center;&quot;&gt;&lt;tr&gt; &lt;td&gt;&lt;/td&gt;&lt;td&gt;Firefox 3.6.13&lt;/td&gt;&lt;td&gt; Chrome 8.0.552.237&lt;/td&gt;&lt;td&gt; IE 9.0.79&lt;/td&gt;&lt;td&gt; Memory (Chrome) in KB&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;Test no.1&lt;/td&gt; &lt;td&gt;0:6:38&lt;/td&gt;&lt;td&gt; 0:3:283 &lt;/td&gt;&lt;td&gt;0:10:730&lt;/td&gt;&lt;td&gt; 31,384&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;Test no.2&lt;/td&gt;&lt;td&gt; 0:1:31&lt;/td&gt;&lt;td&gt;  0:0:533&lt;/td&gt;&lt;td&gt; 0:2:521&lt;/td&gt;&lt;td&gt; 34,860&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;Test no.3&lt;/td&gt; &lt;td&gt;0:8:60&lt;/td&gt;&lt;td&gt;  0:6:969&lt;/td&gt;&lt;td&gt;  0:14:520&lt;/td&gt;&lt;td&gt; 49,164&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;Test no.4&lt;/td&gt;&lt;td&gt; 0:2:81&lt;/td&gt;&lt;td&gt; 0:1:992&lt;/td&gt; &lt;td&gt;0:3:445&lt;/td&gt;&lt;td&gt; 35,140&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
Now as test result are in, there are more perspective to compare both techniques in terms of&lt;br /&gt;
1- Time to Response&lt;br /&gt;
2- Memory Management&lt;br /&gt;
3- Extendibility&lt;br /&gt;
4- Readability&lt;br /&gt;
5- Modifiability&lt;br /&gt;
6- Object Oriented&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Response Time:&lt;/div&gt;Responsiveness could be seen easily in test no.2 and jQuery beats the string based object creation with a long distance.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Memory Management:&lt;/div&gt;Even though test no.1 has better memory management but as we move to test no.3, there is a very noticeable memory consumption change. This is due to the fact that strings are immutable and with addition of strings, it will consume more memory and will not free any of it. Test no.2 and 4 were more or less common in memory consumption due to the fact that objects will get destroyed if they are not in use and will not occupy the memory.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Extendibility:&lt;/div&gt;Extending to OnRow_Bounded in test no.2 proved to be better as we were doing the object processing and it was easy to update a td inside tr object and specially jQuery selector helped. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Readibility/Modifiability:&lt;/div&gt;jQuery based technique has better readability. Strings will get hard as we have more things to add where as jQuery based dom creation has better techniques of handling adding attribute and events binding.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Object Oriented:&lt;/div&gt;Dom creation based on string is not appreciated usually and jQuery based technique is object oriented.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Conclusion:&lt;/div&gt;By comparing different perspective, it is clear that using jQuery or even javascript object based technique is always better in term of performance and realiability where as string based looked like better approach in small operations but lacks serious performance and memory management along with other perspective comparison.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;Where to go from here:&lt;/div&gt;Next time I will try to convert this program into a jQuery plugin that will convert the JSON object into a table or will try to come up with a better technique for displaying data using templates. That will help in understanding jQuery plug in creation.&lt;br /&gt;
&lt;br /&gt;
I hope this will help in understanding of choosing right way when working with client applications that requires alot of data displaying and manipulation.&lt;br /&gt;
&lt;a href=&#39;http://rapidshare.com/files/444171144/Creating_Dom_Element_jQuery-JavaScript.zip&#39;&gt;&lt;br /&gt;
Download link for source code and documentation&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/493067101974127406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/01/comparision-of-string-and.html#comment-form' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/493067101974127406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/493067101974127406'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/01/comparision-of-string-and.html' title='Comparision of String and JavaScript/jQuery based Dom Element Creation Result and Conclusion'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-8408587506726499314</id><published>2011-01-23T11:27:00.000-08:00</published><updated>2011-03-05T05:24:33.072-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>Test no.3,4: Extending String and jQuery based techniques for creating DOM elements for adding more functionality</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;Test no.3,4: Extending String and jQuery based techniques for creating DOM elements for adding more functionality&lt;br /&gt;
&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;
Please read &lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/creating-dom-elements-in.html&#39;&gt;Part no.1&lt;/a&gt; and &lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no1-displaying-data-with-string.html&#39;&gt;&lt;br /&gt;
Part no.2&lt;/a&gt;  and &lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no2-displaying-data-with-jquery.html&#39;&gt;&lt;br /&gt;
Part no.3&lt;/a&gt; before reading this Part no.4&lt;br /&gt;
&lt;br /&gt;
I will try to add a function in both techniques. This function will be called whenever a row will be bounded to an instance of array object. This will be helpfull in doing many operations but i will try to change the boolean value into a check box. Then i will call a function onclick event of checkbox for simulation.&lt;br /&gt;
&lt;br /&gt;
Test no.3: Extendibility on data bounded with tr in test no.1&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;function Row(rowData) 
{
  var tr = &quot;&amp;lt;tr&amp;gt;&quot;;
  for (var i in rowData) 
  {
    tr += &quot;&amp;lt;td&amp;gt;&quot; + rowData[i] + &quot;&amp;lt;/td&amp;gt;&quot;;
  }
  tr += &quot;&amp;lt;/tr&amp;gt;&quot;;
  if (typeof OnRow_Bounded == &#39;function&#39;) 
  {
    tr=OnRow_Bounded(rowData, tr);
  }
  return tr;
}

function OnRow_Bounded(rowData,row) 
{
  if (rowData[&quot;isActive&quot;] == true) 
  {
    row = row.replace(&quot;true&quot;, &quot;&amp;lt;input type=&#39;checkbox&#39; checked=&#39;checked&#39; onClick=&#39;EmployeeStatus_Change(&quot; + rowData.sr + &quot;,\&quot;&quot; + rowData.FirstName + &quot;\&quot;);&#39; /&amp;gt;&quot;);
  }
  else 
  {
    row = row.replace(&quot;false&quot;, &quot;&amp;lt;input type=&#39;checkbox&#39; onClick=&#39;EmployeeStatus_Change(&quot; + rowData.sr + &quot;,\&quot;&quot; + rowData.FirstName + &quot;\&quot;);&#39; /&amp;gt;&quot;);
  }
  return row;
}

function EmployeeStatus_Change(sr,firstName) 
{
  confirm(&#39;Do you want to change the &#39; + firstName + &#39; status?&#39;);
}
&lt;/pre&gt;&lt;br /&gt;
Following picture shows the addition of checkbox &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIr86qCVu3AhHEHn1S4zXpHIsQqmqRJ60gNriDoQN6b5dd4-n3f3K6Kg5G1Fw22TdozP1Q8AgIZFxwn3tTDUtV6zs7jJxqMPScnMe3OeLVrl1UAtfLZpi6qNZYGSTp9L911Ff4wuQTLg8/s1600/Extended_string_Based_Dom_Element_Creation.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; width=&quot;280&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIr86qCVu3AhHEHn1S4zXpHIsQqmqRJ60gNriDoQN6b5dd4-n3f3K6Kg5G1Fw22TdozP1Q8AgIZFxwn3tTDUtV6zs7jJxqMPScnMe3OeLVrl1UAtfLZpi6qNZYGSTp9L911Ff4wuQTLg8/s400/Extended_string_Based_Dom_Element_Creation.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Test no.4: Extendibility on data bounded with tr in test no.2&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;function Row(rowData) 
{
  var tr = $(&quot;&amp;lt;tr&amp;gt;&amp;lt;/tr&amp;gt;&quot;);
  for (var i in rowData) 
  {
    tr.append($(&quot;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&quot;).text(rowData[i]));
  }
  if (typeof OnRow_Bounded == &#39;function&#39;) 
  {
    tr = OnRow_Bounded(rowData, tr);
  }
  return tr;
}

function OnRow_Bounded(rowData, row) 
{
  var status_checkbox = $(&quot;&amp;lt;input type=&#39;checkbox&#39;/&amp;gt;&quot;).attr(&#39;checked&#39;, rowData[&quot;isActive&quot;]).bind(&#39;click&#39;, rowData, EmployeeStatus_Change);
  $(&quot;td:contains(&quot; + rowData[&quot;isActive&quot;] + &quot;)&quot;, row).text(&#39;&#39;).append(status_checkbox);
  return row;
}

function EmployeeStatus_Change(event)
{
  var rowData=event.data;
  confirm(&#39;Do you want to change the &#39; + rowData.FirstName + &#39; status?&#39;);
}
&lt;/pre&gt;&lt;br /&gt;
and following picture shows the extended result&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyc7gtTdVOBcN_xRsDa8aydpwZPI1CRBruMvJSqEL8hEUl5EOgdb6JUIVxAoep3_z-kTO1Q-N1xL6pwCGlrysGTNOOtQTspuLS-ZFNNMVn9jI03DhtXnshbBel2S9GSqT7o17lsEO5U3A/s1600/Extended_jQuery_Based_Dom_Element_Creation.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; width=&quot;281&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyc7gtTdVOBcN_xRsDa8aydpwZPI1CRBruMvJSqEL8hEUl5EOgdb6JUIVxAoep3_z-kTO1Q-N1xL6pwCGlrysGTNOOtQTspuLS-ZFNNMVn9jI03DhtXnshbBel2S9GSqT7o17lsEO5U3A/s400/Extended_jQuery_Based_Dom_Element_Creation.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/comparision-of-string-and.html&#39;&gt;&lt;br /&gt;
Continue to Part no.5&lt;br /&gt;
&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/8408587506726499314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/01/test-no34-extending-string-and-jquery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8408587506726499314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8408587506726499314'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/01/test-no34-extending-string-and-jquery.html' title='Test no.3,4: Extending String and jQuery based techniques for creating DOM elements for adding more functionality'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIr86qCVu3AhHEHn1S4zXpHIsQqmqRJ60gNriDoQN6b5dd4-n3f3K6Kg5G1Fw22TdozP1Q8AgIZFxwn3tTDUtV6zs7jJxqMPScnMe3OeLVrl1UAtfLZpi6qNZYGSTp9L911Ff4wuQTLg8/s72-c/Extended_string_Based_Dom_Element_Creation.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-8535623902637466270</id><published>2011-01-23T11:17:00.000-08:00</published><updated>2011-03-05T05:26:46.780-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>Test no.2: Displaying data with jQuery based dom element creation in JavaScript/jQuery</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;Test no.2: Displaying data with jQuery based dom element creation in JavaScript/jQuery&lt;br /&gt;
&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;
Please read &lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/creating-dom-elements-in.html&#39;&gt;Part no.1&lt;/a&gt; and &lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no1-displaying-data-with-string.html&#39;&gt;&lt;br /&gt;
Part no.2&lt;/a&gt; before reading this Part no.3&lt;br /&gt;
&lt;br /&gt;
This is the same as test no.1 the only difference is the use of jQuery instead of string for creation of Dom elements. &lt;br /&gt;
&lt;br /&gt;
&quot;Now by using the JSON object when window.onload function will be called a function will pass the function to create function. This function will first save the starting time in a variable and then generates the 100 tables. Then this will save the end time. Time difference will then calculated and displayed on top of tables. and following is the sample code for generating the tables using string based operations.&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;$(function () { DisplayEmployees(jsonData); });
var startTime;
var endTime;
var totalTables=100;

function DisplayEmployees(data) 
{
  startTime = new Date();
  var mainDiv = $(&quot;#dvMain&quot;);
  for (var i = 0; i &amp;lt; totalTables; i++) 
  {
    mainDiv.append(Table(data));
  }

  endTime = new Date();

  var timeSpend = new Date(endTime - startTime);

  $(&quot;#dvTime&quot;).text(&quot;Time Spent to generate &quot; + totalTables + &quot; in Minute : Seconds : MilliSeconds = &quot; + timeSpend.getMinutes() + &quot;:&quot; + timeSpend.getSeconds() + &quot;:&quot; + timeSpend.getMilliseconds());
}

function Table(data) 
{
  var table = $(&quot;&amp;lt;table&amp;gt;&amp;lt;/table&amp;gt;&quot;).attr({ cellpadding:&#39;0&#39;,cellspacing:&#39;0&#39;, border:&#39;1&#39;});

  for (var i = 0; i &lt; data.length; i++) 
  {
    table.append(Row(data[i]));
  }
  return table;
}


function Row(rowData) 
{
  var tr = $(&quot;&amp;lt;tr&amp;gt;&amp;lt;/tr&amp;gt;&quot;);
  for (var i in rowData) 
  {
    tr.append($(&quot;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&quot;).text(rowData[i]));
  }
  return tr;
}

&lt;/pre&gt;




The following picture shows you the result of this script

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8QHTDl6V-2x_SAE8FYK_DvjEj_XvhYu6ZJ9U0rWO3VUp8n8pYWOW-pGDPiLxxdN3lmU7qwL96HvwvyHKUa7wNdnOIsQFdHDfaw3OIUX_R-Rsa5lrcXK-QrgS7P0Ri3dpClWP4t_OC6l0/s1600/jQuery_Based_Dom_Element_Creation.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; width=&quot;292&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8QHTDl6V-2x_SAE8FYK_DvjEj_XvhYu6ZJ9U0rWO3VUp8n8pYWOW-pGDPiLxxdN3lmU7qwL96HvwvyHKUa7wNdnOIsQFdHDfaw3OIUX_R-Rsa5lrcXK-QrgS7P0Ri3dpClWP4t_OC6l0/s400/jQuery_Based_Dom_Element_Creation.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no34-extending-string-and-jquery.html&#39;&gt;
Continue to Part no.4&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/8535623902637466270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/01/test-no2-displaying-data-with-jquery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8535623902637466270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8535623902637466270'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/01/test-no2-displaying-data-with-jquery.html' title='Test no.2: Displaying data with jQuery based dom element creation in JavaScript/jQuery'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8QHTDl6V-2x_SAE8FYK_DvjEj_XvhYu6ZJ9U0rWO3VUp8n8pYWOW-pGDPiLxxdN3lmU7qwL96HvwvyHKUa7wNdnOIsQFdHDfaw3OIUX_R-Rsa5lrcXK-QrgS7P0Ri3dpClWP4t_OC6l0/s72-c/jQuery_Based_Dom_Element_Creation.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-3559759244591848027</id><published>2011-01-23T10:49:00.000-08:00</published><updated>2011-03-05T05:27:29.355-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>Test no.1: Displaying data with string based dom element creation in JavaScript</title><content type='html'>&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;Test no.1: Displaying data with string based dom element creation in JavaScript&lt;br /&gt;
&lt;/h1&gt;&lt;/div&gt;&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/creating-dom-elements-in.html&#39;&gt;&lt;br /&gt;
please read the Part.1 before continu&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Now by using the JSON object when window.onload function will be called a function will pass the function to create function. This function will first save the starting time in a variable and then generates the 100 tables. Then this will save the end time. Time difference will then calculated and displayed on top of tables. and following is the sample code for generating the tables using string based operations.&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;window.onload = function () { DisplayEmployees(jsonData); }
var startTime;
var endTime;
var totalTables = 100;
function DisplayEmployees(data) {
startTime = new Date();
for (var i = 0; i &amp;lt; totalTables; i++) {
document.getElementById(&quot;dvMain&quot;).innerHTML = document.getElementById(&quot;dvMain&quot;).innerHTML+Table(data);
}
endTime = new Date();
var timeSpend = new Date(endTime - startTime);
document.getElementById(&quot;dvTime&quot;).innerHTML = &quot;Time Spent to generate &quot;+totalTables+&quot; in Minute : Seconds : MilliSeconds = &quot; + timeSpend.getMinutes() + &quot;:&quot; + timeSpend.getSeconds() + &quot;:&quot; + timeSpend.getMilliseconds();


}
function Table(data) {

var table = &quot;&amp;lt;table cellpadding=&#39;0&#39; cellspacing=&#39;0&#39; border=&#39;1&#39;&amp;gt;&quot;;
for (var i = 0; i &amp;lt; data.length; i++) {
table += Row(data[i]);
}
table += &quot;&amp;lt;/table&amp;gt;&quot;;
return table;
}
function Row(rowData) {
var tr = &quot;&amp;lt;tr&amp;gt;&quot;;
for (var i in rowData) {
tr += &quot;&amp;lt;td&amp;gt;&quot; + rowData[i] + &quot;&amp;lt;/td&amp;gt;&quot;;
}
tr += &quot;&amp;lt;/tr&amp;gt;&quot;;
return tr;
}
&lt;/pre&gt;&lt;br /&gt;
The following picture shows you the result of this script&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixRbK0RsyIn4Stlv5HlpxlKEh6I4jAulqSfzYsjgD2Bg-wkdZ-1nPDqQY7aRHv_0VBPRI0NYq8bADzmjJiv81opxC_06m8ak-04EOVrR1dtgMQeGbRuxkKyp1nMkIK5aOh5p56UR5WaRY/s1600/String_Based_Dom_Element_Creation.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; width=&quot;287&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixRbK0RsyIn4Stlv5HlpxlKEh6I4jAulqSfzYsjgD2Bg-wkdZ-1nPDqQY7aRHv_0VBPRI0NYq8bADzmjJiv81opxC_06m8ak-04EOVrR1dtgMQeGbRuxkKyp1nMkIK5aOh5p56UR5WaRY/s400/String_Based_Dom_Element_Creation.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no2-displaying-data-with-jquery.html&#39;&gt;&lt;br /&gt;
Continue for Part no.3&lt;br /&gt;
&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/3559759244591848027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/01/test-no1-displaying-data-with-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/3559759244591848027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/3559759244591848027'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/01/test-no1-displaying-data-with-string.html' title='Test no.1: Displaying data with string based dom element creation in JavaScript'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixRbK0RsyIn4Stlv5HlpxlKEh6I4jAulqSfzYsjgD2Bg-wkdZ-1nPDqQY7aRHv_0VBPRI0NYq8bADzmjJiv81opxC_06m8ak-04EOVrR1dtgMQeGbRuxkKyp1nMkIK5aOh5p56UR5WaRY/s72-c/String_Based_Dom_Element_Creation.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-8885895210523892103</id><published>2011-01-23T10:24:00.000-08:00</published><updated>2011-03-05T05:30:06.081-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>Creating Dom elements in JavaScript/jQuery (table,div,span) using different techniques, their comparison based on performance and memory management</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;heading&quot;&gt;&lt;h1&gt;How Do i? Create Dom elemens in JavaScript/&lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/jQuery-Action-Second-Bear-Bibeault/dp/1935182323?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;jQuery &lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1935182323&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;(table,div,span) using different techniques, their comparison based on performance and memory management.&lt;/h1&gt;&lt;/div&gt;This is a 5 part article which takes you from different techniques to comparison of these techniques. It sounds like a long journey but nature of this article made me to go so long. Even though i skipped many explanations to save space and try to wind up things, i still end up this 5 part series.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/creating-dom-elements-in.html&#39;&gt;&lt;br /&gt;
Part no.1 Introduction&lt;/a&gt;&lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no1-displaying-data-with-string.html&#39;&gt;&lt;br /&gt;
Part no.2 Test no.1&lt;/a&gt;&lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no2-displaying-data-with-jquery.html&#39;&gt;&lt;br /&gt;
Part no.3 Test no.2&lt;/a&gt;&lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no34-extending-string-and-jquery.html&#39;&gt;&lt;br /&gt;
Part no.4 Test no.3,4&lt;/a&gt;&lt;br /&gt;
&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/comparision-of-string-and.html&#39;&gt;&lt;br /&gt;
Part no.5 Comparison, Result and Conclusion&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In many cases we have to create Dom elements (table, div, span, etc) in JavaScript. It could be due to the fact that we have to consume a web service and display data in tabular form. Or update a tabular record by calling an Ajax routine.&lt;br /&gt;
There could be many ways to achieve this but the most used form of creating Dom elements are of using the magic strings.&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;var div=&quot;&amp;lt;div&amp;gt;Operation Completed &amp;lt;/div&amp;gt;&quot;;
document.getElementbyId(&#39;dvMain&#39;).innerHTML=div;&lt;/pre&gt;This is very easy way to create a Dom element. It does not hurt performance and there is not a lot of memory consumption. But the fact that it’s not the right way of doing such thing remains. There is one better way of doing this&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;var element=createElement(&quot;div&quot;);
element.innerHTML=&quot;Operation Completed&quot;;
var insertBeforeElement=document.getElementById(&#39;dvMain&#39;);
document.body.insertBefore(element,insertInside);&lt;/pre&gt;doing so requires a lot of effort especially when it comes to built tables. Cross browser compatibility came into action and it takes a lot of time to make cross browser java scripting.  This could be answered by using some cross browser library e.g. jQuery, YUI,mooTools. Syntax for such operation in jQuery would be like&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;var element=$(&quot;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&quot;).text(&quot;operation completed&quot;);
$(&#39;#dvMain&#39;).append(element);&lt;/pre&gt;The above syntax is short and result is cross browser. Above technique uses the createElement under the hood to generate the elements. For more information please check the jQuery core library reference. &lt;br /&gt;
&lt;br /&gt;
Then there comes the question of performance. If we are not achieving performance or saving memory by the right technique why we are considering this as a better technique? At the end things comes to response time and memory management.&lt;br /&gt;
I have created a test pattern to check memory management and responsiveness. I have a JSON object which is an array of object. I will display this object in tabular form by using a generic table creator method and then I will try to extend this method to support more operations like doing an operation when a data is bound to an array.&lt;br /&gt;
&lt;br /&gt;
I will generate about 100 tables to check the responsiveness and then I will use the chrome browser tab management for memory in both cases. Time logging will be done by taking the start time and end time difference.&lt;br /&gt;
&lt;br /&gt;
I have 4 tests in all &lt;br /&gt;
&lt;br /&gt;
1. Creating 100 tables using string&lt;br /&gt;
2. Creating 100 tables using &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/jQuery-Action-Second-Bear-Bibeault/dp/1935182323?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;jQuery&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1935182323&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;&lt;br /&gt;
3. Extending test no.1 when row is bounded with a tr and try to manipulate it&lt;br /&gt;
4. Extending test no.2 when row is bounded with a tr and try to manipulate it&lt;br /&gt;
&lt;br /&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:WordDocument&gt;   &lt;w:View&gt;Normal&lt;/w:View&gt;   &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:TrackMoves/&gt;   &lt;w:TrackFormatting/&gt;   &lt;w:PunctuationKerning/&gt;   &lt;w:ValidateAgainstSchemas/&gt;   &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:DoNotPromoteQF/&gt;   &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:Compatibility&gt;    &lt;w:BreakWrappedTables/&gt;    &lt;w:SnapToGridInCell/&gt;    &lt;w:WrapTextWithPunct/&gt;    &lt;w:UseAsianBreakRules/&gt;    &lt;w:DontGrowAutofit/&gt;    &lt;w:SplitPgBreakAndParaMark/&gt;    &lt;w:DontVertAlignCellWithSp/&gt;    &lt;w:DontBreakConstrainedForcedTables/&gt;    &lt;w:DontVertAlignInTxbx/&gt;    &lt;w:Word11KerningPairs/&gt;    &lt;w:CachedColBalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathPr&gt;    &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;    &lt;m:brkBin m:val=&quot;before&quot;/&gt;    &lt;m:brkBinSub m:val=&quot;&amp;#45;-&quot;/&gt;    &lt;m:smallFrac m:val=&quot;off&quot;/&gt;    &lt;m:dispDef/&gt;    &lt;m:lMargin m:val=&quot;0&quot;/&gt;    &lt;m:rMargin m:val=&quot;0&quot;/&gt;    &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;    &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;    &lt;m:intLim m:val=&quot;subSup&quot;/&gt;    &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;true&quot;
  DefSemiHidden=&quot;true&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;267&quot;&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;0&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 7&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 8&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 9&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; Name=&quot;Default Paragraph Font&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;59&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Table Grid&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Placeholder Text&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Revision&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;List Paragraph&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Quote&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Emphasis&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Emphasis&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Reference&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Reference&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; Name=&quot;Bibliography&quot;/&gt;   &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Table Normal&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-qformat:yes;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-para-margin-top:0in;
 mso-para-margin-right:0in;
 mso-para-margin-bottom:10.0pt;
 mso-para-margin-left:0in;
 line-height:115%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-fareast-font-family:&quot;Times New Roman&quot;;
 mso-fareast-theme-font:minor-fareast;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;
 mso-bidi-font-family:&quot;Times New Roman&quot;;
 mso-bidi-theme-font:minor-bidi;}
&lt;/style&gt; &lt;![endif]--&gt;  &lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;JSON object that will be used in every example&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;var jsonData = [&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 0, &#39;FirstName&#39;: &#39;Ahmed&#39;, &#39;LastName&#39;: &#39;Mushtaq&#39;, &#39;Mobile&#39;: &#39;03003333333&#39;, &#39;isActive&#39;: false },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 1, &#39;FirstName&#39;: &#39;Ali&#39;, &#39;LastName&#39;: &#39;Raza&#39;, &#39;Mobile&#39;: &#39;0300123876&#39;, &#39;isActive&#39;: true },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 2, &#39;FirstName&#39;: &#39;Ghalia&#39;, &#39;LastName&#39;: &#39;Ahmed&#39;, &#39;Mobile&#39;: &#39;0300098765&#39;, &#39;isActive&#39;: false },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 3, &#39;FirstName&#39;: &#39;Shamoon&#39;, &#39;LastName&#39;: &#39;Perez&#39;, &#39;Mobile&#39;: &#39;0300123456&#39;, &#39;isActive&#39;: true },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 4, &#39;FirstName&#39;: &#39;Chaman&#39;, &#39;LastName&#39;: &#39;Nargis&#39;, &#39;Mobile&#39;: &#39;0300987789&#39;, &#39;isActive&#39;: true },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 5, &#39;FirstName&#39;: &#39;Naseer&#39;, &#39;LastName&#39;: &#39;Ali&#39;, &#39;Mobile&#39;: &#39;0300777777&#39;, &#39;isActive&#39;: true },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 6, &#39;FirstName&#39;: &#39;Sunbal&#39;, &#39;LastName&#39;: &#39;khalid&#39;, &#39;Mobile&#39;: &#39;03000987653&#39;, &#39;isActive&#39;: false },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 7, &#39;FirstName&#39;: &#39;Sameer&#39;, &#39;LastName&#39;: &#39;Raja&#39;, &#39;Mobile&#39;: &#39;03002345678&#39;, &#39;isActive&#39;: true },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 8, &#39;FirstName&#39;: &#39;Salat&#39;, &#39;LastName&#39;: &#39;Khair&#39;, &#39;Mobile&#39;: &#39;03008888888&#39;, &#39;isActive&#39;: false },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 9, &#39;FirstName&#39;: &#39;Shazia&#39;, &#39;LastName&#39;: &#39;Manzoor&#39;, &#39;Mobile&#39;: &#39;03003333333&#39;, &#39;isActive&#39;: true },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 10, &#39;FirstName&#39;: &#39;Shabeer&#39;, &#39;LastName&#39;: &#39;Ali&#39;, &#39;Mobile&#39;: &#39;03000987657&#39;, &#39;isActive&#39;: false },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 11, &#39;FirstName&#39;: &#39;Shoukat&#39;, &#39;LastName&#39;: &#39;Aziz&#39;, &#39;Mobile&#39;: &#39;03002345679&#39;, &#39;isActive&#39;: true },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 12, &#39;FirstName&#39;: &#39;Rizwan&#39;, &#39;LastName&#39;: &#39;Ahmed&#39;, &#39;Mobile&#39;: &#39;030000000000&#39;, &#39;isActive&#39;: true },&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ &#39;sr&#39;: 13, &#39;FirstName&#39;: &#39;Jamsheed&#39;, &#39;LastName&#39;: &#39;Junaid&#39;, &#39;Mobile&#39;: &#39;03001111111&#39;, &#39;isActive&#39;: true}];&lt;/div&gt;&lt;/pre&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;It has 14 rows 0 to 13 indexed. &lt;/div&gt;&lt;/div&gt;&lt;a href=&#39;http://aspilham.blogspot.com/2011/01/test-no1-displaying-data-with-string.html&#39;&gt;&lt;br /&gt;
Part no.2&lt;br /&gt;
&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/8885895210523892103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/01/creating-dom-elements-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8885895210523892103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8885895210523892103'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/01/creating-dom-elements-in.html' title='Creating Dom elements in JavaScript/jQuery (table,div,span) using different techniques, their comparison based on performance and memory management'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-1142114924632188532</id><published>2011-01-13T23:58:00.000-08:00</published><updated>2011-01-14T04:10:46.491-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Web Application Architecute"/><title type='text'>Better Asp.Net MVC Architectural decisions</title><content type='html'>&lt;h1&gt;&lt;center&gt;How Do I? create better &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Web-Application-Architecture-Principles-Protocols/dp/047051860X?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;architecture&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=047051860X&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; of Asp.Net MVC application&lt;/center&gt;&lt;/h1&gt;&lt;br /&gt;
Websites are no more simple websites. Minimum list of features required today converts them to applications and change is always on its ways. Creating a web application is not a difficult task but there are many scenarios where we got stuck due to lack of architectural support.&lt;br /&gt;
&lt;br /&gt;
Who creates the architecture? this real answer to this question is &quot;Our Requirements&quot;. In today world of Rapid development, processes are not important rather its people who are important. Main problem lies with the client and then the company perspective of application development.&lt;br /&gt;
&lt;br /&gt;
The main logic of any manager or client is &quot;every thing can be coded, why its taking so much time&quot;. That is the death of software engineering.&lt;br /&gt;
&lt;br /&gt;
This logic is good, good for client and maybe company when they want easy money easily and things working out the way it should be but this is the same reason that makes me believe we are not progressing, we are going back.&lt;br /&gt;
&lt;br /&gt;
People said Generalization is for mathematicians and specialization is for software engineers. I agree we have to specialize things to make it usable by the general public, to show it in the presentation layer. but is it really true what we show and what we code are the same things?&lt;br /&gt;
&lt;br /&gt;
I came across many things in my coding career and whenever i generalized, i was too happy to sleep that night and many times i saved 1000&#39;s of lines of code and re usability was just too much. That&#39;s the art of coding and that is the way of Software engineer.&lt;br /&gt;
&lt;br /&gt;
This is the case when i was having appropriate amount of time to think, but this is not true in all cases. We have to code like we type and that always lead to a poor &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Web-Application-Architecture-Principles-Protocols/dp/047051860X?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;architectural &lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=047051860X&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;decisions and poor &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/How-Break-Web-Software-Applications/dp/0321369440?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;application quality&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0321369440&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; and in this scheme there is not DRY. I love DRY and yet i am repeating myself again and again.&lt;br /&gt;
&lt;br /&gt;
In such circumstances where we have to deliver without thinking i created a generic application pattern and i am sure that this will help in long run and with time it will get mature.&lt;br /&gt;
&lt;br /&gt;
Better application is about better &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Web-Application-Architecture-Principles-Protocols/dp/047051860X?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;architectural decisions&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=047051860X&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;. here are my architectural decisions, let me know if you have any. Even though these are related to Asp.Net MVC.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;&lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Web-Application-Architecture-Principles-Protocols/dp/047051860X?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Architectural Decisions&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=047051860X&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;:&lt;/h2&gt;&lt;br /&gt;
With the introduction of WPF and Silverlight on its Dot net platform, Microsoft has also provided a guide of new architecture pattern that helps avoiding many pitfalls in development of &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Programming-4-0-Building-Applications-Framework/dp/0596159838?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;RIA applications&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596159838&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;. This architecture is called MVVM (Mode View and View-Model). Main advantage of using this architecture is to limit the dependency of different components on each other along with a better implementation of presentation layer, where this layer would only be showing the required data and firing events for requesting data. This will have very clean and neat presentation layer and will leave the presentation layer to decide only about how to present the data.&lt;br /&gt;
&lt;br /&gt;
Along with the above stated benefits, View-Model also helps to implement the presentation layer to implement in solid object oriented way rather than using or coding the magic string all around that at the end will leads to poor QC, high maintenance time.&lt;br /&gt;
Having described all the benefits still leaves the details of implementation details and how View-Model will be implemented in &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/ASP-NET-Framework-Experts-Voice-NET/dp/1430228865?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;MVC pattern&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1430228865&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;. The following picture presents the whole sequence of logical operations.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Logical View of &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/ASP-NET-Framework-Experts-Voice-NET/dp/1430228865?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;MVC&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1430228865&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; with View Model:&lt;/h2&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidIRvDtp4pSSi_q4VI2Wz260GWr686PxPA-lDfcX6YlLtMoinDn7b7yCizBavhLsuFPWWBI1Z6mnhxicUh41NQm8jYCewMeCYhmYWwv8ZwP0ZEWeSF70muXuaC7vefIgKViTi-UgGo_xo/s1600/MVC_Architecture_with_View_Model.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;199&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidIRvDtp4pSSi_q4VI2Wz260GWr686PxPA-lDfcX6YlLtMoinDn7b7yCizBavhLsuFPWWBI1Z6mnhxicUh41NQm8jYCewMeCYhmYWwv8ZwP0ZEWeSF70muXuaC7vefIgKViTi-UgGo_xo/s400/MVC_Architecture_with_View_Model.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Top level System View:&lt;/h2&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGp5OpQWCbjtTeE4VBXXDjSh5h5Mh7fGLZhvQyqy6OyASsAkyBnuXrkDBMixtn6vbR8wiIDD80_9QUDuhUbTtxjbMnWnESblMpGqTdaRpZjAPHpdi38BlspbDqRzVNFz3WHbmePCKdNpM/s1600/Top_View_Asp_Net_MVC_Architecture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;281&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGp5OpQWCbjtTeE4VBXXDjSh5h5Mh7fGLZhvQyqy6OyASsAkyBnuXrkDBMixtn6vbR8wiIDD80_9QUDuhUbTtxjbMnWnESblMpGqTdaRpZjAPHpdi38BlspbDqRzVNFz3WHbmePCKdNpM/s400/Top_View_Asp_Net_MVC_Architecture.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Data Layer View&lt;/h2&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1WvIDAdoBgj4PeADVsMzIT3FBl7BKxu47KzDAweTjXDprhzV-NoukWURwZjqVQULQM8wdrYZKavF1M6L3T0-sSFeIZu6DczGWDp2jmx2O-3yL2xJ5TA7x7alyimIQwJBBR41_5JWHmUk/s1600/MVC_Architecture_Data_Layer_Implementation.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; width=&quot;385&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1WvIDAdoBgj4PeADVsMzIT3FBl7BKxu47KzDAweTjXDprhzV-NoukWURwZjqVQULQM8wdrYZKavF1M6L3T0-sSFeIZu6DczGWDp2jmx2O-3yL2xJ5TA7x7alyimIQwJBBR41_5JWHmUk/s400/MVC_Architecture_Data_Layer_Implementation.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;sample User Controller from all the perspective:&lt;/h2&gt;&lt;br /&gt;
This diagram shows that for every Controller, there must be at least one business object(Model) and one to many View-Models. because View models are required for views. There are as many view models as views. and lastly there would be at least one Facade in data layer that present the all operations of business object. Facade is depending of Model not on controller.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnWLG36wyUwHTs4STndw2ix6amWowt_t4vrFzGpB2Q-KC0v4kNV2Ewnm_MlCILxY6TPsReuilvJT68BO7vm75oWBp5YglVi2Gx4QVyVdFDtfnQ61Mxa9yKFP7CttOnqrLDkjhknGRXacw/s1600/Sample_MVC_VIEW.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;223&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnWLG36wyUwHTs4STndw2ix6amWowt_t4vrFzGpB2Q-KC0v4kNV2Ewnm_MlCILxY6TPsReuilvJT68BO7vm75oWBp5YglVi2Gx4QVyVdFDtfnQ61Mxa9yKFP7CttOnqrLDkjhknGRXacw/s400/Sample_MVC_VIEW.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Top Level View  Model:&lt;/h2&gt;&lt;br /&gt;
There must be one base view model for many many reason. Experts already know and beginners always gets in trouble due to this. The problem rises when we use master page for doing many master operations e.g. login and user status. in this case master page will always accept a view model and view model that we will pass to the view will not fulfill it. So if we will have a base view model than we can solve this problem object oriented way. Also using base view model has superiority in error handling and standardization.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg58Oe3xsknuFQtaAvkol5rrPo39RkE_AI8KJpPFtaE9g4_E56xFgnLqKEEYmxLeD592CTe5nH_JpXuKhkG6sg_KO-EEMb_KWx5iJyWiwK-75JjtrpI12A4UGwqKIWSNqK1RHzb9Zaeg54/s1600/View_Model_base_Asp_Net_MVC_Views.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;293&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg58Oe3xsknuFQtaAvkol5rrPo39RkE_AI8KJpPFtaE9g4_E56xFgnLqKEEYmxLeD592CTe5nH_JpXuKhkG6sg_KO-EEMb_KWx5iJyWiwK-75JjtrpI12A4UGwqKIWSNqK1RHzb9Zaeg54/s400/View_Model_base_Asp_Net_MVC_Views.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Sample Add User View Model:&lt;/h2&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM7Ws57zfCYJrJOSn6NLszPSMiFcCbe_mJII6afwMalyJTKoQ7_s41LYg5canOuxqsAQp3S84F89-1cgLf4MEY3UNYZr-AwvZZa9UX4Mulf5sMPxoxxJKGqHbze5fUpsbjkkYGYnYJ5YM/s1600/Add_User_View_Model.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left:1em; margin-right:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; width=&quot;366&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM7Ws57zfCYJrJOSn6NLszPSMiFcCbe_mJII6afwMalyJTKoQ7_s41LYg5canOuxqsAQp3S84F89-1cgLf4MEY3UNYZr-AwvZZa9UX4Mulf5sMPxoxxJKGqHbze5fUpsbjkkYGYnYJ5YM/s400/Add_User_View_Model.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That is all for right now. Any improvment suggestion is welcome and will be appreciate greatly.</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/1142114924632188532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/01/better-aspnet-mvc-architectural.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/1142114924632188532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/1142114924632188532'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/01/better-aspnet-mvc-architectural.html' title='Better Asp.Net MVC Architectural decisions'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidIRvDtp4pSSi_q4VI2Wz260GWr686PxPA-lDfcX6YlLtMoinDn7b7yCizBavhLsuFPWWBI1Z6mnhxicUh41NQm8jYCewMeCYhmYWwv8ZwP0ZEWeSF70muXuaC7vefIgKViTi-UgGo_xo/s72-c/MVC_Architecture_with_View_Model.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-2943117217361303022</id><published>2011-01-13T10:11:00.000-08:00</published><updated>2011-03-05T05:31:30.849-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LINQ to SQL"/><title type='text'>set connection string in LINQ dbml file Default Constructor from web.config</title><content type='html'>&lt;center&gt;&lt;h1&gt;&lt;b&gt;&amp;nbsp;How Do I? Change Connection String of datacontext default constructor from web.config&lt;/b&gt;&lt;/h1&gt;&lt;/center&gt;&lt;br /&gt;
Using &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Pro-LINQ-Language-Integrated-Query/dp/1430226536?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Ling to Sql&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1430226536&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; makes it really easy to easily create a data layer but not planing properly cost at later stage of development when time is critical and things are not working out as they suppose to be.&lt;br /&gt;
&lt;br /&gt;
while doing maintenance in a website i noticed that the initial design or architect decision was taken or without any decision , Ling to SQL generator default constructor was used to handle the database connection string.&lt;br /&gt;
&lt;br /&gt;
when working with &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Pro-LINQ-Language-Integrated-Query/dp/1430226536?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Ling to SQL&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1430226536&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;, it generates many constructors. Default constructor of dbml file will always use the data string that it generates and stored in settings class. If different database will be used in development, it will record all database connection strings and will use the last database connection string. while this works out for development time, on deployment in staging or live, it always give trouble to beginners as it is using connection string from the settings class and that points to local system.&lt;br /&gt;
&lt;br /&gt;
the initial response to this error is to hard code the staging or live connection string in dbml default constructor and deploy it. while this works out perfectly, every now change will have to be recompiled as dbml file will always discard changes.&lt;br /&gt;
&lt;br /&gt;
solution to this problem is to always create a connection helper class that will return you the datacontext object and it will help you in future to use the load balancing and fail over techniques.&lt;br /&gt;
&lt;br /&gt;
but to solve this problem of realization after deveopment there is a way out. dbml datacontext class is a partial class and every function of CRUD it generates against each table in this class is a partial function. To learn more about Partial class and Partial function &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/wa80x488.aspx&quot;&gt;click here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Simple we can add more functionaliy in the partial class and we can implement the partial function. In our case if we examine the default constructor of dbml file, it shows a call to OnCreated partial function. we can give definition to this function and this will solve our problem. here is the default constructor of a sample dbml &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;c-sharp&quot;&gt;public partial class DataLayerDataContext : System.Data.Linq.DataContext
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; #region Extensibility Method Definitions
&amp;nbsp;&amp;nbsp;&amp;nbsp; partial void OnCreated();
}
&lt;/pre&gt;when a default constructor will be called, our implementation of  OnCreated() will be called which is residing in a different class file  inside the project. Then we can change the connection string from the web.config file. here is the implementation of partial function OnCreated.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;padding:6px;background-color:red;color:white;&quot;&gt;NOTE: you have to add reference to System.Web.Configuration to access WebConfigurationManager class&lt;br /&gt;
&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;c-sharp&quot;&gt;public partial class DataLayerDataContext : System.Data.Linq.DataContext
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; partial void OnCreated()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string connectionString = WebConfigurationManager.ConnectionStrings[&quot;AnswersExpertsConnectionString&quot;].ToString();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Connection.ConnectionString = connectionString;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/pre&gt;Hope this will help beginners and are facing such problem.</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/2943117217361303022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2011/01/how-do-i-set-connection-string-in-linq.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/2943117217361303022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/2943117217361303022'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2011/01/how-do-i-set-connection-string-in-linq.html' title='set connection string in LINQ dbml file Default Constructor from web.config'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-1055337830210129383</id><published>2010-04-14T13:25:00.000-07:00</published><updated>2011-01-14T03:37:30.285-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="silverlight"/><title type='text'>file upload in chunks using silverlight and webservice</title><content type='html'>&lt;div style=&quot;text-align: center;&quot;&gt;&lt;h1&gt;How Do I? &lt;/h1&gt;&lt;h1&gt;File upload in chunks throught Silverlight and webservice&lt;/h1&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;This is a very basic file upload control that can upload file in chunks using a webservice. In this article I will explain you how to upload file in chunks and with this article I have uploaded the whole project. you can use it to extend or use it as it is.&lt;br /&gt;
This control is in three parts…&lt;br /&gt;
&lt;br /&gt;
1- &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Pro-Silverlight-4-Matthew-MacDonald/dp/1430229799?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Silverlight&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1430229799&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;&lt;br /&gt;
2- &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Web-Web-Services-Database-Systems-Database-Related/dp/3540007458?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;WebService&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=3540007458&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; &lt;br /&gt;
3- Website &lt;br /&gt;
&lt;br /&gt;
The only difficult part is the &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Pro-Silverlight-4-Matthew-MacDonald/dp/1430229799?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Silverlight&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1430229799&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; one. It’s not very difficult but it requires understanding the basics of how to convert the file in chunks so data can be uploaded in server in small chunks. This will be very useful in many scenarios e.g. large file upload.&lt;br /&gt;
&lt;br /&gt;
Let’s start with &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Pro-Silverlight-4-Matthew-MacDonald/dp/1430229799?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Silverlight&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1430229799&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;&lt;br /&gt;
&lt;h2&gt;&lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Pro-Silverlight-4-Matthew-MacDonald/dp/1430229799?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;SilverLight &lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1430229799&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;&lt;/h2&gt;We need a Silverlight control that can upload file in chunks. Along with the chunks we need a way to show the progress of uploaded file. GUI is simple, there is one browse button that will open the OpenFileDialog and will help user to pick a file. When user will select the file, the file name will be shown in a label and uploading will begin. A progress bar will be displayed to show that file is uploading in the server. After the whole file will upload, the success message will be display. I end up making the following simple GUI&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdIcJoU0lik-3_QRqpQo6_8q706jELco0JmLDAN8uOi1oRfkF1KnmQHAn5J6Z5JR1hEarBP0Sxx-7ImP58NbNTlh42lwHQnHQpBGcZ3wBFTGF5AQ5Tz0HVRNbv8QBdKruEqJdcM9BKn1Q/s1600/file_upload_control_silverlight_webservice_GUI.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;172&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdIcJoU0lik-3_QRqpQo6_8q706jELco0JmLDAN8uOi1oRfkF1KnmQHAn5J6Z5JR1hEarBP0Sxx-7ImP58NbNTlh42lwHQnHQpBGcZ3wBFTGF5AQ5Tz0HVRNbv8QBdKruEqJdcM9BKn1Q/s400/file_upload_control_silverlight_webservice_GUI.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What happen behind is also very simple…&lt;br /&gt;
Let’s dig the Browse button click event. When user will click the browse button, openfiledialog will be displayed. User will select a file and event will check if user has selected a file and start to read the file by using a file stream. Then this stream will get converted into bytes. These bytes will get converted into chunks and this control will start sending chunks and after every successful chunk, this control will send the next chunk of file. Chunk size is fixed in this program to 15kB. Here is the code of browse button event&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimIVs1qpJnlINBRKB59XA3KffBMjwRHLOv8GAsOADxSoJx-zZpOEjXhtsegyIPjjM7eSvHLcXdPGci1pjGJBzD2exeCeX3xbaJoTjekT_Cdf0ByhEpqPlEB0MJBsOCbQixh7VmgGCdhdY/s1600/file_upload_control_silverlight_webservice_BrowseEvent.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;325&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimIVs1qpJnlINBRKB59XA3KffBMjwRHLOv8GAsOADxSoJx-zZpOEjXhtsegyIPjjM7eSvHLcXdPGci1pjGJBzD2exeCeX3xbaJoTjekT_Cdf0ByhEpqPlEB0MJBsOCbQixh7VmgGCdhdY/s400/file_upload_control_silverlight_webservice_BrowseEvent.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next thing is how convert to chunk function is working.It is really simple; first it will count the total chunks by dividing the number of bytes with the upload chunk size then with will start to add this chunk in a list of chunks. I am preparing this list of chunks as a global variable so I can send one chunk, maintain its index and when I will receive the success of uploaded chunk, I will send the next file chunk.&lt;br /&gt;
Here is the code of file convert to chunks function&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiitNqXa8g58pAhVxV7By1_glwMelSGHUKEkAlY_hdjecYIFW2QPeRDRPeT_FTN9ouphnoQXN0SwyojU3gOiQjkWXLxRIfYq9IAiIq8XDD0Z7DXKALYfLtmn1HXIPt5s4p8Xdnv7wwZ-fk/s1600/file_upload_control_silverlight_webservice_Convert_To_Chunks.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;376&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiitNqXa8g58pAhVxV7By1_glwMelSGHUKEkAlY_hdjecYIFW2QPeRDRPeT_FTN9ouphnoQXN0SwyojU3gOiQjkWXLxRIfYq9IAiIq8XDD0Z7DXKALYfLtmn1HXIPt5s4p8Xdnv7wwZ-fk/s640/file_upload_control_silverlight_webservice_Convert_To_Chunks.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next step is to start uploading chunk. This control uses the webservice to upload the file and upload function will simple send a chunk of bytes to webservice along with the file name. I am using the file real name which user will select but this is not practical so to use this control you should come up with a unique file name to avoid conflicting file name uploading by different users also different file name is necessary for this control to work appropriately.&lt;br /&gt;
Here is the code of upload file function&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkJXZxKWHN0QGy5rQH6YpRI7zF0yQc6Jx8T7i0Ln2qIpaLqz43v-q0_7sUB-imfrWaJTeod11mMYwiDZMJ8xkCQFLBTZiY0H6uj57c-uqvFWQidsdwREwihh8Z1KRT6GVoKEIxnbe-x84/s1600/file_upload_control_silverlight_webservice_Upload_Chunks.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;67&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkJXZxKWHN0QGy5rQH6YpRI7zF0yQc6Jx8T7i0Ln2qIpaLqz43v-q0_7sUB-imfrWaJTeod11mMYwiDZMJ8xkCQFLBTZiY0H6uj57c-uqvFWQidsdwREwihh8Z1KRT6GVoKEIxnbe-x84/s400/file_upload_control_silverlight_webservice_Upload_Chunks.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This function is called async and when this function will complete we will get an event and in this event we will make sure that last chunk is uploaded and then we will send the next chunk. Here is the code&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgS1IAd2cXif-txJt06lhdAG-xxCwhqRJF7Q7A7QHrW4jEDKhUqdCqq9d5KNeRhADtzuDEONnlBVK6sbOSihgGujL8a4OBTdq0Qp99-MrFUwMH0jkYSxIvw1aism8vPGypLxJkWGUvQxI/s1600/file_upload_control_silverlight_webservice_next_chunk.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;315&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgS1IAd2cXif-txJt06lhdAG-xxCwhqRJF7Q7A7QHrW4jEDKhUqdCqq9d5KNeRhADtzuDEONnlBVK6sbOSihgGujL8a4OBTdq0Qp99-MrFUwMH0jkYSxIvw1aism8vPGypLxJkWGUvQxI/s640/file_upload_control_silverlight_webservice_next_chunk.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
That’s the end of Silverlight control and most of the logic. There are just two tiny function remains. One is in the webservice and second one in the business layer or in a class that stores in you app_code folder.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;&lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Web-Web-Services-Database-Systems-Database-Related/dp/3540007458?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;WebService&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=3540007458&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;&lt;/h2&gt;Webservice has only one function and this function receives the uploaded bytes and sends it to the uploading class in business layer. Here is the code&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQEQpSbj-jfaWIN5rP60JKFfgmRh2Pgm6qMQwCQ_OHqrhEMNICiOSo7CoXvNdp51-L-p9MBOzjCE0ewIAu7D5HuaZIgJIdJwuUJ6JLOEfnkc3Rd-RYtwS0zp1CNvOX_hWIAFDUZwRP2Xo/s1600/webservice.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;116&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQEQpSbj-jfaWIN5rP60JKFfgmRh2Pgm6qMQwCQ_OHqrhEMNICiOSo7CoXvNdp51-L-p9MBOzjCE0ewIAu7D5HuaZIgJIdJwuUJ6JLOEfnkc3Rd-RYtwS0zp1CNvOX_hWIAFDUZwRP2Xo/s400/webservice.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Class logic inside your app_code/business layer&lt;/h2&gt;Logic of saving chunks is as follows, &lt;br /&gt;
Function will check if it is a new file by checking if file does not exist in the pre defined directory. If it is a new file, it will create the file using file stream and will write the bytes to this file and close the stream. Next time when it will receive the next chunk, it will see if this file exists in the directory and as this file already exist, it will open the file in a stream and write the bytes to this stream and close the stream. This way chunks will be written in file until it will successfully complete.&lt;br /&gt;
Here is the code&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ1TjzPA_Lsh4h6BhyD2YGJjiUiyDBBWpb85nbJXxQ72OQkyAarqfe5YhfnYr6Hl_T_Y3woBavcQTrzRSZ9gfPOMwVykD_RQOJyqrBXqDAIc3yI59fzBq76aQ6MQS1fZBuowPz40DCAwc/s1600/filesavelogic.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;595&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ1TjzPA_Lsh4h6BhyD2YGJjiUiyDBBWpb85nbJXxQ72OQkyAarqfe5YhfnYr6Hl_T_Y3woBavcQTrzRSZ9gfPOMwVykD_RQOJyqrBXqDAIc3yI59fzBq76aQ6MQS1fZBuowPz40DCAwc/s640/filesavelogic.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
you can download the complete solution from this link &lt;a href=&quot;http://rapidshare.com/files/375917799/Silverlight_file_upload_chunks_webservice.zip&quot;&gt;click here&lt;/a&gt;&lt;br /&gt;
&amp;nbsp;http://rapidshare.com/files/375917799/Silverlight_file_upload_chunks_webservice.zip&lt;br /&gt;
And that is it, I hope this effort will help and if anybody needs more help, I will be happy to help him.</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/1055337830210129383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2010/04/file-upload-in-chunks-using-silverlight.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/1055337830210129383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/1055337830210129383'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2010/04/file-upload-in-chunks-using-silverlight.html' title='file upload in chunks using silverlight and webservice'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdIcJoU0lik-3_QRqpQo6_8q706jELco0JmLDAN8uOi1oRfkF1KnmQHAn5J6Z5JR1hEarBP0Sxx-7ImP58NbNTlh42lwHQnHQpBGcZ3wBFTGF5AQ5Tz0HVRNbv8QBdKruEqJdcM9BKn1Q/s72-c/file_upload_control_silverlight_webservice_GUI.png" height="72" width="72"/><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-5072579098151194713</id><published>2009-11-26T03:58:00.000-08:00</published><updated>2011-01-14T01:35:19.702-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Google API&#39;s"/><title type='text'>Integrating Google Map with Asp.net</title><content type='html'>Hi&lt;br /&gt;
In this project i have integrated google map with asp.net .To achieve this i used google API in java script and merge it with my c# code to give me the desired location .This map works for every address wordl wide.&lt;br /&gt;
Here is my .aspx code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD6u7bve-SwwZQQNKuOkNvaj-3eisAPEZYGi22hlHVnWiCPaHEG-yqctxUaceGXF0bFeCdb4ZF1czaK-sQwSKIl5ZFWUkD7cJEsbypK2KvGpXTbhj21mB3B8ko7FZ2HMEwua5VSA1VBahH/s1600/gmap.bmp&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD6u7bve-SwwZQQNKuOkNvaj-3eisAPEZYGi22hlHVnWiCPaHEG-yqctxUaceGXF0bFeCdb4ZF1czaK-sQwSKIl5ZFWUkD7cJEsbypK2KvGpXTbhj21mB3B8ko7FZ2HMEwua5VSA1VBahH/s320/gmap.bmp&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5408392684403713842&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now I will explain what i have done.&lt;br /&gt;
1. I  include the Maps API JavaScript using a script tag.&lt;br /&gt;
2. I create a div element named &quot;map_canvas&quot; to hold the Map.&lt;br /&gt;
3. I write a JavaScript function to create a &quot;map&quot; object.&lt;br /&gt;
4. I center the map on a given geographic point and set the UI to a default configuration.&lt;br /&gt;
5. I  initialize the map object from the body tag&#39;s onLoad event.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;GMap2&lt;/span&gt;&lt;br /&gt;
The JavaScript class that represents a map is the GMap2 class. Objects of this class define a single map on a page. (You may create more than one instance of this class - each object will define a separate map on the page.) We create a new instance of this class using the JavaScript new operator. When you create a new map instance, you specify a DOM node in the page (usually a div element) as a container for the map. HTML nodes are children of the JavaScript document object, and we obtain a reference to this element via the document.getElementById() method.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Loading the Google Maps API&lt;/span&gt;&lt;br /&gt;
The &quot;http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;sensor=true&amp;amp;key=ABQIAAAAS0CLSrRmVbOFpr_bJyKH1xT4i6_Sq4XS6t48Z_RVvNgiFzkwmRSkqVbEIbgIBh-mPA-G_o0pQYjIpg URL points to the location of the JavaScript file that includes all of the symbols and definitions you need for using the Google Maps API. Your page must contain a script tag pointing to this URL, using the key you received when you signed up for the API. You can sign up for a key at http://code.google.com/apis/maps/signup.html    .&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Latitudes and Longitudes&lt;/span&gt;&lt;br /&gt;
Now that we have a map, we need a way to refer to locations on the map.The GLatLng object provides such a mechanism within the Google Maps API. You construct a GLatLng object, passing its parameters in the order { latitude, longitude } as is customary in cartography:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Markers&lt;/span&gt;&lt;br /&gt;
Points on the map are displayed using markers, and often display a custom icon. Markers are objects of type GMarker . markers can be both draggable and static.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Map Overlays&lt;/span&gt;&lt;br /&gt;
Overlays are objects on the map that are tied to latitude/longitude coordinates, so they move when you drag or zoom the map. Overlays reflect objects that you &quot;add&quot; to the map to designate points, lines, or areas.&lt;br /&gt;
&lt;br /&gt;
Now i move to my .cs code&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Configuration;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.Security;&lt;br /&gt;
using System.Web.UI;&lt;br /&gt;
using System.Web.UI.WebControls;&lt;br /&gt;
using System.Web.UI.WebControls.WebParts;&lt;br /&gt;
using System.Web.UI.HtmlControls;&lt;br /&gt;
using System.Net;&lt;br /&gt;
&lt;br /&gt;
public partial class Gmap : System.Web.UI.Page&lt;br /&gt;
{&lt;br /&gt;
private const string _googleUri = &quot;http://maps.google.com/maps/geo?q=&quot;;&lt;br /&gt;
private const string _googleKey = &quot;ABQIAAAAS0CLSrRmVbOFpr_bJyKH1xT4i6_Sq4XS6t48Z_RVvNgiFzkwmRSkqVbEIbgIBh-mPA-G_o0pQYjIpg&quot;;&lt;br /&gt;
private const string _outputType = &quot;csv&quot;;&lt;br /&gt;
&lt;br /&gt;
protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
string[] st = GetCoordinates(&quot;Gulshanabad,rawalpindi,pakistan&quot;);&lt;br /&gt;
lat.Text = st[2].ToString();&lt;br /&gt;
longtitude.Text = st[3].ToString();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
private static Uri GetGeocodeUri(string address)&lt;br /&gt;
{&lt;br /&gt;
address = HttpUtility.UrlEncode(address);&lt;br /&gt;
return new Uri(String.Format(&quot;{0}{1}&amp;amp;output={2}&amp;amp;key={3}&quot;, _googleUri, address, _outputType, _googleKey));&lt;br /&gt;
}&lt;br /&gt;
public static string[] GetCoordinates(string address)&lt;br /&gt;
{&lt;br /&gt;
WebClient client = new WebClient();&lt;br /&gt;
Uri uri = GetGeocodeUri(address);&lt;br /&gt;
string[] geocodeInfo = client.DownloadString(uri).Split(&#39;,&#39;);&lt;br /&gt;
return geocodeInfo;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
here i used google&#39;s webservice in order to calculate latitude and longtitude values based on the address passed. at Page_Load i passed the address to the function name GetCoordinated(); the get coordinates then pass the address to GETGeocode () which sent the address to the webservice and return the output in CSV format.&lt;br /&gt;
in csv format values are seperated by commas. it return four values seperated by the &quot;,&quot;. we only needed the last two values as we only require them .we split the return file and store it in a string and pass that string back.&lt;br /&gt;
string[] array size is four. we get the 3 and fourth location data (as these are the latitude and longtitude values which we will be needing as a location in our map).we will store the data in the labels already defined and access their values in our javascript code.&lt;br /&gt;
&lt;br /&gt;
By this we are done and our google map is fully integrated with our asp.net , and it is properly functional.&lt;br /&gt;
Thanks</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/5072579098151194713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2009/11/integrating-google-map-with-aspnet.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/5072579098151194713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/5072579098151194713'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2009/11/integrating-google-map-with-aspnet.html' title='Integrating Google Map with Asp.net'/><author><name>Raja Fawad Ahmed</name><uri>http://www.blogger.com/profile/00841398498743219618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD6u7bve-SwwZQQNKuOkNvaj-3eisAPEZYGi22hlHVnWiCPaHEG-yqctxUaceGXF0bFeCdb4ZF1czaK-sQwSKIl5ZFWUkD7cJEsbypK2KvGpXTbhj21mB3B8ko7FZ2HMEwua5VSA1VBahH/s72-c/gmap.bmp" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-6057887909315844633</id><published>2009-11-04T12:33:00.000-08:00</published><updated>2011-01-14T01:34:54.954-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="silverlight"/><title type='text'>Data binding to combobox inside DataGrid</title><content type='html'>&lt;meta content=&quot;text/html; charset=utf-8&quot; http-equiv=&quot;Content-Type&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Word.Document&quot; name=&quot;ProgId&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Microsoft Word 12&quot; name=&quot;Generator&quot;&gt;&lt;/meta&gt;&lt;meta content=&quot;Microsoft Word 12&quot; name=&quot;Originator&quot;&gt;&lt;/meta&gt;&lt;link href=&quot;file:///C:%5CUsers%5CMamoon%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CUsers%5CMamoon%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CUsers%5CMamoon%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:0 0 0 0 0 0 0 0 0 0;
	mso-font-charset:1;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:variable;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-520092929 1073786111 9 0 415 0;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:modern;
	mso-font-pitch:fixed;
	mso-font-signature:-520092929 1073806591 9 0 415 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:549719;
	mso-list-type:hybrid;
	mso-list-template-ids:-1596447494 262673782 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
	{mso-level-text:%1-;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:.75in;
	text-indent:-.25in;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:1.25in;
	text-indent:-.25in;}
@list l1
	{mso-list-id:1805851343;
	mso-list-type:hybrid;
	mso-list-template-ids:1456614068 683173902 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
	{mso-level-text:%1-;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--&gt;
&lt;/style&gt;  &lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;Data binding to combobox inside DataGrid in Silverlight&lt;br /&gt;
&lt;/b&gt;&lt;/h1&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;/div&gt;&lt;h3&gt;Step 1:&lt;/h3&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Create a class to bind with data grid&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;public class patient : INotifyPropertyChanged&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; public string fName{get;set;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; public string lName{get;set;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; public string patientAccount{get;set;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; private string AppointmentStatus;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; public string appointmentStatus &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return AppointmentStatus; } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AppointmentStatus = value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (PropertyChanged != null)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;PropertyChanged(this, new PropertyChangedEventArgs(&quot;AppointmentStatus&quot;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;//constructor&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;public patient(string fName,string lName,string patientAccount,string appointmentStatus)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.fName=fName;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.lName=lName;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.patientAccount=patientAccount;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.appointmentStatus = appointmentStatus;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public event PropertyChangedEventHandler PropertyChanged;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;h3&gt;NOTE:&lt;/h3&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;InotifyPropertyChanged is implemented inside System.ComponentModel NameSpace&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;This is a simple class that holds the element for one row of data grid. There are three text and one combo box. I will bind the combobox to reflect the change in patient class.&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;This class also implements the InotifyPropertyChanged to give an event on the change of a property. We can fire this on every property change or one property as desired.&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Now we have to create a class that will hold all the rows of datagrid. Above class only present one row of datagrid.&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;We can do this&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;List&amp;lt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;patient&amp;gt; patientList=new List&lt;patient&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/patient&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Or we can create our own class that implements the collection model.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;public class patients : ObservableCollection&lt;patient&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/patient&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;public patients()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; patient p = new patient(&quot;Mamoon&quot;, &quot;ur Rasheed&quot;, &quot;1010100&quot;, &quot;Cleared&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; p.PropertyChanged += new PropertyChangedEventHandler(p_PropertyChanged);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; this.Add(p);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; p = new patient(&quot;Ahmed&quot;, &quot;Jamsheed&quot;, &quot;1010200&quot;, &quot;Rescheduled&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; p.PropertyChanged += new PropertyChangedEventHandler(p_PropertyChanged);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; this.Add(p);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; p = new patient(&quot;Nisar&quot;, &quot;Ali&quot;, &quot;1010300&quot;, &quot;Cancelled&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; p.PropertyChanged += new PropertyChangedEventHandler(p_PropertyChanged);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;this.Add(p);&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;void p_PropertyChanged(object sender, PropertyChangedEventArgs e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; patient p=(patient)sender;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; MessageBox.Show(&quot;First Name: &quot;+p.fName+&quot;\nLast Name: &quot;+p.lName+&quot;\nPatient Account: &quot;+p.patientAccount+&quot;\nAppointment Status: &quot;+p.appointmentStatus);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;h3&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;NOTE:&lt;/span&gt;&lt;/h3&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; ObservableCollection is defined in System.Collections.ObjectModel NameSpace&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;This class implements the ObservableCollection to make it a collection class. Detail is simple, in constructor I am adding three patients details and alos binding to propertyChanged event&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;h3&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Step 2:&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Defining the combobox items &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;public class appointmentStatus : ObservableCollection&lt;string&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/string&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public appointmentStatus()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Add(&quot;Cancelled&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Add(&quot;Cleared&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Add(&quot;Rescheduled&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;This class also implements the ObservableCollection to make it a collection class and in the constructor, it adds three items.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;Now I will create a class that will be called directly to get the appointment status for combobox.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class appointmentStatusList&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public appointmentStatus appStatus&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new appointmentStatus();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.appStatus=value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;This class did nothing special other than returning the appointment status list. This will be used to bind the combobox inside datagrid.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;br /&gt;
&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;h3&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Step 3:&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;C# code behind file&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Linq;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Net;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Windows;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Windows.Controls;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Windows.Documents;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Windows.Input;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Windows.Media;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Windows.Media.Animation;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;using System.Windows.Shapes;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;namespace SilverlightApplication&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public partial class MainPage : UserControl&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; patients p;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public MainPage()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p = new patients();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datagrid1_bindData();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void datagrid1_bindData()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //patients p = new patients();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataGrid1.ItemsSource = p;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void displayValue()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (patient pat in p)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(pat.appointmentStatus);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void button1_Click(object sender, RoutedEventArgs e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; displayValue();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;This above code will first initilize the patients class new object and then assign it to datagrid1 as itemsource.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;h3&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Step 4:&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;There are three important steps:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left: 0.75in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;1-&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Add the namespace of your application as highligted below in XAML. In my case it is silverlightapplication&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 0.75in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;2-&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Add the &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.5pt; line-height: 115%;&quot;&gt;appointmentStatusList &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;class as the resource of user control as highlighted in second number in the following XAML&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 0.75in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;3-&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Define the datagrid columns&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1.25in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;a.&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;3 text columns&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: 1.25in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;b.&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;1 combobox&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;usercontrol x:class=&quot;SilverlightApplication.MainPage&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/usercontrol&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXsIXnn_lr3U0z-RIBF1CwqMfzLmeFDQR4DJMO0fq8MWtoERFaLLuaA3gFfNCfT9540oi16CMZ_N3sCAToIzWCpSDjEEXFreOjfpnq-A2eDbptveBu5k1qE8EcFO_Be7k_FHpk3ZT0iZg/s1600-h/comboboxbinding.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXsIXnn_lr3U0z-RIBF1CwqMfzLmeFDQR4DJMO0fq8MWtoERFaLLuaA3gFfNCfT9540oi16CMZ_N3sCAToIzWCpSDjEEXFreOjfpnq-A2eDbptveBu5k1qE8EcFO_Be7k_FHpk3ZT0iZg/s640/comboboxbinding.PNG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;As you see datagrid1 itemsource property was set in code behind file. In this above XAML, datagrid members are defined to bind with the properties that are in patient.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Combobox is a difficult thing to bind when inside datagrid.First if you will recall I wrote in description of patient class that appointmentstatus is added to selecte the default value of combobox. Appointment status holds the value that you wish to be selected by default. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;ItemsSource=&quot;{Binding appStatus,Source={StaticResource appointmentStatusList}}&quot; &amp;nbsp;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;SelectedItem is bound with appointmentStatus that will used to select the value inside appointmentStatusList.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;ItemSource property is bound in different way, there are two major part. First is &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Source={StaticResource appointmentStatusList}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;That is actually the part that we have to define in our XAML and I have already described them at the start.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Second &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;{Binding appStatus}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Which is the property of appointmentStatusList class. What happen here is, For each combobox inside the datagrid, a new instance of appointmentStatusList will be created and its default value will be selected by using the selectedItem binding property.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;h3&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Binding Mode:&lt;/span&gt;&lt;/h3&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;I have binded the combobox selectedItem property in TwoWay mode. There are three modes&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;1-&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;OneTime ( Bind once )&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;2-&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;OneWay (Bind once and it can change the value of associated property but not object)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;3-&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size-adjust: none; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;TwoWay (with this mode, change will get reflected to the object)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;When you will run this program, and you will change the appointment status, you will see a message box that will show the change property that gets reflected in object.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;I hope this article will help.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;h2&gt;Download:&lt;/h2&gt;http://rapidshare.com/files/302472648/silverlight_combobox_inside_datagrid_binding.zip&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/6057887909315844633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2009/11/data-binding-to-combox-inside-datagrid.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/6057887909315844633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/6057887909315844633'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2009/11/data-binding-to-combox-inside-datagrid.html' title='Data binding to combobox inside DataGrid'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXsIXnn_lr3U0z-RIBF1CwqMfzLmeFDQR4DJMO0fq8MWtoERFaLLuaA3gFfNCfT9540oi16CMZ_N3sCAToIzWCpSDjEEXFreOjfpnq-A2eDbptveBu5k1qE8EcFO_Be7k_FHpk3ZT0iZg/s72-c/comboboxbinding.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-2127712344765463392</id><published>2009-10-19T10:26:00.000-07:00</published><updated>2011-01-14T01:34:18.793-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>JavaScript Object Oriented Programming (prototype)</title><content type='html'>&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;span style=&quot;text-align: center;font-size:medium;&quot;&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;How Do I use&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;h1&gt;Object Oriented Techniques in JavaScript&lt;/h1&gt;&lt;/span&gt;&lt;/h1&gt;&lt;div&gt;&lt;h2&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Introduction&lt;/span&gt;&lt;/h2&gt;&lt;h2&gt;&lt;/h2&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;JavaScript doesn’t have the class keyword to support OOP like JAVA, C# and C++ but it doesn’t mean it is not object oriented. JavaScript is a prototype base language and support object oriented technique in prototype syntax.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Basically JavaScript functions perform the dual functionality of being the procedure and class. Even though it’s not as straight forward and simple like today modern languages but it does have its own advantages specially in today world of AJAX where client side is coming more complicated and needs to be OOP concept now a days. Let’s face it folks, web sites are not more simple sites they are now full software’s.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;So let’s start learning JavaScript OOP.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h3&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Step 1&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Create a function with the desired class name&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; Employee() { }&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this will create employee class.Now it would have no use as it has no properties and methods. &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;Step 2&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Create employee properties&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; Employee(firstName, lastName, cellNumber, empAddress) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.fName = firstName;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.lName=lastName;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.cellNo = cellNumber;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.address = empAddress;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;}Now this is more like it, We have 4 members and we can use them now.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;Step 3&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Creating a new employee&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Var emp=new Employee(“Mamoon”,”ur Rasheed”,12345,”Confidential”);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Now if we will do &lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Alert(Emp.fName );&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;It will show the employee first name.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;Step 4&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Adding a property&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Even though there is no default way to create a property, we can take advantage of JavaScript function calling without and with parameters to create a property for our self.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Let’s add an property.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;color:blue;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;color:blue;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;color:blue;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;color:blue;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; Employee(firstName, lastName, cellNumber, empAddress) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.fName = firstName;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.lName=lastName;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;._empNo;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.cellNo = cellNumber;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.address = empAddress;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;As you would have already guessed, this._empNo is a property. But it is not complete yet. First let me introduce you to “prototype”. Basically when we use prototype with any function name (class) we add functions to it or we can use it to drive it from other functions(classes). It will prototype(copy) the behaviour(functions) associated with the function(class).&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Here is what we need to add a property&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Employee.prototype.empNo=&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;(employeeNumber) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; (employeeNumber == undefined)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;._empNo;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;._empNo = employeeNumber;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;This is simple, in this above code we are attaching a function to Employee class. This function will act as a property. First of all we need to check if passing parameter is undefined.If undefined, then it will act as a getter otherwise as a setter. This can be done in a different way e.g&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Employee.prototype.empNo = &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;(employeeNumber) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; (arguments.length==0)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;._empNo;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;._empNo = employeeNumber;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;In this example a check is made if any argument is passed to function. If no argument is passed then return the value if not then assign the value to the property.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;Step 5&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Functions:&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Same way as properties, function can be attached to the class.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Employee.prototype.DisplayEmployee = &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;() {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;alert(&lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;Name : &quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; + &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.lName + &lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;, &quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; + &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.fName +&lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;\nEmployee Number : &quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.empNo()+ &lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;\nCell Number : &quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; + &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.cellNo + &lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;\nAddress : &quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; + &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.address);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;Step 6&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Inheritence:&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;This is a two step process&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-top:0in;margin-right:0in; margin-bottom:0in;margin-left:.75in;margin-bottom:.0001pt;mso-add-space:auto; text-indent:-.25in;line-height:normal;mso-list:l0 level1 lfo1;mso-layout-grid-align: none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;1-&lt;/span&gt;&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;Inheriting functions&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-top:0in;margin-right:0in; margin-bottom:0in;margin-left:.75in;margin-bottom:.0001pt;mso-add-space:auto; text-indent:-.25in;line-height:normal;mso-list:l0 level1 lfo1;mso-layout-grid-align: none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;2-&lt;/span&gt;&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;Inheriting members&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Lets start with inheriting members&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;Step 6 (a)&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Lets create a class that will inherit the employee class.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; Manager() {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.salary;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;This is a small class that just have salary in it.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Now we need all the employee properties in this class. We have to create a helper function that will take the arguments and will initilize the base class and inherited class.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Manager.prototype.InitializeBase = &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;(baseType,salary, fName, lName, cellNo, address) {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;.salary = salary;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; (arguments.length &gt; 0)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;baseType.apply(&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;, [fName, lName, cellNo, address]);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;baseType.call(&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;This function does two things. If there are more than one argument than we will know that this function is called with parameters so we can just apply it to base type. &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;In this matter base type is employee and will be passed to this function when we will call this function.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;And if there are no arguments, then we will just call the base type and copy the empty members.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Now we have successfully inherited the members, its time for functions&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;Step 6 (b)&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Manager.prototype = &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; Employee();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;That’s it, it will copy all function to the inherited class. No need of doing any work. It will take care of this.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;Results:&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Lets put our code into evaluation to see the results&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;function&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; createEmployeeObject() {&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;var&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; emp = &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; Employee(&lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;Ahmed&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;Mushtaq&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;+92321xxxxxxx&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;International&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;); &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;emp.empNo(10);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;alert(emp.empNo());&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;emp.DisplayEmployee();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;var&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; mng = &lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; Manager();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;mng.InitializeBase(Employee, 1000,&lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;Mamoon&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;Rasheed&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;+923215059405&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color:#A31515;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&quot;Confidential&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;alert(mng.fName);&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;mng.DisplayEmployee();&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Now as you have seen, I have created an employee instance and then set its property of empNo to 10/ Next thing is, I am displaying the employee.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Now time for inherited member. New manager is created and by using its InitializeBase function, base class is initilized. Notice the parameters of InitializeBase function. First parameter is the Employee to use it as the baseType in function and call for apply or call method to initilize the base.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Now at the end you can see we can use DisplayEmployee function of employee class.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none&quot;&gt;&lt;span style=&quot;font-family:&amp;quot;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;God Bless OOP.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/2127712344765463392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2009/10/javascript-object-oriented-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/2127712344765463392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/2127712344765463392'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2009/10/javascript-object-oriented-programming.html' title='JavaScript Object Oriented Programming (prototype)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3426742870147240265.post-8247507540105974000</id><published>2009-10-05T14:28:00.000-07:00</published><updated>2011-01-14T03:04:04.331-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net AJAX"/><title type='text'>Asp.Net Ajax PageMethods</title><content type='html'>&lt;h1&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; font-weight: bold; font-size:24px;&quot;&gt;How Do I? use PageMethods in Asp.Net&lt;/span&gt;&lt;/div&gt;&lt;/h1&gt;&lt;br /&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;PageMethods are asp.net way of light weight &lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Programming-ASP-NET-AJAX-Build-2-0-style/dp/0596514247?ie=UTF8&amp;tag=asneho-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Ajax&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=asneho-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596514247&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt; communication. Update panels are known for rapid development and ease of use but they have worst performance and speed issues. AJAX is associated with performance and update panel is performance killer. It lacks speed and heavy on the wire.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Let’s face it; Update panel is designed to follow the normal asp.net page life cycle. This makes sure ease of use but not performance and speed.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;But there is a way of performance and speed in asp.net Ajax we just need to learn living without update panels and start doing some manual work.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;PageMethods are designed in such a way, we can easily start using them by following simple steps but there are also some things developers should know before using them.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h2&gt;PageMethods are static&lt;/h2&gt;that implies&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left:.75in;mso-add-space:auto; text-indent:-.25in;mso-list:l3 level1 lfo1&quot;&gt;&lt;span style=&quot;mso-bidi-mso-bidi-theme-font:minor-latin;font-family:Calibri;&quot;&gt;&lt;span style=&quot;mso-list:Ignore&quot;&gt;1-&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;They don’t follow asp.net life cycle&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left:.75in;mso-add-space: auto;text-indent:-.25in;mso-list:l3 level1 lfo1&quot;&gt;&lt;span style=&quot;mso-bidi-mso-bidi-theme-font:minor-latin;font-family:Calibri;&quot;&gt;&lt;span style=&quot;mso-list:Ignore&quot;&gt;2-&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;They can’t use global variables other than static variables&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left:1.25in;mso-add-space:auto; text-indent:-.25in;mso-list:l3 level2 lfo1&quot;&gt;&lt;/p&gt;&lt;div style=&quot;color:red; padding:5px 5px 5px 5px; border:solid thin black&quot;&gt;&lt;h3&gt;ALERT&lt;/h3&gt;Don’t use static variable, they are shared among all users and have the scope of application variables.&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h2&gt;Why PageMethods are static?&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin-left:.75in;mso-add-space:auto; text-indent:-.25in;mso-list:l0 level1 lfo2&quot;&gt;&lt;span style=&quot;mso-bidi-mso-bidi-theme-font:minor-latin;font-family:Calibri;&quot;&gt;&lt;span style=&quot;mso-list:Ignore&quot;&gt;1-&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;Static methods can be called without initializing the class they are in that’s why they don’t require to follow the asp.net page life cycle&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left:.75in;mso-add-space:auto; text-indent:-.25in;mso-list:l0 level1 lfo2&quot;&gt;&lt;span style=&quot;mso-bidi-mso-bidi-theme-font:minor-latin;font-family:Calibri;&quot;&gt;&lt;span style=&quot;mso-list:Ignore&quot;&gt;2-&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;To overcome the update panel and callback way of communication; both these methods sends all the viewstate in request and follows the normal page life cycle that starts from page load method not from the calling functions.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h2&gt;How to implement PageMethods&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Now you just require following step by step guide to start using page methods. In this tutorial, I will show you how you can wrote a simple PageMethod, use it efficiently in your code and in next tutorial, I will show you how you can send more complex data in page methods.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;So let’s begin this journey;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h3&gt;Step 1:&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Create a new project in either visual web developer or visual studio&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h3&gt;Step 2:&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Add the assembly to use with page method &lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCfWoVUAWcqv6J-pd67y3AFhnZuaq9DvsJ5DbzZdtinxKYt8UROpgh5TljTYaQk9yOF1UeC8jsO-CoJnixAPnXMEppCUlD4_Cj5mTi43QG_j9bpV7WNRADvYMWG48vHQCpWI2R6eLwpAc/s1600-h/assembly.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCfWoVUAWcqv6J-pd67y3AFhnZuaq9DvsJ5DbzZdtinxKYt8UROpgh5TljTYaQk9yOF1UeC8jsO-CoJnixAPnXMEppCUlD4_Cj5mTi43QG_j9bpV7WNRADvYMWG48vHQCpWI2R6eLwpAc/s320/assembly.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5389233615950469874&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 199px; &quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h3&gt;Step 3:&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;Write the method. This method as shown in the below image will take the first name as the argument and will greet the user if name present of throw and exception if null or empty. &lt;/span&gt;&lt;/p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; font-weight: normal; font-size:16px;&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheciajm3oOguB6m157PkQUZMM9hZBRo_ONpTULwN3GPIjTKXlLRAJ4tr9D_TOviTjDhHbu52eT5n0D4B87NyHojV90G7ziyajn7sMQUl6s1d1uD9FTBPSeJyPhP9glUqteA8xWNkc-1o8/s1600-h/method.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheciajm3oOguB6m157PkQUZMM9hZBRo_ONpTULwN3GPIjTKXlLRAJ4tr9D_TOviTjDhHbu52eT5n0D4B87NyHojV90G7ziyajn7sMQUl6s1d1uD9FTBPSeJyPhP9glUqteA8xWNkc-1o8/s320/method.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5389234030467682098&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 230px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h3&gt;Step 4:&lt;p&gt;&lt;/p&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Add script manager with EnablePageMethods=”true”&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-Zv0bxyuM-uo6wQtvcPn0df5ypFR60E4GRLP2h_GnvJdLdP6wx8zjqysPo4C_HBuMI0_fF-ur62iyJifyxYDnminGplWFTu3QH8hsjG7uBMJlAFZcj5BZ1bGOgFEYeYLcrfa2empNGbI/s1600-h/scriptmanager.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-Zv0bxyuM-uo6wQtvcPn0df5ypFR60E4GRLP2h_GnvJdLdP6wx8zjqysPo4C_HBuMI0_fF-ur62iyJifyxYDnminGplWFTu3QH8hsjG7uBMJlAFZcj5BZ1bGOgFEYeYLcrfa2empNGbI/s320/scriptmanager.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5389234248222500146&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 114px; &quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h3&gt;Step 5:&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Add html text box and button to take user input of first name and then call server with this value&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-GtwLiPBRmCzViGt_KDEZbXQdnSzqMGxei6uWO0VB-t53nUpM-KTmJD2FvCu62pyckfNEPfzKsG-WdcKIg8bBNXQMFlx-7SMYIkjUv2limJTvxM-mzV5Gp0XzbQSSDFmTBCiScRHDNfQ/s1600-h/form.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-GtwLiPBRmCzViGt_KDEZbXQdnSzqMGxei6uWO0VB-t53nUpM-KTmJD2FvCu62pyckfNEPfzKsG-WdcKIg8bBNXQMFlx-7SMYIkjUv2limJTvxM-mzV5Gp0XzbQSSDFmTBCiScRHDNfQ/s320/form.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5389234390402065602&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 121px; &quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h3&gt;Step 6:&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Write java script to call the page methods.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdtd67oyknFyIrGPDF9WxboXY-cXCz3TDydA34TXxgtKZZahvJ0eYE7sBoWyVtI9WuvOn3FPPh5w_XHJHYI7YA-cos5D3MwxEJYo3nFGsfy1_XGPxVa38aVpCOVgf9zA7CIYYRC1ntc9E/s1600-h/javascript.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdtd67oyknFyIrGPDF9WxboXY-cXCz3TDydA34TXxgtKZZahvJ0eYE7sBoWyVtI9WuvOn3FPPh5w_XHJHYI7YA-cos5D3MwxEJYo3nFGsfy1_XGPxVa38aVpCOVgf9zA7CIYYRC1ntc9E/s320/javascript.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5389234536244945746&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 121px; &quot; /&gt;&lt;/a&gt;&lt;p class=&quot;MsoNormal&quot;&gt;As you can see in this picture, I have a method callPageMethods and this method takes the value from text box and call server with this. Calling PageMethods requires 3 parameters&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;text-indent:-.25in;mso-list:l2 level1 lfo3&quot;&gt;&lt;span style=&quot;mso-bidi-mso-bidi-theme-font:minor-latin;font-family:Calibri;&quot;&gt;&lt;span style=&quot;mso-list:Ignore&quot;&gt;1-&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;Argument that will be passed to PageMethods on the server&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;text-indent:-.25in;mso-list:l2 level1 lfo3&quot;&gt;&lt;span style=&quot;mso-bidi-mso-bidi-theme-font:minor-latin;font-family:Calibri;&quot;&gt;&lt;span style=&quot;mso-list:Ignore&quot;&gt;2-&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;A function name that will receive the result when this call will executed successfully&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;text-indent:-.25in;mso-list:l2 level1 lfo3&quot;&gt;&lt;span style=&quot;mso-bidi-mso-bidi-theme-font:minor-latin;font-family:Calibri;&quot;&gt;&lt;span style=&quot;mso-list:Ignore&quot;&gt;3-&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;A function name that will receive the error in case of unexpected happen or you program your exceptions to throw, in this example I have thrown the exception if I used didn’t input his/her name in text box.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;h2&gt;Results:&lt;/h2&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKIF62lCvzz_fC44ZgG_DQcdDqxpubj5lb1fYvykkXBUTPOok8HwQXmb0ICMv6uOLYZdRmT8j6UepiUnfAM3Zzn1YfMcdzKlZOedvEfEC8OjVf0rEG2qnZ_PvqCbycosr2tPVN928qlgI/s1600-h/argumentnull.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKIF62lCvzz_fC44ZgG_DQcdDqxpubj5lb1fYvykkXBUTPOok8HwQXmb0ICMv6uOLYZdRmT8j6UepiUnfAM3Zzn1YfMcdzKlZOedvEfEC8OjVf0rEG2qnZ_PvqCbycosr2tPVN928qlgI/s320/argumentnull.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5389234754935125330&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 147px; &quot; /&gt;&lt;/a&gt;&lt;div&gt;As you can see, first time I did enter my first name and it throws the exception and javascript function onFail cached this error and alert the error.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3nBqvJ1Bx1NF98HlfxqptylwN58jyaY3gE8uharIfT76_eHZufIysABzB-quImw1FQajahlbVWuQ-GSE7S6w2t7w0ougM-h2shH-JC5IvmgtSW_QqwW4nVfk3PuRSinTNtxbNS6FElso/s1600-h/hellomamoon.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3nBqvJ1Bx1NF98HlfxqptylwN58jyaY3gE8uharIfT76_eHZufIysABzB-quImw1FQajahlbVWuQ-GSE7S6w2t7w0ougM-h2shH-JC5IvmgtSW_QqwW4nVfk3PuRSinTNtxbNS6FElso/s320/hellomamoon.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5389234903270342962&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 204px; &quot; /&gt;&lt;/a&gt;&lt;div&gt;In this picture you can see the successfully hello world method is executed and I have received the message in alert box.&lt;/div&gt;&lt;p class=&quot;MsoNormal&quot;&gt;I have these screen shots of firebug to show you how much data is transferred.&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;text-indent:-.25in;mso-list:l1 level1 lfo4&quot;&gt;&lt;span style=&quot;mso-bidi-mso-bidi-theme-font:minor-latin;font-family:Calibri;&quot;&gt;&lt;span style=&quot;mso-list:Ignore&quot;&gt;1-&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;Post&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;text-indent:-.25in;mso-list:l1 level1 lfo4&quot;&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;text-indent:-.25in;mso-list:l1 level1 lfo4&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikKt_61YTd94-cICAOMlO1DmmXpggiCl5znjXuvCGB4uD9_zduVFe4B3VUwjmNiTf66U3nHXTpC2-GttRedhEqQdky5MNbrQKm-1JaCvX3FOoEG_8NAYKYn3Bx2PbprMRGle4H8eLpQPs/s1600-h/post.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikKt_61YTd94-cICAOMlO1DmmXpggiCl5znjXuvCGB4uD9_zduVFe4B3VUwjmNiTf66U3nHXTpC2-GttRedhEqQdky5MNbrQKm-1JaCvX3FOoEG_8NAYKYn3Bx2PbprMRGle4H8eLpQPs/s320/post.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5389235060549843874&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 89px; &quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;Only few Bytes&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;This picture also highlited the error as shown in firebug. This is not an error. This was the exception thrown by the server when i didnt enter the first name and hit the submit button. This is a handled exception and handled exceptions are GOOD ONES.&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;text-indent:-.25in;mso-list:l1 level1 lfo4&quot;&gt;&lt;span style=&quot;mso-bidi-mso-bidi-theme-font:minor-latin;font-family:Calibri;&quot;&gt;&lt;span style=&quot;mso-list:Ignore&quot;&gt;2-&lt;span style=&quot;font:7.0pt &amp;quot;Times New Roman&amp;quot;&quot;&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span dir=&quot;LTR&quot;&gt;&lt;/span&gt;Response&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;text-indent:-.25in;mso-list:l1 level1 lfo4&quot;&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;text-indent:-.25in;mso-list:l1 level1 lfo4&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6Lp_rAgNxrCI7-j3AhVGbgI1i58RUx6lJhyphenhyphenaKSc7BKMd3Nx89_AmVYamHWlG-hT2Upst3vGbQ6H8wMI8Oecc2FUl0ajw_3TDWG4d4akIi_V34sbAaJP-VkwcCOYOIXpGUvAWlllKMx8M/s1600-h/response.JPG&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6Lp_rAgNxrCI7-j3AhVGbgI1i58RUx6lJhyphenhyphenaKSc7BKMd3Nx89_AmVYamHWlG-hT2Upst3vGbQ6H8wMI8Oecc2FUl0ajw_3TDWG4d4akIi_V34sbAaJP-VkwcCOYOIXpGUvAWlllKMx8M/s320/response.JPG&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5389235209968301314&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 84px; &quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left:.5in&quot;&gt;Only few Bytes as well&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;That’s the benefit of PageMethods we are not sending receiving too much data as in case of update panel or call back when whole viewstate along with other fields post to server and user has to wait for longer time as request will go through whole asp.net page life cycle and then results will be sent back to client.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;In next tutorial, I will show you how you can send more complex data using PageMethods and I will discuss the JSON as the whole communication of PageMethods is done through JSON format.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspilham.blogspot.com/feeds/8247507540105974000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspilham.blogspot.com/2009/10/page-methods-pagemethods-are-asp.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8247507540105974000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3426742870147240265/posts/default/8247507540105974000'/><link rel='alternate' type='text/html' href='http://aspilham.blogspot.com/2009/10/page-methods-pagemethods-are-asp.html' title='Asp.Net Ajax PageMethods'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/15206687393190726107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCfWoVUAWcqv6J-pd67y3AFhnZuaq9DvsJ5DbzZdtinxKYt8UROpgh5TljTYaQk9yOF1UeC8jsO-CoJnixAPnXMEppCUlD4_Cj5mTi43QG_j9bpV7WNRADvYMWG48vHQCpWI2R6eLwpAc/s72-c/assembly.JPG" height="72" width="72"/><thr:total>7</thr:total></entry></feed>