<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Chandu On the DOT NET</title><link>http://expertchandu.blogspot.com/</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/blogspot/XulJ" /><description>This is the blog for developers using .NET Framework.</description><language>en</language><managingEditor>noreply@blogger.com (Chandra Sekhar)</managingEditor><lastBuildDate>Sat, 30 Jul 2011 08:06:06 PDT</lastBuildDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">12</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">25</openSearch:itemsPerPage><feedburner:info uri="blogspot/xulj" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><itunes:explicit>no</itunes:explicit><itunes:subtitle>This is the blog for developers using .NET Framework.</itunes:subtitle><item><title>ASP.NET Interview Questions</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/K_DnQnDwRBQ/aspnet-interview-questions.html</link><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Sat, 24 Apr 2010 05:07:11 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-4955269089755230184</guid><description>&lt;span xmlns=""&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;Few days back I was asked by my employer to prepare some interview questions on asp.net and sqlserver for the purpose of written test.  I am providing few of the interview questions with answers for the same.  Let me know your ideas on the topic.&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;&lt;span xmlns=""&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;What is the interface we need to implement in order to create a HTTP Handler&lt;/div&gt;&lt;ol&gt;&lt;li&gt;IMyHandler&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;IHttpHandler&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;IHttpHandlerFactory&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;None of the above&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;What is the fastest way to retrieve data from the database&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Use DataTable&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Use DataAdapter&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Use Dataset&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Use DataReader&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/span&gt;&lt;/ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span style="text-decoration: underline;"&gt;Reason:&lt;/span&gt;Because DataAdapter internally makes use of DataReader class.&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;What is the correct answer among the following regarding the ViewState&lt;/div&gt;&lt;ol&gt;&lt;li&gt;It is used to Create the visibility on the Web pages&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;It is used to Maintain the State of the User as long as he surf the website&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;It is used to maintain the state between the subsequent requests within a page&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;It is used to increase the performance of the web application&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;When does the Session_Start event in the Global.asax fire,&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;When a new user starts using the application&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;When the user logs into the server using the Login.aspx page&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;When a user requests a secured page&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;When first user sends a request&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;There is a Master page called MyApplication.master and a content page called MyContentPage.aspx.  When we run the application which of the following events will take place first&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Page load event in the MyApplication.master&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Page load event in the MyContentPage.aspx&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;PreInit event in the MyApplication.master&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;PreInit event in the MyContentPage.aspx&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span style="text-decoration: underline;"&gt;Reason&lt;/span&gt;:Because you have the capability to change the master page at run time in the PreInit event of the content page.&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span style="color: black;"&gt;You need to execute code conditionally, depending on whether the page is generated in response to a server control event on the same page.  How would you check this programmatically?&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="color: black;"&gt;Page.HasControls&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: black;"&gt;Page.IsCrossPagePostBack&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: black;"&gt;&lt;b&gt;Page.IsPostBack&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color: black;"&gt;Page.IsCallback&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;In which folder you can place the SqlServer Express Edition&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;App_Data&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;App_Code&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;App_Themes&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;App_LocalResources&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;App_Data folder is used to store the .mdf files in asp.net (Introduced in 2.0).&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;App_Code folder is used to store the class files in asp.net (Introduced in 2.0).&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;App_Themes is used to store the skins, themes etc (Introduced in 2.0).&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;App_LocalResources is used to store the resource information in asp.net.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;There is a class called as MyClass in C#.  When initializing the class in Using block as,&lt;/div&gt;&lt;div style="margin-left: 36pt;"&gt;MyClass obj = new MyClass();&lt;/div&gt;&lt;div style="margin-left: 36pt;"&gt;using(obj)&lt;/div&gt;&lt;div style="margin-left: 36pt;"&gt;{&lt;/div&gt;&lt;div style="margin-left: 36pt;"&gt;//Some Code to follow..&lt;/div&gt;&lt;div style="margin-left: 18pt;"&gt;}&lt;/div&gt;&lt;/li&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The above application resulted in error.  What could be the reason,&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol style="margin-left: 90pt;"&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;
&lt;li&gt;We cannot use "using" block for the Custom classes&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;MyClass must implement IDisposable interface&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;The obj must be declared in try, catch block&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;using  block cannot be used in ASP.NET, that is only related to C#&lt;br /&gt;
&lt;/li&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span style="text-decoration: underline;"&gt;Reason:&lt;/span&gt;The using block will call the dispose method automatically when the scope of the using block is ended.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;If one has two different web form controls in application and if one wanted to&lt;br /&gt;
know whether the values in the above two different web form control match what&lt;br /&gt;
control must be used.&lt;/div&gt;&lt;ol&gt;&lt;li&gt;DataGrid Control&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;CompareValidator&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;TextBox Validator&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;ListView Control&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Which of the following denote ways to manage state in an ASP.Net Application?&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Session Objects&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Application Objects&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;View State&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;All of the above&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;In ASP.NET the &amp;lt; authorization &amp;gt; section contain which of the following&lt;br /&gt;
elements&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&amp;lt;deny&amp;gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&amp;lt;allow&amp;gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Both A and B&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;None of the above&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;What is the easiest way to handle all the exceptions in a web application&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Use try.. catch block for all the methods&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Use Error handler at the page level in each page&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Use Application level Error handler at Global.asax&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Create a section in web.config file that can handle all the errors&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;What is AJAX?&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;It is a technology that enables browsers to render information faster than normal way&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;It is a technology which enables javascript to do high graphics on the web pages&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;It is a latest version of the Web Services&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;None of the above&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;What are the datasource controls available in ASP.NET&lt;/div&gt;&lt;ol&gt;&lt;li&gt;SqlDataSource&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;ObjectDataSource&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;XmlDataSource&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;b&gt;All of the Above&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;How do you Cache a DataTable&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;By using Cache object&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;By saving the DataTable to xml file and keeping in memory&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Writing the Page Output Cache attribute on the page control&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Creating a user control for a DataTable&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Trace and debug classes belong to which Namespace&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;System.Diagnostics&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;System.Reflection&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;System.Data&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;None of the above&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;Column mappings belongs to which namespace&lt;/div&gt;&lt;ol&gt;&lt;li&gt;System.Data&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;System.Data.Common&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;System.Xml&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;System.Data.Relations&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;span xmlns=""&gt;&amp;nbsp;I will post the remaining ASP.NET Interview questions and Sql Server Interview Question to the blog as soon as possible.&lt;/span&gt; &lt;/li&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/ol&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;span xmlns=""&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-4955269089755230184?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/K_DnQnDwRBQ" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-24T17:37:11.319+05:30</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">5</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2010/04/aspnet-interview-questions.html</feedburner:origLink></item><item><title>Memory usage details of the Browsers in Google Chrome</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/3SC-mNCTTx8/memory-usage-details-of-browsers-in.html</link><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Wed, 21 Apr 2010 21:09:36 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-8188961020021077943</guid><description>Google Chrome is a browser released from Google.  The browser contains an interesting feature that shows the memory statics of all the opened browsers.  The memory details will be shown on the basis of Private and Shared Memory used by a particular browser. In addition to this, it also shows the details of Chrome's individual tab details.  To check this we can make use of the following steps,&lt;br /&gt; &lt;br /&gt;1. Open Google Chrome&lt;br /&gt;2. In the address bar type about:memory where we usually type the url.&lt;br /&gt; &lt;br /&gt;The same procedure will also works for Mozilla Firefox.  The firefox shows the details of firefox browser.  In observations on the three browsers namely Internet Explorer 7, Firefox 3.6 and Google Chrome I found that Internet Explorer 7 is the one which uses the less memory and Firefox is the browser which utilizes the more memory.&lt;br /&gt; &lt;br /&gt;Chrome is a freeware browser available for download &lt;a href='http://www.google.com/chrome'&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-8188961020021077943?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/3SC-mNCTTx8" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-22T09:39:36.844+05:30</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2010/04/memory-usage-details-of-browsers-in.html</feedburner:origLink></item><item><title>Beginning the jQuery - Get the Element by it's ID</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/bvIqNLyEXdQ/beginning-jquery-get-element-by-its-id.html</link><category>java script</category><category>Beginning jQuery</category><category>Introduction</category><category>jQuery</category><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Thu, 14 Jan 2010 07:02:00 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-1448154829517584708</guid><description>&lt;span style="font-weight:bold;"&gt;What is meant by jQuery?&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;Well.. to be simple, jQuery is nothing but javascript library.  As we people know SQL is a Structured Query Language for retrieving and manipulating data stored in database, and XQuery for XML.  In the same way jQuery is a javascript library to retrieve and manipulate the HTML in a very easy and friendly manner.
&lt;br /&gt;
&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;What we need to work with jQuery?&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;All we need to work with jQuery is the jQuery library, which is available at &lt;a href="http://jquery.com/"&gt;http://jquery.com/&lt;/a&gt; and &lt;a href="http://www.google.com/support/blogger/bin/answer.py?hl=en&amp;answer=42051"&gt;http://www.google.com/support/blogger/bin/answer.py?hl=en&amp;answer=42051&lt;/a&gt;.  At the time of this writing the jQuery's version is 1.3.2.  This is a library with around 55.9 kb, which is perfectly acceptable for the work it will offer.
&lt;br /&gt;
&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Let's begin with..&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;As my intention is to make every one free to work with jQuery.  So, in this blog entry I am not going to explain all the complex details included with in.  I will provide a very simple example that is very much useful for all the beginners.
&lt;br /&gt;
&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Find Element By ID..&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;The biggest trouble that most of the developers feel at any time is getting the reference to the control in javascript by using document.getElementById() method or something similar.  However, this method won't work perfectly many times.  The reason is simple, it fails due to incompatibility with the browsers, Inner controls(the control may be present inside some other control such as div etc) etc.  
&lt;br /&gt;
&lt;br /&gt;To overcome such kind of issues jQuery addresses a very simple way to get the reference of the required control.  In this simple demonstration I will provide a user to enter some value to a text box( input type="text").  And on a button click the text goes to the span tag.  This sounds very simple, but this will be really great feature when it comes to large complex page.
&lt;br /&gt;
&lt;br /&gt;Here is the HTML code for this example,
&lt;br /&gt;
&lt;br /&gt;&amp;lt;div&gt;
&lt;br /&gt;        Name:
&lt;br /&gt;        &amp;lt;input type="text" id="getName" /&gt;
&lt;br /&gt;        &amp;lt;button id="clickMe"&gt;
&lt;br /&gt;            Display My Name in Span&lt;/button&gt;
&lt;br /&gt;        &amp;lt;br /&gt;
&lt;br /&gt;    &amp;lt;/div&gt;
&lt;br /&gt;    &amp;lt;span id="mySpan"&gt;This is the text appeared in span tags&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;And the jQuery code is very simple as around 3-5 lines to accomplish this task,
&lt;br /&gt;
&lt;br /&gt;&amp;lt;script language="javascript" type="text/javascript"&gt;
&lt;br /&gt;    $(document).ready(function(){
&lt;br /&gt;        $("#clickMe").click(function(){
&lt;br /&gt;            $("#mySpan").text($("#getName").val());
&lt;br /&gt;        });
&lt;br /&gt;    });
&lt;br /&gt;&amp;lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;For the moment you forgot about the first lines such as $(document).ready(function()..)}; etc, because I don't want to make you scare by explaining all the complicated details with in this.  Think this as a standard for all your future jquery coding.  
&lt;br /&gt;
&lt;br /&gt;So at the moment, let us concentrate how to retrieve the value of getName text box.  This is very simple as,
&lt;br /&gt;$("#getName").val();
&lt;br /&gt;
&lt;br /&gt;Yes, this is where we are passing the id of any control with the prefix of #.  
&lt;br /&gt;The val() is a function provided by jQuery to get the value in that particular control.  This works for all the HTML controls that supports value attribute.
&lt;br /&gt;Remember all the jQuery coding should be enclosed with in the brackets as $(..).  However we can replace with any other symbols which is out of discussion in the entry.  And now we got the reference to the control span by passing it's id as,
&lt;br /&gt;
&lt;br /&gt;$("#mySpan").val() and for button as $("#clickMe") etc..
&lt;br /&gt;
&lt;br /&gt;and the function click() is the event handler for the button.
&lt;br /&gt;
&lt;br /&gt;You can download the source code for this simple solution &lt;a href="http://cid-29f7a0444fe68791.skydrive.live.com/self.aspx/.Public/jQueryGetElementByID.zip?lc=16393"&gt;here&lt;/a&gt;.  In the future version of this blog, I am going to explain all the jQuery features one by one and later we can move to the most advanced features of the jQuery such as working with jQuery Plugins.  If you frequently follow this blog you are going to be create your own jQuery plugin on one day.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-1448154829517584708?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/bvIqNLyEXdQ" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-14T20:32:00.536+05:30</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2010/01/beginning-jquery-get-element-by-its-id.html</feedburner:origLink></item><item><title>Strategy Pattern</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/5JHjQt7Gq9k/strategy-pattern.html</link><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Sat, 11 Jul 2009 03:33:22 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-5831898969828800517</guid><description>&lt;h4&gt;Definition: &lt;/h4&gt;  &lt;h4&gt;The Gang of Four defines the Strategy in the following way,    &lt;br /&gt;&amp;quot;Define a family of algorithms, encapsulate each one,     &lt;br /&gt;and make them interchangeable.     &lt;br /&gt;Strategy lets the algorithm vary independently from clients that use it. &amp;quot; &lt;/h4&gt;  &lt;p&gt;Many developers who are new to design patterns will definitely get confused with this definition. Well, I will provide a simple explanation for this definition with an example. &lt;/p&gt;  &lt;h4&gt;Scenario &lt;/h4&gt;  &lt;p&gt;Let us assume a simple scenario that we have different classes for different kind of employees, Say, SoftwareEmployee, SalesEmployee and AccountingEmployee.&amp;#160; Now, all these classes needs have to implement SalaryRange which is a common method for all.&amp;#160; However, different employee type may have different salary schemes.&amp;#160; So implementing the SalaryRange is especially independent to the particular Employee type. &lt;/p&gt;  &lt;h4&gt;Solution&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_J2ewrGCKoAo/SlcOsmNJ6YI/AAAAAAAABIA/OfJ90XDLAio/s1600-h/OverviewofStrategy3.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Overview of Strategy" border="0" alt="Overview of Strategy" src="http://lh4.ggpht.com/_J2ewrGCKoAo/SlcOuRZXRzI/AAAAAAAABIE/Uf5Jb98GXew/OverviewofStrategy_thumb1.jpg?imgmax=800" width="579" height="445" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;In order to define the SalaryRange method in all the classes(SoftwareEmployee, SalesEmployee and AccountingEmployee), we define a interface with a method called SalaryRange which returns only string as follows(I made a simple implementation for demonstration purpose), &lt;/p&gt;  &lt;p&gt;public interface IEmployee&amp;#160; &lt;br /&gt;{&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; string SalaryRange();&amp;#160; &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;Now, let us implement this interface for all the employee types as follow, &lt;/p&gt;  &lt;p&gt;public class SalesEmployee : IEmployee    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; string IEmployee.SalaryRange()     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return &amp;quot;Depends on the target achieved&amp;quot;;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //Some other members related to Sales person such as Area of Marketing,&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;//Product information, Sales Target&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public class AccountingEmployee : IEmployee    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; string IEmployee.SalaryRange()     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return &amp;quot;2000 - 8000&amp;quot;;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //Some other members related to Accountants such as Method of Accounting &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //(manual or automated) etc.&amp;#160; &lt;br /&gt;&amp;#160; } &lt;/p&gt;  &lt;p&gt;Now each method(SalaryRange) is independent of it's own class.&amp;#160; So it has encapsulated its behavior with in the particular class that it belongs to. &lt;/p&gt;  &lt;p&gt;The next goal is to create a concrete class that can communicate with all the Employee Types. Let us assume we have the class named as, SalaryRange with a method in the called SalaryRange as follows, &lt;/p&gt;  &lt;p&gt;All we need to have in the SalaryRange class is to define a variable of type IEmployee. &lt;/p&gt;  &lt;p&gt;IEmployee empType;    &lt;br /&gt;public SalaryRange()     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //No implementation or provide default EmpType as     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; this.EmpType = new SoftwareEmployee();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public SalaryRange(IEmployee empType)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; this.EmpType = empType;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; public IEmployee EmpType    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; set     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; empType = value;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; get     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return empType;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;1. In this simple code we have a default constructor which will be called when the client wont send any type.     &lt;br /&gt;2. An Overloaded constructor which takes a single parameter of the type IEmployee.     &lt;br /&gt;3. Finally we define a Property to pass the value for IEmployee type. &lt;/p&gt;  &lt;p&gt;The way we call the original method will be from the method getSalaryRange() defined in the SalaryRange class. &lt;/p&gt;  &lt;p&gt;public string getSalaryRange()    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (empType != null)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return empType.SalaryRange();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; else     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return &amp;quot;Employee type not specified..&amp;quot;;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;This is a simple method which delegates it's call to the particular employee type dynamically. &lt;/p&gt;  &lt;p&gt;We have now defined a Strategy which is an Interface called as IEmployee,    &lt;br /&gt;the ConcreteStrategy which are the classes SoftwareEmployee, SalesEmployee and AccountingEmployee. &lt;/p&gt;  &lt;p&gt;Now we are going to write a asp.net page which acts as a client. In order to call get the    &lt;br /&gt;employee salary range of a particular employee we just need to define an object for the SalaryRange type. &lt;/p&gt;  &lt;p&gt;This is the code in the Page Load event of our aspx page, &lt;/p&gt;  &lt;p&gt;protected void Page_Load(object sender, EventArgs e)    &lt;br /&gt;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SalaryRange softwareSalary = new SalaryRange();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Response.Write(&amp;quot;Software Engineer's Salary Varies &amp;quot; + softwareSalary.getSalaryRange()); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SalaryRange accountantSalary = new SalaryRange();    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; accountantSalary.EmpType = new AccountingEmployee();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Response.Write(&amp;quot;&amp;lt;hr/&amp;gt;Accountant's Salary Varies &amp;quot; + accountantSalary.getSalaryRange()); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SalaryRange salesSalary = new SalaryRange(new SalesEmployee());    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Response.Write(&amp;quot;&amp;lt;hr/&amp;gt;Sales Person's Salary Varies &amp;quot; + salesSalary.getSalaryRange()); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Response.Write(&amp;quot;&amp;lt;hr/&amp;gt;&amp;quot;);    &lt;br /&gt;&amp;#160;&amp;#160; }&lt;/p&gt;  &lt;p&gt;For the softwareSalary we are calling the default constructor where our default constructor will takes SoftwareEmployee type as its default. &lt;/p&gt;  &lt;p&gt;AccountantSalary is implemented by using the Property.    &lt;br /&gt;SalesSalary is implemented by using the parameterized constructor. &lt;/p&gt;  &lt;p&gt;In the Response.Write method we are just calling the getSalaryRange() method.&amp;#160; So here our client can call the SalaryRange class's getSalaryRange method as it likes.&lt;/p&gt;  &lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://expertchandu.blogspot.com/2009/07/strategy-pattern.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://expertchandu.blogspot.com/2009/07/strategy-pattern.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-5831898969828800517?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/5JHjQt7Gq9k" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-11T16:03:22.999+05:30</app:edited><media:thumbnail url="http://lh4.ggpht.com/_J2ewrGCKoAo/SlcOuRZXRzI/AAAAAAAABIE/Uf5Jb98GXew/s72-c/OverviewofStrategy_thumb1.jpg?imgmax=800" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2009/07/strategy-pattern.html</feedburner:origLink></item><item><title>Communicate Among the Databases</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/UZOi6ZtuCUA/communicate-among-databases.html</link><category>Sql Server</category><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Wed, 08 Jul 2009 05:01:12 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-143808629717816466</guid><description>&lt;p&gt;In certain cases we occasionally need to communicate between the tables that are in different databases.&amp;#160; In this post I am going to explain how to communicate between the tables that are in different databases and in different servers, with a simple example. Let us consider the below database schema,&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://lh4.ggpht.com/_J2ewrGCKoAo/SlSDipYNFDI/AAAAAAAABHw/FjuRgFAv9xc/s1600-h/DBSchema%5B18%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="DBSchema" border="0" alt="DBSchema" src="http://lh5.ggpht.com/_J2ewrGCKoAo/SlSDjyzlADI/AAAAAAAABH0/gNBvlmFJ_dM/DBSchema_thumb%5B16%5D.jpg?imgmax=800" width="391" height="319" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We have two databases say OurPerson and TheirPerson each database having the table Person(may be different in real time scenarios).&lt;/p&gt;  &lt;p&gt;To be simple, let us try to get the names of all the persons from OurPerson database whose ID’s exist in TheirPersons’s Person table.&amp;#160; Here is the simple query to do that.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Query 1:&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;SELECT P1.Name AS Name FROM&amp;#160; OurPerson.dbo.Person P1 WHERE P1.ID IN(SELECT ID FROM TheirPerson.dbo.Person);&lt;/p&gt;  &lt;p&gt;So, in order to get access the tables of the other databases we can just use the complete table information as this,&lt;/p&gt;  &lt;p&gt;DatabaseName.User.TableName &lt;/p&gt;  &lt;p&gt;and similarly for the columns we use like this&lt;/p&gt;  &lt;p&gt;DatabaseName.User.TableName.Column&lt;/p&gt;  &lt;h4&gt;Accessing the Database From Different Server&lt;/h4&gt;  &lt;p&gt;The above procedure is fine as long as you have all the databases existing on the same server.&amp;#160; Then what about if the databases are in different servers.&amp;#160; Let us suppose that OurPerson is in Server1 and TheirPerson is in Server2.&lt;/p&gt;  &lt;p&gt;Now does the same query as we wrote above will work fine?&amp;#160; Suppose we logged in to Server1 and try to execute with this query,&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Query 2:&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;SELECT P1.Name AS Name FROM&amp;#160; Server1.OurPerson.dbo.Person P1 WHERE P1.ID IN(SELECT ID FROM Server2.TheirPerson.dbo.Person);&lt;/p&gt;  &lt;p&gt;The query above is exactly valid query.&amp;#160; But there is no way for the Server1 to pass it’s credentials to Server2, which causes the query to fail.&amp;#160; This is the situation where Linked Server concept come into the picture.&amp;#160; Let us see how to create a Linked Server from Server1 to link Server2.&lt;/p&gt;  &lt;h4&gt;Creating a Linked Server&lt;/h4&gt;  &lt;p&gt;You can create the Linked Server from Sql Server with the help of server explorer through the Server Objects as shown in the below figure.&amp;#160; &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://lh3.ggpht.com/_J2ewrGCKoAo/SlSDkqnMmuI/AAAAAAAABH4/1hwU2JQ9UzU/s1600-h/image%5B21%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_J2ewrGCKoAo/SlSDly5OZhI/AAAAAAAABH8/85ioeXdsCvA/image_thumb%5B24%5D.png?imgmax=800" width="307" height="207" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Right click on the Server Objects and select the New-&amp;gt;Linked Server from the context menu which will open a configuration window. In the general tab you can configure your server details, such as the database name, database provider etc. details.&amp;#160; You should provide the security details in the Security tab, which allows you to enter either trusted or untrusted authentication to connect to your linked server.&amp;#160; After everything is configured just click on OK.&amp;#160; That’s it.&amp;#160; Your linked server is now configured with your server.&amp;#160; Now, you can access the Server2’s databases and its tables from the Server1 as in the Query 2 as,&lt;/p&gt;  &lt;p&gt;ServerName.DatabaseName.TableName.ColumnName……… &lt;/p&gt;  &lt;p&gt;Now, you can do all the insertions, updates and queries etc for Server2 from Server1 itself.&amp;#160; One limitation is that you cannot try to update or insert the columns which are of type XML. Hope Microsoft may support this feature in it’s future releases of Sql Server.&amp;#160; For more information on linked servers please visit &lt;a href="http://msdn.microsoft.com/en-us/library/aa213778(SQL.80).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/aa213778(SQL.80).aspx&lt;/a&gt;. This documentation will provide information about how to configure and drop the linked servers using the system defined stored procedures.&lt;/p&gt;  &lt;p&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://expertchandu.blogspot.com/2009/07/communicate-among-databases.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://expertchandu.blogspot.com/2009/07/communicate-among-databases.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-143808629717816466?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/UZOi6ZtuCUA" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-08T17:31:12.422+05:30</app:edited><media:thumbnail url="http://lh5.ggpht.com/_J2ewrGCKoAo/SlSDjyzlADI/AAAAAAAABH0/gNBvlmFJ_dM/s72-c/DBSchema_thumb%5B16%5D.jpg?imgmax=800" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2009/07/communicate-among-databases.html</feedburner:origLink></item><item><title>Let us Inspire.</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/fe4CZnm-NFQ/let-us-inspire.html</link><category>Video</category><category>Motivation</category><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Fri, 03 Jul 2009 02:48:37 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-7207907569027282528</guid><description>&lt;br /&gt;  &lt;br /&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:0ab25983-ef56-4693-9aa9-93de55945119" class="wlWriterEditableSmartContent"&gt;&lt;div id="ae6c8cba-0b03-4a0f-b2fe-5585115004f5" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=bx796zSg5gs&amp;amp;hl=en&amp;amp;fs=1&amp;amp;color1=0xcc2550&amp;amp;color2=0xe87a9f" target="_new"&gt;&lt;img src="http://lh5.ggpht.com/_J2ewrGCKoAo/Sk3TydlmYxI/AAAAAAAAA0w/WpIstuZtEGs/video696e824043c9%5B5%5D.jpg?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('ae6c8cba-0b03-4a0f-b2fe-5585115004f5'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;478\&amp;quot; height=\&amp;quot;400\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/bx796zSg5gs&amp;amp;hl=en&amp;amp;fs=1&amp;amp;color1=0xcc2550&amp;amp;color2=0xe87a9f&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/bx796zSg5gs&amp;amp;hl=en&amp;amp;fs=1&amp;amp;color1=0xcc2550&amp;amp;color2=0xe87a9f&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;478\&amp;quot; height=\&amp;quot;400\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;Watch the patience of Zebra.&amp;#160; The zebra never lost her confidence.&amp;#160; Watch your self instead of telling..&lt;/p&gt; Quote of the Day:  &lt;br /&gt;WARNING: &lt;em&gt;Repeated brain usage may be harmful to others&lt;/em&gt;.  &lt;br /&gt;--rdude  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-7207907569027282528?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/fe4CZnm-NFQ" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-03T15:18:37.397+05:30</app:edited><media:thumbnail url="http://lh5.ggpht.com/_J2ewrGCKoAo/Sk3TydlmYxI/AAAAAAAAA0w/WpIstuZtEGs/s72-c/video696e824043c9%5B5%5D.jpg?imgmax=800" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2009/07/let-us-inspire.html</feedburner:origLink></item><item><title>Add a check constraint for your date in Sql Server</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/-I6SABIVBpk/add-check-constraint-for-your-date-in.html</link><category>Sql Server</category><category>Tip</category><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Tue, 30 Jun 2009 23:47:59 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-685852819282964846</guid><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Generally most of the people will have the requirement to add the dates to the database.&amp;#160; Most of the cases they will have two related dates, as FromDate and ToDate or Begin and End.&amp;#160; However most of the people wont add any constraints to their database even they knows that the First Date is always less than the Second Date.&amp;#160; &lt;/p&gt;  &lt;p&gt;CREATE TABLE CheckDates    &lt;br /&gt;(     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; StartDate DATETIME,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; EndDate DATETIME, &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; CONSTRAINT    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmp_Dates CHECK (StartDate&amp;lt;EndDate)     &lt;br /&gt;)&lt;/p&gt;  &lt;p&gt;Here I am adding a table level check constraint.&amp;#160; Now the database will verify when ever the user tries to add the Start Date &amp;gt; End Date with out writing any triggers or additionally writing logic in stored procedures or front end application every time we insert. &lt;/p&gt;  &lt;p&gt;However, you will face problem if you try to insert the column level constraint by referring to another column in the same table.&lt;/p&gt;  &lt;p&gt;CREATE TABLE CheckDates    &lt;br /&gt;(     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; StartDate DATETIME,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; EndDate DATETIME CONSTRAINT cmp_Dates CHECK (StartDate&amp;lt;EndDate)     &lt;br /&gt;)&lt;/p&gt;  &lt;p&gt;Writing the script as above will give you the error message “Column CHECK constraint for column 'EndDate' references another column, table 'CheckDates'.”.&amp;#160; Notice the comma in the first script which separates the column after EndDate DATETIME.&lt;/p&gt;  &lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://expertchandu.blogspot.com/2009/07/add-check-constraint-for-your-date-in.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://expertchandu.blogspot.com/2009/07/add-check-constraint-for-your-date-in.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-685852819282964846?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/-I6SABIVBpk" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-01T12:17:59.353+05:30</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2009/07/add-check-constraint-for-your-date-in.html</feedburner:origLink></item><item><title>Difference between Web Services and WCF</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/3B6wWp3bqlg/difference-between-web-services-and-wcf.html</link><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Fri, 26 Jun 2009 20:12:42 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-842158767925492817</guid><description>&lt;p&gt; &lt;/p&gt;  &lt;p&gt;Last time when I talked about WCF and told to upgrade from Web Services to WCF, many of my friends asked me about the difference between the Web Services and WCF and why to upgrade.  So now this blog entry explain why we need to upgrade from Web Services to WCF.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Reach ability&lt;/span&gt; &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;SOA initiatives using ASMX services and trying to reach out to all the stakeholders on internet using SOAP/http clients was the natural option, where as to connect with employees, internal users or partner’s it would have used TCP IP based .Net Remoting. Thus to serve different user base, one has to use different transport option and each transport needed independent implementation. &lt;/p&gt;  &lt;p&gt;Unlike ASMX services which were primarily Http based, WCF Services can be reached using multiple protocols like Http, TCP IP, Named Pipe and MSMQ. Other clients like internet/intranet or partners can use any of the above mentioned preferred channels to hook on to these services without IT having to maintain separate code base to serve different client class. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Interoperability&lt;/span&gt; &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Large Enterprises having mix of technologies, Interoperability requirements with Non Microsoft clients is one of the common scenarios in any SOA initiatives. With ASMX WS-*, XML Serialization is not standardized and hence it is difficult to achieve true interoperability. With WCF, it generates standard SOAP based XML to be consumed by clients. Additionally by using data contracts and message contracts, information exchange with non Microsoft clients’ become easy and improves interoperability. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Performance&lt;/span&gt; &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Most often sharpness of underlying technology contributes in meeting performance based business SLAs (e.g. In banking gateway for Money transfer, Number of clients served per second). ASMX services were part of .net framework 2.0, since then with .net 3.5 and 4.0 around, there has been continuous improvements in core .net framework to improve performance. &lt;/p&gt;  &lt;p&gt;One of the key reasons WCF performance is better than ASMX services is due to the improved serialization techniques in the .net framework. WCF services provide 25 to 40% improvement in performance over ASMX services and hence become natural preference for high performance application. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Extensibility&lt;/span&gt; &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If ASMX services were to be delivered to clients, only possible way to host them was on to IIS (Internet Information Server). With WCF services, one can host the services into Windows services, Windows Activation Service (WAS) or IIS. WCF also supports claims based authorization which is more granular than existing mechanisms. With WCF starting from application runtime, security, binding, serialization, channel system to service host everything is extensible. &lt;/p&gt;  &lt;p&gt;ASMX with WSE 3.0 supports security and http buffering/caching/sessions but still lacks support for Session management, Concurrency, Security, Reliable messaging, Transaction, Throttling, Exception handling and faults. In applications explicitly using WSE to support some of these features is difficult and cumbersome, where as with WCF WSE is inbuilt. &lt;/p&gt;  &lt;p&gt;With .Net 4.0, the argument to migrate becomes even stronger because of the benefit from platform features like CLR enhancements, Improved Garbage collection, Parallel programming, Distributed caching, and improved support for REST, and Workflow Services. &lt;/p&gt;  &lt;p&gt;With above benefits making way to WCF migration, one of the ways to solve service migration problem is by overlaying WCF attribute over ASMX attributes. e.g. With ServiceContract() attribute on ASMX Service class, and OperationContract() on service methods/operations and then making  appropriate changes in .config file. This wrapper based approach may make asmx services work with asmx and wcf clients. But with this approach, since the underlying code is still asmx, it will not benefit from the underlying framework advantages that WCF provides as discussed above.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://expertchandu.blogspot.com/2009/06/difference-between-web-services-and-wcf.html"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://expertchandu.blogspot.com/2009/06/difference-between-web-services-and-wcf.html" border="0" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-842158767925492817?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/3B6wWp3bqlg" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-27T08:42:42.138+05:30</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2009/06/difference-between-web-services-and-wcf.html</feedburner:origLink></item><item><title>WCF - Understanding the Service.</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/24_w1yEfeDk/wcf-understanding-service.html</link><category>asp.net c# wcf</category><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Mon, 22 Jun 2009 04:24:03 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-3236143654450126888</guid><description>&lt;p&gt; &lt;/p&gt;  &lt;h3 style="font-weight: normal;"&gt;This post is an introduction to Windows Communication Foundation (WCF) and will illustrate the ease at which a WCF service can be built. This article is written with the assumption that the reader has no prior knowledge of WCF. &lt;/h3&gt;&lt;p&gt; In this article I will just give you a small demo and allow you to get confidence on WCF especially if you are a novice.&lt;/p&gt;  &lt;p&gt;In this post we will just see how to create a simple WCF service application without going into more theory on WCF.  &lt;/p&gt;  &lt;p&gt;In general WCF as the name Windows Communications Foundation implies that the WCF is the concept released in .NET Framework 3.0 in order to provide effective communication between different applications.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;There is  myth that WCF is only for windows applications.  However, it is wrong to think that WCF is only for windows.  This can be thought as the replacement(strictly speaking enhancement) of the Web Services in .NET 1.X and .NET 2.0 frameworks.  &lt;/p&gt;  &lt;p&gt;I am using the Microsoft Visual Studio 2008 for this demo.  Here are the simple steps to follow,&lt;/p&gt;  &lt;p&gt;1.  Open visual studio and create a new project.&lt;/p&gt;  &lt;p&gt;2. In the project types under Visual C# or Visual Basic, select the Web and select the WCF Service Application from the right pane as shown in the figure.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_J2ewrGCKoAo/Sjo_qGbOnUI/AAAAAAAAAz0/3CeNFuq1lvY/s1600-h/image%5B21%5D.png"&gt;&lt;img title="New Project Template" style="border: 0px none ; display: inline;" alt="New Project Template" src="http://lh6.ggpht.com/_J2ewrGCKoAo/Sjo_s6-YqvI/AAAAAAAAAz4/cqgjiJ4B5Qo/image_thumb%5B32%5D.png?imgmax=800" border="0" width="589" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;3. Once we click on the OK button we will get file opened Service1.svc.cs or Service1.svc.vb based on the language.&lt;/p&gt;  &lt;p&gt;Now let us examine a few details on this newly created project.  &lt;/p&gt;  &lt;p&gt;Firstly, in the Solution explorer files, we can see three new files have created.&lt;/p&gt;  &lt;p&gt;IService.cs&lt;/p&gt;  &lt;p&gt;Service1.svc &lt;/p&gt;  &lt;p&gt;Service1.svc.cs&lt;/p&gt;  &lt;p&gt;Once we open the IService.cs file we can see the a interface and a class.  The interface looks something like this(in C#),&lt;/p&gt;  &lt;p&gt;    [ServiceContract]  &lt;br /&gt;   public interface IService1   &lt;br /&gt;   { &lt;/p&gt;  &lt;p&gt;        [OperationContract]  &lt;br /&gt;       string GetData(int value); &lt;/p&gt;  &lt;p&gt;        [OperationContract]  &lt;br /&gt;       CompositeType GetDataUsingDataContract(CompositeType composite); &lt;/p&gt;  &lt;p&gt;        // TODO: Add your service operations here  &lt;br /&gt;   }&lt;/p&gt;  &lt;p&gt;If we examine the Interface code carefully, we find an attribute called ServiceContract.  Well ServiceContract is something similar to a normal Service Contract in the real world.  We some one agree to provide any service to their customers they need to tell the customers what the services they can offer.  This is one service of such kind.  This interface with ServiceContract attribute will have methods that will be exposed as the Service to the public.  If you are not sure what does the expose to the public means, don’t panic, you can understand in the meanwhile.&lt;/p&gt;  &lt;p&gt;So now, for whatever class we need to expose to the public will implement the interface that has the ServiceContract attribute.  Well, then what about the attribute called OperationContract.  This is nothing but the method that we need to expose to the public.  For e.g., if we have 10 methods in our interface and out 10 we need to provide 5 methods to the public and the remaining 5 need not be.  So now for the 5 methods which we planned to publish should have the attribute [OperationContract].  And the methods that do not have this attribute will never be exposed to the public.  &lt;/p&gt;  &lt;p&gt;Also note that this service contract(interface) has defined a using namespace called as System.ServiceModel&lt;/p&gt;  &lt;p&gt;That’s all now for the Service Interface.  Then what about the class that we see at the bottom which looks here,&lt;/p&gt;  &lt;p&gt;[DataContract]  &lt;br /&gt;  public class CompositeType   &lt;br /&gt;  {   &lt;br /&gt;      bool boolValue = true;   &lt;br /&gt;      string stringValue = "Hello "; &lt;/p&gt;  &lt;p&gt;       [DataMember]  &lt;br /&gt;      public bool BoolValue   &lt;br /&gt;      {   &lt;br /&gt;          get { return boolValue; }   &lt;br /&gt;          set { boolValue = value; }   &lt;br /&gt;      } &lt;/p&gt;  &lt;p&gt;       [DataMember]  &lt;br /&gt;      public string StringValue   &lt;br /&gt;      {   &lt;br /&gt;          get { return stringValue; }   &lt;br /&gt;          set { stringValue = value; }   &lt;br /&gt;      }   &lt;br /&gt;  }&lt;/p&gt;  &lt;p&gt;We can see two kind of attributes here, namely [DataContract] and [DataMember].  For e.g., we need to expose the CompositeType to the public as a data type, then we can go for this attribute for our CompositeType.  Since, WCF will support the standard data types as well as the data types which are surrounded with the attribute [DataContract].  And the [DataMember] is the property that we are allowed to provide for the service.  And now we can add this class as the parameters as well as the return type as this,&lt;/p&gt;  &lt;p&gt;CompositeType GetDataUsingDataContract(CompositeType composite)&lt;/p&gt;  &lt;p&gt;{&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;Now, coming to the file named Service1.svc.cs, where we can find the actual service class that is to be exposed to the public.&lt;/p&gt;  &lt;p&gt;public class Service1 : IService1  &lt;br /&gt;   {   &lt;br /&gt;       public string GetData(int value)   &lt;br /&gt;       {   &lt;br /&gt;           return string.Format("You entered: {0}", value);   &lt;br /&gt;       } &lt;/p&gt;  &lt;p&gt;        public CompositeType GetDataUsingDataContract(CompositeType composite)  &lt;br /&gt;       {   &lt;br /&gt;           if (composite.BoolValue)   &lt;br /&gt;           {   &lt;br /&gt;               composite.StringValue += "Suffix";   &lt;br /&gt;           }   &lt;br /&gt;           return composite;   &lt;br /&gt;       }   &lt;br /&gt;   }&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Well, this class is nothing but the implementation of the IService1 interface as we saw earlier.  This may have some user defined logic or some database operations etc.&lt;/p&gt;  &lt;p&gt;While we try to open the file named Service1.svc we can see that the file will never open.  In order to open this file make a right click on the file and choose Open With..  In the Open With dialog box you can select the Web Service Editor(Default) and click on the open button.  &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_J2ewrGCKoAo/Sjo_uWeGt_I/AAAAAAAAAz8/ho4Pzc7sZi4/s1600-h/image%5B22%5D.png"&gt;&lt;img title="Open With.." style="border: 0px none ; display: inline;" alt="Open With.." src="http://lh5.ggpht.com/_J2ewrGCKoAo/Sjo_xgJsStI/AAAAAAAAA0A/qGd_Og1f52k/image_thumb%5B37%5D.png?imgmax=800" border="0" width="518" height="344" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;In that file you can find something similar to this,&lt;/p&gt;  &lt;p&gt;&amp;lt;%@ ServiceHost Language="C#" Debug="true" Service="WcfService1.Service1" CodeBehind="Service1.svc.cs" %&amp;gt;&lt;/p&gt;  &lt;p&gt;This has the different attributes such as CodeBehind, Debug, Service and Language where we can customize or go for default.&lt;/p&gt;  &lt;p&gt;Once we open the web.config file we can find an element called as system.serviceModel  which will look as follow,&lt;/p&gt;  &lt;p&gt;&amp;lt;system.serviceModel&amp;gt;  &lt;br /&gt;   &amp;lt;services&amp;gt;   &lt;br /&gt;     &amp;lt;service name="WcfService1.Service1"  behaviorConfiguration="WcfService1.Service1Behavior"&amp;gt;   &lt;br /&gt;       &amp;lt;!-- Service Endpoints --&amp;gt;   &lt;br /&gt;       &amp;lt;endpoint address="" binding="wsHttpBinding" contract="WcfService1.IService1"&amp;gt;   &lt;br /&gt;         &amp;lt;!--   &lt;br /&gt;             Upon deployment, the following identity element should be removed or replaced to reflect the   &lt;br /&gt;             identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity   &lt;br /&gt;             automatically.   &lt;br /&gt;         --&amp;gt;   &lt;br /&gt;         &amp;lt;identity&amp;gt;   &lt;br /&gt;           &amp;lt;dns value="localhost"/&amp;gt;   &lt;br /&gt;         &amp;lt;/identity&amp;gt;   &lt;br /&gt;       &amp;lt;/endpoint&amp;gt;   &lt;br /&gt;       &amp;lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&amp;gt;   &lt;br /&gt;     &amp;lt;/service&amp;gt;   &lt;br /&gt;   &amp;lt;/services&amp;gt;   &lt;br /&gt;   &amp;lt;behaviors&amp;gt;   &lt;br /&gt;     &amp;lt;serviceBehaviors&amp;gt;   &lt;br /&gt;       &amp;lt;behavior name="WcfService1.Service1Behavior"&amp;gt;   &lt;br /&gt;         &amp;lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&amp;gt;   &lt;br /&gt;         &amp;lt;serviceMetadata httpGetEnabled="true"/&amp;gt;   &lt;br /&gt;         &amp;lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&amp;gt;   &lt;br /&gt;         &amp;lt;serviceDebug includeExceptionDetailInFaults="false"/&amp;gt;   &lt;br /&gt;       &amp;lt;/behavior&amp;gt;   &lt;br /&gt;     &amp;lt;/serviceBehaviors&amp;gt;   &lt;br /&gt;   &amp;lt;/behaviors&amp;gt;   &lt;br /&gt; &amp;lt;/system.serviceModel&amp;gt;&lt;/p&gt;  &lt;p&gt;However, this is the main part of the WCF goes on where we need to define where we host the service and how what are the bindings and what are the data contracts which is generally called as the ABC’s of the WCF. &lt;/p&gt;  &lt;p&gt;Where &lt;/p&gt;  &lt;p&gt;A= Address we host our service&lt;/p&gt;  &lt;p&gt;B= Binding method we use for the service&lt;/p&gt;  &lt;p&gt;C= Service Contract that we use.&lt;/p&gt;  &lt;p&gt;This is a simple way of creating the Service.  In the upcoming posts we can see how to consume the service, the security issues, transactions etc.  &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-3236143654450126888?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/24_w1yEfeDk" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-22T16:54:03.710+05:30</app:edited><media:thumbnail url="http://lh6.ggpht.com/_J2ewrGCKoAo/Sjo_s6-YqvI/AAAAAAAAAz4/cqgjiJ4B5Qo/s72-c/image_thumb%5B32%5D.png?imgmax=800" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2009/06/wcf-understanding-service.html</feedburner:origLink></item><item><title>Internet Explorer 8 Back Ground color issue</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/c5sQL3QUaG0/internet-explorer-8-back-ground-color.html</link><category>design css</category><category>asp.net</category><category>IE8 Background Issue</category><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Thu, 19 Mar 2009 07:46:08 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-6282515415705601222</guid><description>Today I saw a really interesting issue. The issue come up with Internet Explorer 8. However my site is running with out any issues since lot of days. In my page, I has a some shifts to be selected to do some task. Each shift may have some color. I need to display all the shifts in their own colors. To do this I have a RadioButtonList in my asp.net page. I am adding the style attribute to the page from the code behind as follows,&lt;br /&gt;&lt;br /&gt;radioButtonListItem.Attributes.Add("style", "color:white;background-color:" + alteredColor);&lt;br /&gt;&lt;br /&gt;This will display the my radio button list similar to this,&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_J2ewrGCKoAo/ScJWg-iG3cI/AAAAAAAAAvo/eie0PaArFcc/s1600-h/RadioButtonListColored.JPG"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 750px; DISPLAY: block; CURSOR: hand" id="BLOGGER_PHOTO_ID_5314905634792463810" border="0" alt="" src="http://2.bp.blogspot.com/_J2ewrGCKoAo/ScJWg-iG3cI/AAAAAAAAAvo/eie0PaArFcc/s320/RadioButtonListColored.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;However, this looked very ugly when viewed in Internet Explorer 8,&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_J2ewrGCKoAo/ScJX4m3_UmI/AAAAAAAAAvw/UotXqt_XT6k/s1600-h/RadioButtonListMissingColors.JPG"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 750px; DISPLAY: block; CURSOR: hand" id="BLOGGER_PHOTO_ID_5314907140270281314" border="0" alt="" src="http://2.bp.blogspot.com/_J2ewrGCKoAo/ScJX4m3_UmI/AAAAAAAAAvw/UotXqt_XT6k/s320/RadioButtonListMissingColors.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After doing a small research, I understood that the background color is missing. Unfortunately, I was unable to browse the google in a effective way, since the problem is some what new. However with some observation Microsoft provided a good alternative for this issue. There is a button named "Compatibility View" which is placed just beside address bar of IE 8,&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_J2ewrGCKoAo/ScJZf8YIM5I/AAAAAAAAAv4/AqtI_xgqqrw/s1600-h/Compatibility+View+Button.JPG"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 750px; DISPLAY: block; CURSOR: hand" id="BLOGGER_PHOTO_ID_5314908915568751506" border="0" alt="" src="http://4.bp.blogspot.com/_J2ewrGCKoAo/ScJZf8YIM5I/AAAAAAAAAv4/AqtI_xgqqrw/s320/Compatibility+View+Button.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the above image, you can see that there is a button just beside the Address bar. While clicking this button the page will reload. This has fixed the problem in my case.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-6282515415705601222?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/c5sQL3QUaG0" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-19T20:16:08.949+05:30</app:edited><media:thumbnail url="http://2.bp.blogspot.com/_J2ewrGCKoAo/ScJWg-iG3cI/AAAAAAAAAvo/eie0PaArFcc/s72-c/RadioButtonListColored.JPG" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2009/03/internet-explorer-8-back-ground-color.html</feedburner:origLink></item><item><title>Pull the html from a different page</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/zfRsLcMl3nA/pull-html-from-different-page.html</link><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Fri, 06 Mar 2009 02:29:40 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-7977877751872927317</guid><description>I will demo a small interesting feature of ASP.NET which is unknown to many people.  One of the hardest things in asp.net is to build a html strings in order to send a mail.  Hardest - in the sense I mean to construct a good html.  However a lot of developers will try to construct all the html by making use of StringBuilder objects.  Sadly many people I saw were using the strings which leave the Garbage Collector to have work more.&lt;br /&gt;&lt;br /&gt;Well.  What if you have want to format your email text is a really good manner.  Or what if you want to mail the page that is already existing.  However you need to get all the html from a different page.  A browser can get the html generated by your ASP.NET application and IIS.  While a browser can get the html why cannot your application get the html of a page.  Yes, you can get the html page of your aspx page.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;This feature is provided in ASP.NET by the System.Net namespace.  You can create an instance of the WebClient class.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;using System.Net;&lt;br /&gt;&lt;br /&gt;.....&lt;br /&gt;&lt;br /&gt;.....&lt;br /&gt;&lt;br /&gt;//The parameter url is to be the full url of your web page.  It cannot be physical path.  For eg., Http://www.google.com/test.aspx instead of ~/test.aspx&lt;br /&gt;&lt;br /&gt;public string getTheHtmlOutput(string url)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt; string myHtmlOutput=string.Empty;&lt;br /&gt;&lt;br /&gt; WebClient HtmlClient=new WebClient();&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; //Executes the page(url) that is passed and retrieves the html in the byte array.&lt;br /&gt;&lt;br /&gt; byte[] outputBytes=HtmlClient.DownloadData(url);&lt;br /&gt;&lt;br /&gt; myHtmlOutput=Encoding.Default.GetString(outputBytes);&lt;br /&gt;&lt;br /&gt; return myHtmlOutput;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;This method will return the html of some other page in your application.  However, there are even some issue behind this such as  execution time.  And what if there is an error in the different page.  Should the error will be mailed if you are using the page for mailing purposes.  However, the raising errors in this way is very rare case.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-7977877751872927317?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/zfRsLcMl3nA" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-06T15:59:40.267+05:30</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2009/03/pull-html-from-different-page.html</feedburner:origLink></item><item><title>GridView Series</title><link>http://feedproxy.google.com/~r/blogspot/XulJ/~3/XAhWkEDBmgI/gridview-series.html</link><category>asp.net gridview ado.net 2.0</category><author>noreply@blogger.com (Chandra Sekhar)</author><pubDate>Wed, 04 Mar 2009 01:22:28 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-4876994005321194580.post-3639950499944222823</guid><description>I am very happy to create my first blog.  I have chosen to cover the topics on gridview.  I will cover the gridview control of asp.net in a series of blogs.  First of all, to say GridView is a simple table in the html point of view.  This is a new control released in .NET 2.0.  It offers a lot of inbuilt options such as sorting, editing, paging with out a single line of code.  Of course, the sentence "Single line of code" has many restrictions.  I will discuss those in my future article.&lt;br /&gt;&lt;br /&gt;However, coming to the point the GridView is frequently used to display the data in a tabular context.  This consists of lot of formatting options, which can be easily handled by the developer without any knowledge on css.&lt;br /&gt;&lt;br /&gt;The GridView will offer us a lot of ways to bind the data to it.  We can connect to the gridview via,&lt;br /&gt;&lt;br /&gt;-The ADO.NET objects such as DataTable, DataSet, DataView&lt;br /&gt;-The User Objects such as the collections, ArrayLists etc.&lt;br /&gt;-The Data Source controls such as SqlDataSource, ObjectDataSource.&lt;br /&gt;&lt;br /&gt;In the next article I will conver how to fill the data to the grid.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4876994005321194580-3639950499944222823?l=expertchandu.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/XulJ/~4/XAhWkEDBmgI" height="1" width="1"/&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-04T14:52:28.718+05:30</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://expertchandu.blogspot.com/2009/03/gridview-series.html</feedburner:origLink></item><media:rating>nonadult</media:rating></channel></rss>

