<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Free practice test , mock test, driving test, interview questions &#187; .NET</title>
	<atom:link href="http://www.skill-guru.com/blog/tag/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.skill-guru.com/blog</link>
	<description>Find free mock and practice test, create and sell tests</description>
	<lastBuildDate>Mon, 06 Sep 2010 19:14:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>What is WCF &#8211; Window Communication Foundation ?</title>
		<link>http://www.skill-guru.com/blog/2010/04/24/what-is-wcf-window-communication-foundation/</link>
		<comments>http://www.skill-guru.com/blog/2010/04/24/what-is-wcf-window-communication-foundation/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 14:08:11 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=2113</guid>
		<description><![CDATA[Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application
Some useful links
MSDN
Windows Communication Foundation Tutorial
Check [...]]]></description>
			<content:encoded><![CDATA[<p>Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application</p>
<p>Some useful links</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms731082.aspx">MSDN</a><br />
<a href="http://weblogs.asp.net/joestagner/archive/2008/03/15/windows-communication-foundation-65-links-to-make-you-an-expert.aspx">Windows Communication Foundation</a> Tutorial</p>
<p>Check out <a href="http://www.skill-guru.com/test/43/c-interview-questions">C# interview questions</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/04/24/what-is-wcf-window-communication-foundation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a dynamic tooltip with AJAX</title>
		<link>http://www.skill-guru.com/blog/2010/04/10/creating-a-dynamic-tooltip-with-ajax/</link>
		<comments>http://www.skill-guru.com/blog/2010/04/10/creating-a-dynamic-tooltip-with-ajax/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 15:26:10 +0000</pubDate>
		<dc:creator>fanand</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[jsp]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=2019</guid>
		<description><![CDATA[The Tooltip is a common graphical user interface element. It is used in conjunction with a cursor, usually a mouse pointer. The User hovers the cursor over an item, without clicking it, and tooltip may appear &#8211; a small hoverbox with information about the being hovered over.
Ajax Tool tip : AJAX is the art of [...]]]></description>
			<content:encoded><![CDATA[<p>The Tooltip is a common graphical user interface element. It is used in conjunction with a cursor, usually a mouse pointer. The User hovers the cursor over an item, without clicking it, and tooltip may appear &#8211; a small hoverbox with information about the being hovered over.</p>
<p><strong>Ajax Tool tip</strong> : AJAX is the art of exchanging data with a server, and update parts of a web page &#8211; without reloading the whole page. By Using the Ajax tool tip we can show the content of the tooltip is retrieved by Ajax from external files.</p>
<ul>
<li>Files to be used in the Ajax Tool tip
<ul>
<li>ajax-tooltip.html = Main HTML file</li>
<li>js/ajax-tooltip.js = Main JS file for the script</li>
<li>js/ajax.js = Ajax (SACK library)</li>
<li>js/ajax-dynamic-content.js = The dynamic content script from this site</li>
<li>css/ajax-tooltip.css = CSS for tooltip</li>
<li>images/arrow.gif = Arrow used in the tooltip</li>
<li>demo-pages = External files loaded by the tooltip</li>
</ul>
</li>
</ul>
<p><strong> </strong></p>
<p>The files used for demo can be downloaded from here <a href="http://www.dhtmlgoodies.com/scripts/ajax-tooltip/ajax-tooltip.zip" target="_blank">http://www.dhtmlgoodies.com/scripts/ajax-tooltip/ajax-tooltip.zip</a></p>
<p><strong>Configuration : </strong>First, you need to include the js files and css files as in the demo (ajax-tooltip.html). <span id="more-2019"></span><!--more--><!--more--></p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;newjs/ajax-dynamic-content.js&#8221;&gt;&lt;/script&gt;</p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;newjs/ajax.js&#8221;&gt;&lt;/script&gt;</p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;newjs/ajax-tooltip.js&#8221;&gt;</p>
<p>The tooltip is called by a mouseover event applied to an &lt;A&gt; tag.</p>
<p>Example:</p>
<p>&lt;a href=&#8221;#&#8221; onmouseover=&#8221;ajax_showTooltip(&#8216;demo-pages/ajax-tooltip.html&#8217;,this);return false&#8221;&gt;Show Me tooltip!&lt;/a&gt;</p>
<p><strong>Working Techniques:</strong></p>
<p>Before Proceeding with the files used in tool tips we must know the usage of the files.</p>
<p>Main HTML file</p>
<p>Where we going to show the tooltip</p>
<p>JS Files</p>
<p>Supporting files to Show the Tool Tip. JS files</p>
<p>We need to have the browser compatible with ajax,</p>
<p>We need to cache the contents of the tooltip so that when the hover  on the content will show without much time.</p>
<p>And Also for the creating div element on the hover function, Place them in appropriate places next to &lt;a&gt; tag show the tool tip</p>
<p>CSS File</p>
<p>The layout(size, colors and arrow) is defined in the CSS.</p>
<p>External File of Content</p>
<p>The Result content is Stored in this Page. This Page can be programmed in such a manner to fetch the contents related to the &lt;a&gt; tag which hovers.</p>
<p><strong> </strong></p>
<p><strong>MAIN HTML FILE</strong></p>
<p><strong> </strong>The main Html file will have the following lines</p>
<p>&lt;link href=”ajaxtooltip.css&#8221; rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221;&gt;</p>
<p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;newjs/ajax-dynamic-content.js&#8221;&gt;&lt;/script&gt;</p>
<p>&lt;script src=&#8221;newjs/ajax.js&#8221;&gt;&lt;/script&gt;</p>
<p>&lt;script src=&#8221;newjs/ajax-tooltip.js&#8221;&gt;</p>
<p>&lt;a href=&#8221;#&#8221; onmouseover=&#8221;ajax_showTooltip(&#8216;demo-pages/ajax-tooltip.html&#8217;,this);return false&#8221;&gt;</p>
<p>Show Me tooltip!</p>
<p>&lt;/a&gt;</p>
<p>&#8216;demo-pages/ajax-tooltip.html’ is the file which having the contents need to show</p>
<p>in tool tip action. Files may name as ‘search_contentfile.php?Id=&lt;dynamic idno&gt;’ also. It’s the prettiest way to fetch contents and show them in tooltip.</p>
<p>So the html file putting environment for ajax tooltip show.</p>
<p>The file may contain the all the other lines which used to display other contents in the page</p>
<p>When the action of hover occur it function calls and show tooltip with appropriate contents.</p>
<p><strong>JS Files</strong><strong> </strong></p>
<p><strong>1.ajax-tooltip.js:</strong></p>
<p>The function that’s called during hover function ShowTooltip is placed in this file</p>
<p>var ajax_tooltipObj = false;</p>
<p>var ajax_tooltipObj_iframe = false;</p>
<p>var ajax_tooltip_MSIE = false;</p>
<p>if(navigator.userAgent.indexOf(&#8216;MSIE&#8217;)&gt;=0)ajax_tooltip_MSIE=true;</p>
<p>function ajax_showTooltip(externalFile,inputObj)</p>
<p>{</p>
<p>if(!ajax_tooltipObj)          /* Tooltip div not created yet ? */</p>
<p>{</p>
<p>ajax_tooltipObj = document.createElement(&#8216;DIV&#8217;);</p>
<p>ajax_tooltipObj.style.position = &#8216;absolute&#8217;;</p>
<p>ajax_tooltipObj.id = &#8216;ajax_tooltipObj&#8217;;</p>
<p>document.body.appendChild(ajax_tooltipObj);</p>
<p>var leftDiv = document.createElement(&#8216;DIV&#8217;);         /* Create arrow div */</p>
<p>leftDiv.className=&#8217;ajax_tooltip_arrow&#8217;;</p>
<p>leftDiv.id = &#8216;ajax_tooltip_arrow&#8217;;</p>
<p>ajax_tooltipObj.appendChild(leftDiv);</p>
<p>var contentDiv = document.createElement(&#8216;DIV&#8217;); /* Create tooltip content div */</p>
<p>contentDiv.className = &#8216;ajax_tooltip_content&#8217;;</p>
<p>ajax_tooltipObj.appendChild(contentDiv);</p>
<p>contentDiv.id = &#8216;ajax_tooltip_content&#8217;;</p>
<p>if(ajax_tooltip_MSIE){     /* Create iframe object for MSIE in order to make the tooltip cover select boxes */</p>
<p>ajax_tooltipObj_iframe = document.createElement(&#8216;&lt;IFRAME frameborder=&#8221;0&#8243;&gt;&#8217;);</p>
<p>ajax_tooltipObj_iframe.style.position = &#8216;absolute&#8217;;</p>
<p>ajax_tooltipObj_iframe.border=&#8217;0&#8242;;</p>
<p>ajax_tooltipObj_iframe.frameborder=0;</p>
<p>ajax_tooltipObj_iframe.style.backgroundColor=&#8217;#FFF&#8217;;</p>
<p>ajax_tooltipObj_iframe.src = &#8216;about:blank&#8217;;</p>
<p>contentDiv.appendChild(ajax_tooltipObj_iframe);</p>
<p>ajax_tooltipObj_iframe.style.left = &#8216;0px&#8217;;</p>
<p>ajax_tooltipObj_iframe.style.top = &#8216;0px&#8217;;</p>
<p>}</p>
<p>}</p>
<p>// Find position of tooltip</p>
<p>ajax_tooltipObj.style.display=&#8217;block&#8217;;</p>
<p>ajax_loadContent(&#8216;ajax_tooltip_content&#8217;,externalFile);</p>
<p>if(ajax_tooltip_MSIE){</p>
<p>ajax_tooltipObj_iframe.style.width = ajax_tooltipObj.clientWidth + &#8216;px&#8217;;</p>
<p>ajax_tooltipObj_iframe.style.height = ajax_tooltipObj.clientHeight + &#8216;px&#8217;;</p>
<p>}</p>
<p>ajax_positionTooltip(inputObj);</p>
<p>}</p>
<p>During the Process, the files check with the other files about the compatibility of browser, and the status about the content.</p>
<p>The Tooltip is div element created on the process of hovering.</p>
<p>The styles are applied in CSS as per purpose.</p>
<p>Another Main thing in the Tool tip is Showing the tool tip in right place</p>
<p>So the tooltip will be more effective.</p>
<p>The function below is used to determine the position of tool tip.</p>
<p>function ajax_positionTooltip(inputObj)</p>
<p>{</p>
<p>var leftPos = (ajaxTooltip_getLeftPos(inputObj) + inputObj.offsetWidth);</p>
<p>var topPos = ajaxTooltip_getTopPos(inputObj);</p>
<p>/*</p>
<p>var rightedge=ajax_tooltip_MSIE? document.body.clientWidth-leftPos : window.innerWidth-leftPos</p>
<p>var bottomedge=ajax_tooltip_MSIE? document.body.clientHeight-topPos : window.innerHeight-topPos</p>
<p>*/</p>
<p>var tooltipWidth = document.getElementById(&#8216;ajax_tooltip_content&#8217;).offsetWidth +  document.getElementById(&#8216;ajax_tooltip_arrow&#8217;).offsetWidth;</p>
<p>// Dropping this reposition for now because of flickering</p>
<p>//var offset = tooltipWidth &#8211; rightedge;</p>
<p>//if(offset&gt;0)leftPos = Math.max(0,leftPos &#8211; offset &#8211; 5);</p>
<p>ajax_tooltipObj.style.left = leftPos + &#8216;px&#8217;;</p>
<p>ajax_tooltipObj.style.top = topPos + &#8216;px&#8217;;</p>
<p>}</p>
<p>The functions below are used to find the positions,</p>
<p>function ajaxTooltip_getTopPos(inputObj)</p>
<p>{</p>
<p>var returnValue = inputObj.offsetTop;</p>
<p>while((inputObj = inputObj.offsetParent) != null){</p>
<p>if(inputObj.tagName!=&#8217;HTML&#8217;)returnValue += inputObj.offsetTop;</p>
<p>}</p>
<p>return returnValue;</p>
<p>}</p>
<p>function ajaxTooltip_getLeftPos(inputObj)</p>
<p>{</p>
<p>var returnValue = inputObj.offsetLeft;</p>
<p>while((inputObj = inputObj.offsetParent) != null){</p>
<p>if(inputObj.tagName!=&#8217;HTML&#8217;)returnValue += inputObj.offsetLeft;</p>
<p>}</p>
<p>return returnValue;</p>
<p>}</p>
<p><strong> </strong></p>
<p><strong> </strong>Thus the Tool Tip is Placed in the Right Place.</p>
<p>Also we need a function to not to display them in mouse out.</p>
<p>The function can be written as follows.</p>
<p>function ajax_hideTooltip()</p>
<p>{</p>
<p>ajax_tooltipObj.style.display=&#8217;none&#8217;;</p>
<p>}<strong> </strong></p>
<p><strong>2. </strong><strong>ajax.js</strong></p>
<p>The Js. Used to fine the browser compatiablity and ajax functional purposes</p>
<p>function sack(file){</p>
<p>this.AjaxFailedAlert = &#8220;Your browser does not support the enhanced functionality of this website, and therefore you will have an experience that differs from the intended one.\n&#8221;;</p>
<p>this.requestFile = file;</p>
<p>this.method = &#8220;POST&#8221;;</p>
<p>this.URLString = &#8220;&#8221;;</p>
<p>this.encodeURIString = true;</p>
<p>this.execute = false;</p>
<p>this.onLoading = function() { };</p>
<p>this.onLoaded = function() { };</p>
<p>this.onInteractive = function() { };</p>
<p>this.onCompletion = function() { };</p>
<p>this.createAJAX = function() {</p>
<p>try {</p>
<p>this.xmlhttp = new ActiveXObject(&#8220;Msxml2.XMLHTTP&#8221;);</p>
<p>} catch (e) {</p>
<p>try {</p>
<p>this.xmlhttp = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);</p>
<p>} catch (err) {</p>
<p>this.xmlhttp = null;</p>
<p>}</p>
<p>}</p>
<p>if(!this.xmlhttp &amp;&amp; typeof XMLHttpRequest != &#8220;undefined&#8221;)</p>
<p>this.xmlhttp = new XMLHttpRequest();</p>
<p>if (!this.xmlhttp){</p>
<p>this.failed = true;</p>
<p>}</p>
<p>};</p>
<p>this.setVar = function(name, value){</p>
<p>if (this.URLString.length &lt; 3){</p>
<p>this.URLString = name + &#8220;=&#8221; + value;</p>
<p>} else {</p>
<p>this.URLString += &#8220;&amp;&#8221; + name + &#8220;=&#8221; + value;</p>
<p>}</p>
<p>}</p>
<p>this.encVar = function(name, value){</p>
<p>var varString = encodeURIComponent(name) + &#8220;=&#8221; + encodeURIComponent(value);</p>
<p>return varString;</p>
<p>}</p>
<p>this.encodeURLString = function(string){</p>
<p>varArray = string.split(&#8216;&amp;&#8217;);</p>
<p>for (i = 0; i &lt; varArray.length; i++){</p>
<p>urlVars = varArray[i].split(&#8216;=&#8217;);</p>
<p>if (urlVars[0].indexOf(&#8216;amp;&#8217;) != -1){</p>
<p>urlVars[0] = urlVars[0].substring(4);</p>
<p>}</p>
<p>varArray[i] = this.encVar(urlVars[0],urlVars[1]);</p>
<p>}</p>
<p>return varArray.join(&#8216;&amp;&#8217;);</p>
<p>}</p>
<p>this.runResponse = function(){</p>
<p>eval(this.response);</p>
<p>}</p>
<p>this.runAJAX = function(urlstring){</p>
<p>this.responseStatus = new Array(2);</p>
<p>if(this.failed &amp;&amp; this.AjaxFailedAlert){</p>
<p>alert(this.AjaxFailedAlert);</p>
<p>} else {</p>
<p>if (urlstring){</p>
<p>if (this.URLString.length){</p>
<p>this.URLString = this.URLString + &#8220;&amp;&#8221; + urlstring;</p>
<p>} else {</p>
<p>this.URLString = urlstring;</p>
<p>}</p>
<p>}</p>
<p>if (this.encodeURIString){</p>
<p>var timeval = new Date().getTime();</p>
<p>this.URLString = this.encodeURLString(this.URLString);</p>
<p>this.setVar(&#8220;rndval&#8221;, timeval);</p>
<p>}</p>
<p>if (this.element) { this.elementObj = document.getElementById(this.element); }</p>
<p>if (this.xmlhttp) {</p>
<p>var self = this;</p>
<p>if (this.method == &#8220;GET&#8221;) {</p>
<p>var totalurlstring = this.requestFile + &#8220;?&#8221; + this.URLString;</p>
<p>this.xmlhttp.open(this.method, totalurlstring, true);</p>
<p>} else {</p>
<p>this.xmlhttp.open(this.method, this.requestFile, true);</p>
<p>}</p>
<p>if (this.method == &#8220;POST&#8221;){</p>
<p>try {</p>
<p>this.xmlhttp.setRequestHeader(&#8216;Content-Type&#8217;,'application/x-www-form-urlencoded&#8217;)</p>
<p>} catch (e) {}</p>
<p>}</p>
<p>this.xmlhttp.send(this.URLString);</p>
<p>this.xmlhttp.onreadystatechange = function() {</p>
<p>switch (self.xmlhttp.readyState){</p>
<p>case 1:</p>
<p>self.onLoading();</p>
<p>break;</p>
<p>case 2:</p>
<p>self.onLoaded();</p>
<p>break;</p>
<p>case 3:</p>
<p>self.onInteractive();</p>
<p>break;</p>
<p>case 4:</p>
<p>self.response = self.xmlhttp.responseText;</p>
<p>self.responseXML = self.xmlhttp.responseXML;</p>
<p>self.responseStatus[0] = self.xmlhttp.status;</p>
<p>self.responseStatus[1] = self.xmlhttp.statusText;</p>
<p>self.onCompletion();</p>
<p>if(self.execute){ self.runResponse(); }</p>
<p>if (self.elementObj) {</p>
<p>var elemNodeName = self.elementObj.nodeName;</p>
<p>elemNodeName.toLowerCase();</p>
<p>if (elemNodeName == &#8220;input&#8221; || elemNodeName == &#8220;select&#8221; || elemNodeName == &#8220;option&#8221; || elemNodeName == &#8220;textarea&#8221;){</p>
<p>self.elementObj.value = self.response;</p>
<p>} else {</p>
<p>self.elementObj.innerHTML = self.response;</p>
<p>}</p>
<p>}</p>
<p>self.URLString = &#8220;&#8221;;</p>
<p>break;</p>
<p>}</p>
<p>};</p>
<p>}</p>
<p>}</p>
<p>};</p>
<p>this.createAJAX();</p>
<p>}</p>
<p><strong>3.ajax-tooltip.js</strong></p>
<p>This Js function used to get the details from external file and used to store the details in cache so that visited contents can display with less time consuming</p>
<p>function ajax_showContent(divId,ajaxIndex,url)</p>
<p>{</p>
<p>document.getElementById(divId).innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response;</p>
<p>if(enableCache){</p>
<p>jsCache[url] =    dynamicContent_ajaxObjects[ajaxIndex].response;</p>
<p>}</p>
<p>dynamicContent_ajaxObjects[ajaxIndex] = false;</p>
<p>}</p>
<p>function ajax_loadContent(divId,url)</p>
<p>{</p>
<p>if(enableCache &amp;&amp; jsCache[url]){</p>
<p>document.getElementById(divId).innerHTML = jsCache[url];</p>
<p>return;</p>
<p>}</p>
<p>var ajaxIndex = dynamicContent_ajaxObjects.length;</p>
<p>document.getElementById(divId).innerHTML = &#8216;Loading content &#8211; please wait&#8217;;</p>
<p>dynamicContent_ajaxObjects[ajaxIndex] = new sack();</p>
<p>if(url.indexOf(&#8216;?&#8217;)&gt;=0){</p>
<p>dynamicContent_ajaxObjects[ajaxIndex].method=&#8217;GET&#8217;;</p>
<p>var string = url.substring(url.indexOf(&#8216;?&#8217;));</p>
<p>url = url.replace(string,&#8221;);</p>
<p>string = string.replace(&#8216;?&#8217;,&#8221;);</p>
<p>var items = string.split(/&amp;/g);</p>
<p>for(var no=0;no&lt;items.length;no++){</p>
<p>var tokens = items[no].split(&#8216;=&#8217;);</p>
<p>if(tokens.length==2){</p>
<p>dynamicContent_ajaxObjects[ajaxIndex].setVar(tokens[0],tokens[1]);</p>
<p>}</p>
<p>}</p>
<p>url = url.replace(string,&#8221;);</p>
<p>}</p>
<p>dynamicContent_ajaxObjects[ajaxIndex].requestFile = url;            // Specifying which file to get</p>
<p>dynamicContent_ajaxObjects[ajaxIndex].onCompletion = function(){ ajax_showContent(divId,ajaxIndex,url); };            // Specify function that will be executed after file has been found</p>
<p>dynamicContent_ajaxObjects[ajaxIndex].runAJAX();                      // Execute AJAX function</p>
<p>}</p>
<p><strong>EXTERNAL FILE TO SHOW CONTENTS</strong></p>
<p><strong> </strong></p>
<p>When having the &lt;a&gt; tag href is like the below,</p>
<p>‘search_contentfile.php?Id=&lt;dynamic idno&gt;’ then search_contentfile.php is the external file name.</p>
<p>The Page  can be designed as per purpose, but the contents need to show must be followed by echo statement</p>
<p>Sample External File</p>
<p>&lt;?</p>
<p>include&#8217;library/config.php&#8217;;</p>
<p>include&#8217;library/opendb.php&#8217;;</p>
<p>include&#8217;library/constants_path.php&#8217;;</p>
<p>include&#8217;library/functions.php&#8217;;</p>
<p>$description=&#8221;;</p>
<p>$cats_id = 0;</p>
<p>if(isset($_GET['ad_id']) &amp;&amp; $_GET['ad_id']!=&#8221;)</p>
<p>{</p>
<p>$get_details_query = &#8220;select * from ads where ad_id=&#8217;$_GET[ad_id]&#8216;&#8221;;</p>
<p>$get_details_result = mysql_query($get_details_query);</p>
<p>$get_rows = mysql_fetch_array($get_details_result);</p>
<p>$description = str_replace(&#8220;/n&#8221;,&#8221;&lt;br/&gt;&#8221;,$get_rows['ad_description']);</p>
<p>$contact_email = $get_rows['Contact_email'];</p>
<p>$con = $get_rows['date_posted'];</p>
<p>$dates     = explode(&#8220;-&#8221;, $con);</p>
<p>$year     = $dates['0'];</p>
<p>$month     = $dates['1'];</p>
<p>$day      = $dates['2'];</p>
<p>$Date = date(&#8220;d-M-Y&#8221;, mktime(0,0,0,$month, $day, $year));</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;   PRICE  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>$Price = $get_rows['price'];</p>
<p>$category_id = $get_rows['category_id'];</p>
<p>if($category_id != &#8221;&amp;&amp; $category_id != 0)</p>
<p>{</p>
<p>$cat_query = &#8220;select * from categories where category_id = $category_id and par_category_id IS NULL&#8221;;</p>
<p>$cat_result = mysql_query($cat_query);</p>
<p>$cat_num_row = mysql_num_rows($cat_result);</p>
<p>$cat_row = mysql_fetch_array($cat_result);</p>
<p>if($cat_num_row == 0)</p>
<p>{</p>
<p>$subcat_query = &#8220;select * from categories where category_id = $category_id&#8221;;</p>
<p>$subcat_result = mysql_query($subcat_query);</p>
<p>$subcat_row = mysql_fetch_array($subcat_result);</p>
<p>$cats_query = &#8220;select * from categories where category_id = $subcat_row[par_category_id]&#8220;;</p>
<p>$cats_result = mysql_query($cats_query);</p>
<p>$cats_row = mysql_fetch_array($cats_result);</p>
<p>$cats_id = $cats_row['category_id'];</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>$cats_id = $cat_row['category_id'];</p>
<p>}</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;   PRICE  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>$output = &#8220;        &lt;html&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;table border=0 width=100%&gt;</p>
<p>&lt;tr&gt;</p>
<p>&lt;!&#8211;       &lt;td align=left width=50%&gt;&lt;b&gt;Email: $contact_email&lt;/b&gt;&lt;/td&gt;            &#8211;&gt;</p>
<p>&lt;td align=left width=50%&gt;&amp;nbsp;&lt;b&gt;&#8221;;</p>
<p>if($cats_id==1 || $cats_id==2 || $cats_id==109)</p>
<p>{</p>
<p>$output .=&#8221;                                                                                &lt;b&gt;Price: Rs$Price&lt;/b&gt;&#8221;;</p>
<p>}</p>
<p>$output .= &#8220;                                                       &lt;/td&gt;</p>
<p>&lt;td align=left width=15%&gt;&amp;nbsp;&lt;/td&gt;</p>
<p>&lt;td align=right width=35%&gt;&lt;b&gt;Date: $Date&lt;/b&gt;&amp;nbsp;&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>&lt;tr&gt;</p>
<p>&lt;td colspan=3&gt;&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>&lt;tr&gt;</p>
<p>&lt;td colspan=3&gt;$description;&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>&lt;/table&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;&#8221;;</p>
<p>echo $output;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>echo &#8220;&#8221;;</p>
<p>}</p>
<p>?&gt;</p>
<p><strong>CSS FILE: </strong></p>
<p><strong> </strong>The Styles for the Css is defined as</p>
<p>#ajax_tooltipObj{</p>
<p>font-family: Calibri;</p>
<p>z-index:1000000;</p>
<p>text-align:left;</p>
<p>}</p>
<p>#ajax_tooltipObj div{</p>
<p>position:relative;</p>
<p>}</p>
<p>/* If you don&#8217;t want the arrow &#8211; Just set the width of this div to 1 or something like that and drop the background selectors from the CSS below */</p>
<p>#ajax_tooltipObj .ajax_tooltip_arrow{        /* Left div for the small arrow */</p>
<p>background-image:url(&#8216;../images/ajaxarrow.gif&#8217;);</p>
<p>width:20px;</p>
<p>position:absolute;</p>
<p>left:0px;</p>
<p>top:0px;</p>
<p>background-repeat:no-repeat;</p>
<p>background-position:center left;</p>
<p>z-index:1000005;</p>
<p>height:40px;</p>
<p>}</p>
<p>#ajax_tooltipObj .ajax_tooltip_content{</p>
<p>border:2px solid #317082;           /* Border width */</p>
<p>left:18px;           /* Same as border thickness */</p>
<p>top:0px;</p>
<p>position:absolute;</p>
<p>width:400px;      /* Width of tooltip content */</p>
<p>height:auto;       /* Height of tooltip content */</p>
<p>background-color:#FFF;  /* Background color */</p>
<p>padding:5px;      /* Space between border and content */</p>
<p>font-size:0.8em; /* Font size of content */</p>
<p>font-family: Calibri;</p>
<p>overflow:auto;     /* Hide overflow content */</p>
<p>z-index:1000001;</p>
<p>}</p>
<p><strong>Customizing the Tool tip:</strong></p>
<p><strong> </strong></p>
<p>We can customize the tool tip by altering the css codes. We can change the appearance of the tool tip box,</p>
<p>Example from droik.com search result:</p>
<p><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/04/Picture1.jpg"><img class="alignnone size-full wp-image-2020" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/04/Picture1.jpg" alt="Ajax Dynamic Tool Tip" width="667" height="212" /></a></p>
<p>Above snapshot shows the description about the advertisement dynamically to the user.</p>
<p><strong>Conclusion:</strong></p>
<p>Showing tooltip will be very good idea during website designs, and its give the idea about the link for the users. And also its easy to use and efficient.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/04/10/creating-a-dynamic-tooltip-with-ajax/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PMP Certification practice questions</title>
		<link>http://www.skill-guru.com/blog/2010/03/19/pmp-certification-practice-questions/</link>
		<comments>http://www.skill-guru.com/blog/2010/03/19/pmp-certification-practice-questions/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 02:10:30 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Mock  Exam / Certifications]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[pmp]]></category>
		<category><![CDATA[practice-test]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1776</guid>
		<description><![CDATA[Project Management Professional (PMP) is a credential offered by the Project Management Institute (PMI).
The PMP exam is based on the PMP Examination Specification, which describes tasks out of six Performance Domains:

Initiating the Project (11%)
Planning the Project (23%)
Executing the Project (27%)
Monitoring and Controlling the Project (21%)
Closing the Project (9%)
Professional and Social Responsibility (9%)

The exam consists of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Project Management Professional</strong> (PMP) is a credential offered by the <a title="Project Management Institute" href="http://en.wikipedia.org/wiki/Project_Management_Institute">Project Management Institute</a> (PMI).</p>
<p>The PMP exam is based on the <em>PMP Examination Specification</em>, which describes tasks out of six <em>Performance Domains</em>:</p>
<ol>
<li>Initiating the Project (11%)</li>
<li>Planning the Project (23%)</li>
<li>Executing the Project (27%)</li>
<li>Monitoring and Controlling the Project (21%)</li>
<li>Closing the Project (9%)</li>
<li>Professional and Social Responsibility (9%)</li>
</ol>
<p>The exam consists of 200 multiple choice questions written against this specification. The numbers in parentheses describe the percentage of questions for each domain.</p>
<p>If you are in the preparing for PMP Certification , make sure you practice out this excellent <a href="http://www.skill-guru.com/skill/login/testDetails.faces?testId=62&amp;testName=PMP-Certification-practiceTest">PMP Certification Practice Test</a> by Amit.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/03/19/pmp-certification-practice-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET 4.0 and AJAX Tutorial</title>
		<link>http://www.skill-guru.com/blog/2010/01/27/asp-net-4-0-and-ajax-tutorial/</link>
		<comments>http://www.skill-guru.com/blog/2010/01/27/asp-net-4-0-and-ajax-tutorial/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 05:39:43 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1599</guid>
		<description><![CDATA[Introduction
AJAX, ‘Old wine in a new bottle’. Puzzled!  Absolutely right. AJAX was with us for a long time, until we realized its true potentials. Lets take a very close example and we use it in our everyday life. Google? Yes, very true. Google was very early mover in AJAX arena and showed the world, web [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p><strong style="color: black; background-color: #a0ffff;">AJAX</strong>, ‘Old wine in a new bottle’. Puzzled!  Absolutely right. <strong style="color: black; background-color: #a0ffff;">AJAX</strong> was with us for a long time, until we realized its true potentials. Lets take a very close example and we use it in our everyday life. Google? Yes, very true. Google was very early mover in <strong style="color: black; background-color: #a0ffff;">AJAX</strong> arena and showed the world, web applications close to desktop applications. People were so fascinated with desktop applications that there was an urgent need of such ‘Avatar’.  Suppose you are in the middle of filling a user registration page. You fill all the necessary information and hit the register button. Err..it says “Username already exists. Please try again”. You tried once, twice, thrice and so many times and after page refreshes it is showing the same message. Well, application does not have any choice but to display this error message. But now we can take off the pain and show something interactive, a user may like. Major websites will allow you to enter the username, but at the same time they will be able to tell you if this username has been taken out and without page refresh. That is <strong style="color: black; background-color: #a0ffff;">AJAX</strong>. Most close example. Try typing words in Google search box and it will show you an array of suggestions. This is just a tip of iceberg. Believe me, you can create a very rich web based application by allowing <strong style="color: black; background-color: #a0ffff;">AJAX</strong> to come into your life.</p>
<p><strong>Topics We Will Cover</strong></p>
<p>(1)    What is <strong style="color: black; background-color: #a0ffff;">AJAX</strong><br />
(2)    Why to use <strong style="color: black; background-color: #a0ffff;">AJAX</strong><br />
(3)    <strong style="color: black; background-color: #a0ffff;">AJAX</strong> nomenclatures<br />
(4)    <strong style="color: black; background-color: #a0ffff;">AJAX</strong> with <strong style="color: black; background-color: #ffff66;">ASP.NET</strong> 4.0 (.NET 4.0 framework is still in beta but a lot to offer)<br />
(5)    Future of <strong style="color: black; background-color: #a0ffff;">AJAX  <span id="more-1599"></span><br />
</strong></p>
<p>At the end of the post , you will find the link to download the code for all the examples demonstrated here.</p>
<p><span id="more-1565"> </span><strong>What is <strong style="color: black; background-color: #a0ffff;">AJAX</strong></strong></p>
<p><strong style="color: black; background-color: #a0ffff;">AJAX</strong> = Asynchronous JavaScript and XML.<br />
It is based on JavaScript and HTTP requests.<br />
You may ask, is this a new programming language? No, it is a new way to use existing standards.  It is a way of creating better, faster and more interactive web applications. <strong style="color: black; background-color: #a0ffff;">AJAX</strong> can directly communicates to the server and without page refresh.  It uses asynchronous data transfer (we say it, HTTP requests) between the browser and web server.  In this tutorial, we will create an application with <strong style="color: black; background-color: #a0ffff;">AJAX</strong> support on .NET 4.0 (it is still in beta but a lot to offer).  <strong style="color: black; background-color: #a0ffff;">AJAX</strong> is all about making rich and user friendly web applications.</p>
<p><strong>Why to use <strong style="color: black; background-color: #a0ffff;">AJAX</strong></strong></p>
<p>I am sure, after reading the reasons; you will definitely plan to use <strong style="color: black; background-color: #a0ffff;">AJAX</strong> in your web applications. Let’s take a very conventional example of submitting a form to the web server or getting the information of the submitted data.  In the conventional scenario, you fill some form, validate the inputs and submit the form. We wait for the server to respond and new page to load. This way application may run slowly and will have less use friendly experience. Now integrate our ‘Avatar’ in our web application. Our new ‘Avatar’ will directly talk with the server and process the information in the background and it is too fast.  With <strong style="color: black; background-color: #a0ffff;">AJAX</strong> we can make or get the request from the server without page reload. <strong style="color: black; background-color: #a0ffff;">AJAX</strong> was made popular by Google with its Google suggestion box.  In this tutorial we will develop Google suggestion sort of thing and I am sure once you finish with this tutorial, you will have every reason to use <strong style="color: black; background-color: #a0ffff;">AJAX</strong> in your web applications.</p>
<p><strong><strong style="color: black; background-color: #a0ffff;">AJAX</strong> Nomenclature</strong></p>
<p><strong style="color: black; background-color: #a0ffff;">AJAX</strong> use the XMLHttpRequest object. By using the XMLHttpRequest object, we can update a page with data from the server after the page has loaded.  ‘Google Suggest’ is using the XMLHttpRequest object to create a very dynamic web experience. When we start typing in Google’s search box, a JavaScript sends the letters off to a server and the server returns a list of suggestions. And good news is The XMLHttpRequest object is supported in all major browsers (Internet Explorer, Firefox, Chrome, Opera, and Safari).  XMLHttpRequest is the core of making <strong style="color: black; background-color: #a0ffff;">AJAX</strong> web applications. Let’s examine how it works. Before we move ahead, I expect you are familiar with basic HTML and Javascript. Since <strong style="color: black; background-color: #a0ffff;">AJAX</strong> is written in javascript, so have a look at the basic example, how it communicate with the server.</p>
<p>(1)    &lt;head&gt;<br />
(2)    &lt;script&gt;<br />
(3)    function loadXMLDoc(url)<br />
(4)    {<br />
(5)    if (window.XMLHttpRequest)<br />
(6)    {// code for IE7+, Firefox, Chrome, Opera, Safari<br />
(7)    xmlhttp=new XMLHttpRequest();<br />
(8)    }<br />
(9)    else<br />
(10){// code for IE6, IE5<br />
(11)xmlhttp=new ActiveXObject(”Microsoft.XMLHTTP”);<br />
(12)}<br />
(13)xmlhttp.open(”GET”,url,false);<br />
(14)xmlhttp.send(null);<br />
(15)document.getElementById(’suggestion’).innerHTML=xmlhttp.responseText;<br />
(16)}<br />
(17)&lt;/script&gt;<br />
(18)&lt;/head&gt;</p>
<p>That’s all we needed to communicate with the server. Now server will obey our instructions and will respond t our requests.  Now let’s understand the above code. As I said earlier, core is XMLHttpRequest and it comes in built with the modern browsers.</p>
<p>Line 3 is very simple approach to pass an URL with javascript function loadXMLDoc.</p>
<p>Line 5 detects the browser is being used. There is some tweak, how it behaves with IE7+, Firefox, Chrome, Opera and Safari browser and with IE6 and IE5.  Nothing fancy.</p>
<p>Line 7 and 9, create and initializes the XMLHttpRequest  object.</p>
<p>Line 13 open() method takes 3 parameters. First one is the type of communication we want to perform with web server. So if you want to get some data from web server, use ‘GET’ else use ‘POST’.  Second parameter takes the server URL to whom you want to communicate. The third parameter  specifies, if the request should be handled asynchronously. You will stop by and ask, ‘Hey what dose it mean?’. Well, it can have two values. Either true or false.  False tells the XMLHttpRequest object to wait until the server request is completed before next statement is executed.  For small applications and simple server request, this seems to be ok. But if the request takes a long time or cannot be served, this might cause your web application to hang or stop.  Using True, the third parameter, you tell the XMLHttpRequest object to continue the execution after the request to the server has been sent.  And since we cannot simply start using the response from the server request before we are sure the request has been completed, we need to set the onreadystatechange property of the XMLHttpRequest, to a function (or name of a function) to be executed after completion.  In this onreadystatechange function we test the readyState property before we can use the result of the server call. So, lets make a slight modification to our above code.</p>
<p>&lt;head&gt;<br />
&lt;script type=”text/javascript”&gt;<br />
function loadXMLDoc(url)<br />
{<br />
if (window.XMLHttpRequest)<br />
{// code for IE7+, Firefox, Chrome, Opera, Safari<br />
xmlhttp=new XMLHttpRequest();<br />
}<br />
else<br />
{// code for IE6, IE5<br />
xmlhttp=new ActiveXObject(”Microsoft.XMLHTTP”);<br />
}<br />
xmlhttp.onreadystatechange=function()<br />
{<br />
if(xmlhttp.readyState==4)<br />
{document.getElementById(’suggestion’).innerHTML=xmlhttp.responseText}<br />
}<br />
xmlhttp.open(”GET”,url,true);<br />
xmlhttp.send(null);<br />
document.getElementById(’suggestion’).innerHTML=xmlhttp.responseText;<br />
}<br />
&lt;/script&gt;<br />
&lt;/head&gt;</p>
<p>Another question, what this readyState is? Well, this property holds the status of the server’s response.</p>
<p>State     Description<br />
0              The request is not initialized<br />
1              The request has been set up<br />
2              The request has been sent<br />
3              The request is in process<br />
4              The request is complete</p>
<p>Now, enough theory. Let’s make a Google suggest kind of stuff and get an understanding, how <strong style="color: black; background-color: #a0ffff;">AJAX</strong> works.</p>
<p><strong><strong style="color: black; background-color: #a0ffff;">AJAX</strong> with <strong style="color: black; background-color: #ffff66;">ASP.NET</strong> 4.0 (.NET 4.0 framework is still in beta but a lot to offer)</strong></p>
<p>We are going to use .NET 4.0 framework to show our demo of <strong style="color: black; background-color: #a0ffff;">AJAX</strong> using VS.NET 2010 Express (Beta).  If you do not have VS.NET 2010 Express (Beta), you can download it from <a onclick="javascript:pageTracker._trackPageview('/outbound/article/http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx');" href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx">http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx</a>. Remember .NET 4.0 has not been made public yet . Microsoft plans to make it public in March 2010. You can develop this demo in any serve side script you prefer.  Since I use .NET, ROR (Ruby on Rails) &amp; PHP for my web development and since now I am playing a lot with new .NET 4.0, I planned to show the demo in VS.NET 2010 Express.  Before we start developing our Google suggest demo, I would like to make it clear that we can create <strong style="color: black; background-color: #a0ffff;">AJAX</strong> based application in various way and that depends on the technology &amp; IDE you are using. Though we will using VS.NET 2010 (Beta) for our demo, I have taken an approach which will work with all the serve side technologies with little alteration of syntaxes. Let’s design what we will be in need of:</p>
<p>(1)    A request page – default.aspx<br />
(2)    A URL to call which will return the output – search.aspx<br />
(3)    VS.NET inbuilt Sql Server 2005 support to create database file in mdf – GSuggest.mdf<br />
(4)    A table in GSuggest.mdf – Suggestion<br />
(5)    A column in Suggestion table – SuggestionText (nchar(100)<br />
(6)    A LINQ to SQL file – SuggestionDB.dbml</p>
<p>Our pseudo code :-</p>
<p>(1)    Default.aspx  is our front page to communicate with web server using <strong style="color: black; background-color: #a0ffff;">AJAX</strong>.<br />
(2)    onKeyUp Javascript event of search text box on Default.aspx, calls the search.aspx page via <strong style="color: black; background-color: #a0ffff;">AJAX</strong>.<br />
(3)    Search.aspx page process the query using LINQ – SQL and returns back the output string. (Assuming only one output for our demo)<br />
(4)    Default.aspx gets the signal from search.aspx and shows the output as we type in the characters.</p>
<p>Let us start building the our application.</p>
<p><strong>(1) </strong><strong>Click      Start-&gt; Microsoft Visual Web Developer Express 2010 – ENU</strong></p>
<p style="text-align: center;"><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic1-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1609" title="pic1-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic1-1024x6401-300x187.jpg" alt="pic1-1024x640" width="300" height="187" /></a></p>
<p><strong>(2) </strong><strong>Click      File-&gt; New Project</strong></p>
<p><strong>Select “Visual C#” from Installed Templates and “<strong style="color: black; background-color: #ffff66;">ASP.NET</strong> Web Application” as application. Give you project a name (AjaxProject in our case) and choose a location to create a project.</strong></p>
<p><strong> </strong></p>
<p style="text-align: center;"><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic2-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1610" title="pic2-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic2-1024x6401-300x187.jpg" alt="pic2-1024x640" width="300" height="187" /></a></p>
<p><strong>(3) </strong><strong>Project will be created. Now right click  “App Data” folder -&gt; Add  -&gt; New Item</strong></p>
<p><strong><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic3-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1611" title="pic3-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic3-1024x6401-300x187.jpg" alt="pic3-1024x640" width="300" height="187" /></a><br />
</strong></p>
<p><!-- Easy AdSense V2.83 --> <!-- Post[count: 2] --></p>
<div style="margin: 12px; text-align: center;"><script type="text/javascript">// <![CDATA[
google_ad_client = "pub-4942221729702985";
/* 234x60 ezAdsense, created 11/25/08 */
google_ad_slot = "8050392339";
google_ad_width = 234;
google_ad_height = 60;
// ]]&gt;</script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script><script type="text/javascript">// <![CDATA[
google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);
// ]]&gt;</script><ins style="border: medium none; margin: 0pt; padding: 0pt; display: inline-table; height: 60px; position: relative; visibility: visible; width: 234px;"><ins style="border: medium none; margin: 0pt; padding: 0pt; display: block; height: 60px; position: relative; visibility: visible; width: 234px;"></ins></ins></div>
<p style="text-align: center;">
<p><strong>(4) </strong><strong>Select “Data” from installed templates and “Sql Server Database”. Give your database a name (GSuggest in our case).</strong></p>
<p><strong><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic4-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1612" title="pic4-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic4-1024x6401-300x187.jpg" alt="pic4-1024x640" width="300" height="187" /></a><br />
</strong></p>
<p style="text-align: center;">
<p><strong>(5) </strong><strong>Database created. Now go to “Database Explorer” and browse GSuggest.mdf database. Right click on it and choose “Add New Table”</strong></p>
<p style="text-align: center;"><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic5-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1613" title="pic5-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic5-1024x6401-300x187.jpg" alt="pic5-1024x640" width="300" height="187" /></a></p>
<p><strong>(6) </strong><strong>Create a Column called “SuggestionText”  and data type as NCHAR(100).  Save this table as “Suggestion”.</strong></p>
<p><strong> </strong></p>
<p><strong>(7) </strong><strong>Now right click on project -&gt; Add -&gt; New Item. </strong></p>
<p><strong><br />
</strong></p>
<p style="text-align: center;"><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic71-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1619" title="pic71-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic71-1024x6401-300x187.jpg" alt="pic71-1024x640" width="300" height="187" /></a></p>
<p><strong>(8) </strong><strong>Select “Data” as installed templates and “LINQ to SQL class” from middle. Give your dbml file name as SuggestionDB.dbml</strong></p>
<p><strong><br />
</strong></p>
<p><strong> </strong></p>
<p style="text-align: center;"><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic8-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1614" title="pic8-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic8-1024x6401-300x187.jpg" alt="pic8-1024x640" width="300" height="187" /></a></p>
<p><strong>(9) </strong><strong>Drag and drop the Suggestion table from database explorer to SuggestionDB.dbml file</strong></p>
<p style="text-align: center;"><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic9-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1615" title="pic9-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic9-1024x6401-300x187.jpg" alt="pic9-1024x640" width="300" height="187" /></a></p>
<p>(10)<strong>Add following code in your Default.aspx file.</strong></p>
<p><strong> </strong><br />
&lt;%@ Page Title=”Home Page” Language=”C#” MasterPageFile=”~/Site.master” AutoEventWireup=”true”<br />
CodeBehind=”Default.aspx.cs” Inherits=”AjaxProject._Default” %&gt;<br />
&lt;asp:Content ID=”HeaderContent” runat=”server” ContentPlaceHolderID=”HeadContent”&gt;<br />
&lt;/asp:Content&gt;<br />
&lt;asp:Content ID=”BodyContent” runat=”server” ContentPlaceHolderID=”MainContent”&gt;<br />
&lt;script type=”text/javascript”&gt;<br />
var xmlhttp = null;<br />
function ShowSuggestions(str) {<br />
if (str.length == 0) {<br />
document.getElementById(”txtHint”).innerHTML = “”;<br />
return;<br />
}<br />
if (window.XMLHttpRequest) {<br />
// code for IE7+, Firefox, Chrome, Opera, Safari<br />
xmlhttp = new XMLHttpRequest();<br />
}<br />
else {<br />
// code for IE6, IE5<br />
xmlhttp = new ActiveXObject(”Microsoft.XMLHTTP”);<br />
}<br />
var url = “Search.aspx?q=” + str;<br />
xmlhttp.open(”GET”, url, false);<br />
xmlhttp.send(null);<br />
document.getElementById(”txtHint”).innerHTML = xmlhttp.responseText;<br />
}<br />
&lt;/script&gt;<br />
&lt;h2&gt;<br />
Welcome to <strong style="color: black; background-color: #ffff66;">ASP.NET</strong> <strong style="color: black; background-color: #a0ffff;">AJAX</strong>!<br />
&lt;/h2&gt;<br />
&lt;input type=”text” id=”txt1″ onkeyup=”ShowSuggestions(this.value)” /&gt;<br />
&lt;p&gt;Suggestions: &lt;span id=”txtHint”&gt;&lt;/span&gt;&lt;/p&gt;<br />
&lt;/asp:Content&gt;</p>
<p>Above code is very easy to understand. We are taking one input box and one txtHint span. Text box is supposed to take the input from user whereas txtHint span will render the suggestions. Please examine the input box carefully. We have used a javascript function ShowSuggestion which passes input text value id to the function. Now we already know, how to call the server using <strong style="color: black; background-color: #a0ffff;">AJAX</strong>. We are taking Search.aspx page as a parameter in open method and one additional “q” parameter. Q is nothing but the parameter name for GET and we pass the input text value. As we type in this Javascript function will be called and it sends its request to search.aspx page with necessary parameter and renders the “Suggestion”.</p>
<p>(11)<strong>Now let’s write some code is search.aspx code behind which is suppose feed us the output.</strong></p>
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;</p>
<p>namespace AjaxProject<br />
{<br />
public partial class Search : System.Web.UI.Page<br />
{<br />
private SuggestionDBDataContext db = new SuggestionDBDataContext();<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
var sugtext = db.Suggestions;<br />
string suggestion = (from sgText in sugtext<br />
where sgText.SuggestionText.StartsWith(Request.QueryString["q"])<br />
select sgText.SuggestionText).FirstOrDefault();<br />
if (string.IsNullOrEmpty(suggestion))<br />
Response.Write(”No Suggestion Found”);<br />
else<br />
Response.Write(suggestion);<br />
Response.End();<br />
}<br />
}<br />
}</p>
<p>Let’s understand the code above. To access our table Suggestion we created a couple of minutes back, we need to connect to the database and call the Suggestion table and query if it has some data starts with the text entered in the input box (Default.aspx has sent its request). Well, Microsoft is doing enough for developers to reduce the development time. Have you realized that when we created out dbml file and dropped Suggestion table on it, it automatically creates the connection string and saved it into web.config file?  Yes, it has. So no need to explicitly define the database connection. We just have to instantiate the context created in dbml file. Since this not a tutorial on <strong style="color: black; background-color: #ffff66;">ASP.NET</strong>, so I will not explain context and other things. It may occupy a whole book if I need to write about it. You can always google around and find. The code will remain same for the developers who are working on VS.NET 2008 (.NET 3.5 framework) . Ok enough theory. Let’s understand our code we just wrote. Since we can write direct SQL code using LINQ to SQL, so we followed the same path. We just accessed the Suggestion table through sugtext and applied LIKE query (StartWith) with our input entered.</p>
<p>(from sgText in sugtext<br />
where sgText.SuggestionText.StartsWith(Request.QueryString["q"])<br />
select sgText.SuggestionText).FirstOrDefault();</p>
<p>Please study the above code very carefully. We just wrote a SQL query using LINQ to SQL and got our Suggestion.  Since we may or may not get the suggestion stored in the Suggestion table, so we are checking whether it is null or not.</p>
<p>if (string.IsNullOrEmpty(suggestion))<br />
Response.Write(”No Suggestion Found”);<br />
else<br />
Response.Write(suggestion);<br />
Response.End();</p>
<p>Finally we are returning back the output in our Default.aspx page using Response.Write. You may come across the below screens.</p>
<p><strong>Input matches</strong></p>
<p><strong><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic10-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1616" title="pic10-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic10-1024x6401-300x187.jpg" alt="pic10-1024x640" width="300" height="187" /></a><br />
</strong></p>
<p style="text-align: center;">
<p><strong>Input does not matches</strong></p>
<p><strong><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic11-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1617" title="pic11-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic11-1024x6401-300x187.jpg" alt="pic11-1024x640" width="300" height="187" /></a><br />
</strong></p>
<p style="text-align: center;">
<p>Yes, so simple. In fact we can trace your javascript code in VS.NET 2010 to see the entire process. Just set the breakpoints and run your application.</p>
<p><a href="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic12-1024x6401.jpg"><img class="aligncenter size-medium wp-image-1618" title="pic12-1024x640" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/pic12-1024x6401-300x187.jpg" alt="pic12-1024x640" width="300" height="187" /></a></p>
<p style="text-align: center;">
<p>Microsoft has come up with UI ToolKit called <strong style="color: black; background-color: #a0ffff;">AJAX</strong> toolkit. You can navigate this link <a onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.codeplex.com/AjaxControlToolkit');" href="http://www.codeplex.com/AjaxControlToolkit">http://www.codeplex.com/AjaxControlToolkit</a> and can play with it. Using AJAXToolkit you can create a world class web application with very rich user interface.</p>
<p><strong>Future of <strong style="color: black; background-color: #a0ffff;">AJAX</strong></strong></p>
<p>Well, <strong style="color: black; background-color: #a0ffff;">AJAX</strong> future is very promising and a lot of web applications are around for which we can feel proud. Social networks web application, corporate intranet applications, interaction with Microsoft Virtual Earth to name a few. I am sure by this time you want to go back and get your hands dirty with <strong style="color: black; background-color: #a0ffff;">AJAX</strong>. So what are you waiting for? Go and make rich UI web application with <strong style="color: black; background-color: #a0ffff;">AJAX</strong> and learn its true power.</p>
<p><a onclick="javascript:pageTracker._trackPageview('/downloads/blog/wp-content/uploads/2010/01/AjaxProject.zip');" href="../wp-content/uploads/2010/01/AjaxProject.zip">Download the example code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/01/27/asp-net-4-0-and-ajax-tutorial/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>ASP.NET Interview questions</title>
		<link>http://www.skill-guru.com/blog/2010/01/05/asp-net-interview-questions/</link>
		<comments>http://www.skill-guru.com/blog/2010/01/05/asp-net-interview-questions/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 19:55:57 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Interview questions]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1366</guid>
		<description><![CDATA[If you are going to appear for ASP.Net Interview , make sure you practice out the free tests at Skill-Guru
ASP .Net Interview questions
ASP.Net Chart Control Interview questions
C# Interview questions
And if you are looking for tutorials
ASP .net Tutorial &#8211; part 1
ASP .net Tutorial &#8211; part 2
]]></description>
			<content:encoded><![CDATA[<p>If you are going to appear for ASP.Net Interview , make sure you practice out the free tests at <a href="http://www.skill-guru.com">Skill-Guru</a></p>
<p><a href="http://www.skill-guru.com/skill/login/testDetails.faces?testId=42&amp;testName=ASP.Net-Interview-questions">ASP .Net Interview questions</a></p>
<p><a href="http://www.skill-guru.com/skill/login/testDetails.faces?testId=55&amp;testName=ASP.NET-Chart-Control-Quiz">ASP.Net Chart Control Interview questions</a></p>
<p><a href="http://www.skill-guru.com/skill/login/testDetails.faces?testId=43&amp;testName=C#-Interview-questions">C# Interview questions</a></p>
<p>And if you are looking for tutorials</p>
<p><a href="http://www.skill-guru.com/blog/2009/11/12/beginners-tutorial-for-programming-with-asp-net-part-i/">ASP .net Tutorial &#8211; part 1</a></p>
<p><a href="http://www.skill-guru.com/blog/2009/11/12/beginner%E2%80%99s-tutorial-for-programming-with-asp-net-part-ii/">ASP .net Tutorial &#8211; part 2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/01/05/asp-net-interview-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>State Management in ASP.NET</title>
		<link>http://www.skill-guru.com/blog/2010/01/04/state-management-in-asp-net/</link>
		<comments>http://www.skill-guru.com/blog/2010/01/04/state-management-in-asp-net/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 17:11:21 +0000</pubDate>
		<dc:creator>Arunava</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1346</guid>
		<description><![CDATA[Introduction
For any HTTP based protocol it is true that Web Forms are stateless and for each new request to the web server web pages are destroyed and recreated. As a result we do not get page information beyond the life cycle of a single page. State is the ability of a web application to retain [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>For any HTTP based protocol it is true that Web Forms are stateless and for each new request to the web server web pages are destroyed and recreated. As a result we do not get page information beyond the life cycle of a single page. State is the ability of a web application to retain user information and therefore state management becomes an important issue in developing web application.</p>
<p><strong>Objectives</strong></p>
<p>The main objective of this tutorial is to show how the state is managed in ASP.NET Web application. Through this tutorial we have tried to cover:<br />
• State Management and different types of available options in ASP.NET<br />
• Use of Session, Application and Cache variables to manage server state<br />
• Use of Cookies, QueryString, Hidden Field and ViewState to manage client state<span id="more-1346"></span></p>
<p><strong>State management and its different options</strong></p>
<p>ASP.NET provides state management which saves information within the round trip of page between the server and user’s machine and as a result the information entered by the user can be reused. Please have a look on Figure-1 which clearly shows the difference between state management and without state management.</p>
<div id="attachment_1347" class="wp-caption aligncenter" style="width: 475px"><img class="size-full wp-image-1347" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/Figure-1.jpg" alt=".Net Tutorial" width="465" height="497" /><p class="wp-caption-text">Figure-1: Difference between ‘Without State Management’ and ‘With State Management’</p></div>
<p>If state is maintained between pages the information entered originally by an user can be reused in other pages. As shown in Figure-1, user enters his name in Login.aspx page and then the information is sent to the web server so that in the Welcome.aspx page the system can show the same piece of information. But without state management it is not possible.</p>
<p>ASP.NET provides two types of state management, so that information can be maintained between server roundtrips. The types are:</p>
<p>• Server-Side<br />
• Client-Side</p>
<p>User can store state information by using server resources in Server-side management. These options provide higher security than Client-side.</p>
<p>Client-Side state management is simple and has minimal security and does not use server resources to store state information.</p>
<p>Different options are available for both Server -side and Client-side state management. <strong>First we discuss on the available options for Server-side state management.</strong></p>
<h3><strong>1.Application State:</strong></h3>
<p>Application state is a key value dictionary structure that is created during each request to the web pages in a web server. ASP.NET provide instance of HttpApplicationState class for each web application to store the application state.<br />
User can use the Application object to share information among all users of a particular Web application. The Application object is not global to the machine. It is global to HttpApplicaton.</p>
<p>User should prevent the other users or applications to update the Application variables when he/she is modifying it. ASP.NET provides two methods Application.Lock() and Application.UnLock() which can be used to prevent concurrent multiple access of the application variable.</p>
<p>Here we provide a small example about the use of application variables:</p>
<p>Application.Lock(); //Locking the Application variables<br />
Application[“TotalMember”]=int.parse(Application[“TotalMember”].ToString())+1; //Modifying it<br />
Application.UnLock(); //Unlocking the variables</p>
<p>//Retrieving Application variable’s value<br />
LabelCount.Text=”You are member number:“ +Application[“TotalMember “].ToString();</p>
<h3><strong>2.Session State with asp.net<br />
</strong></h3>
<p>In Session state, information is available only to a user of a particular session of a web application. HTTPSessionState class in ASP.NET provides session state. Session state is limited to the current browser session. For example if many users are using a web application then every user will get different session state. This session state is available until the user leaves the application.</p>
<p>Like application state session state is also structured as a key value dictionary structure and it is used to store session specific information which is useful between request for pages and round trip to the web server.ASP.NET provides the session variables that are needed to maintain session state. Generally short lived, sensitive data important for a specific session is stored in session state.</p>
<p>We can identify each active web application session by using a 120 bit Session ID which is formed of ASCII characters and allowed in the URLs.</p>
<p>If a user has not requested a page for more than 20 minutes by default session time out occurs. So if the same user returns back after 20 minutes , he/she will be considered as new user by the web application. But we can modify the session duration in the Web Configuration file. The following is the code in Web.Config file that sets the session duration 30 minutes:</p>
<p>In below we have just written two lines to add and retrieve values from session variables:</p>
<p>Session[“PersonName”]=”Scott”; //Storing name in session variable</p>
<p>Label1.Text=”Welcome Mr.”+ Session[“PersonName”].ToString(); //Retrieving the data</p>
<h3><strong>3. The Cache object in asp.net<br />
</strong></h3>
<p>The Cache object can be used to store information that we can also be stored in application variables. But for each Web Application ASP.NET creates a single Cache object and the items stored in the Cache object cannot be used by other web applications running on the same web server. Thus rather than recreating the value each time, a single cached value can be accessed by any page in the web application.</p>
<p>The Cache object uses key-value pairs to store and retrieve objects. Like dictionary we can add item in a cache object. Here a simple example is shown:</p>
<p>Cache[“PersonName”]=”Scott” ; // Add item in Cache object</p>
<p>Label1.Text=”Welcome Mr.”+ Cache[“PersonName”].ToString(); // Retrieve information from Cache</p>
<p>Like application object Cache object provides automatic lock management on items that are stored in Cache object. As a result users can not modify Cache objects concurrently.</p>
<p>Cache object is made to ensure that the web application does not use server memory much. As a result the Cache object automatically removes the least used items when there is a shortage of server’s memory. Users can set priority on Cache items. So items with higher priority are less likely to be removed from the Cache. The detail on Cache object is out of scope of this tutorial.</p>
<h3>Client side state management</h3>
<p>Client side state management also has different options to store sate or information. The options are discussed below:</p>
<p><strong>1.Cookies</strong></p>
<p>A cookie is a text file that store small amount of information. The text file is stored on the file system of the client computer or in the memory of client browser session. Generally a cookie contains page specific information and also the information of the domain that issued the cookie.</p>
<p>We can classify cookies in two types:<br />
a.Temporary<br />
b.Persistent</p>
<p>Temporary cookies (non-persistent) exist only in the memory of a browser and as a result information added in temporary cookies are lost when the browser is shut down.</p>
<p>Persistent cookies have a defined expiration period and these type of cookies are stored in user’s hard disk. Users can delete the cookies before the cookie expires. So there is no assurance on the life span of persistent cookies created in user’s machine.</p>
<p>Users should take care of the following things to store information in cookies:</p>
<p>• Cookies can be stolen and faked. So find out different option before storing secured information in cookies.<br />
• Users can not store information more than 4KB in a cookie. So cookie has size restriction.<br />
• Cookies cannot be trusted and users need to cross validate the data retrieved from a cookie.</p>
<p><strong>2. Query Strings</strong></p>
<p>Through query string navigation specific data can be passed and this information is appended to the end of a URL. A typical example might look like the following:</p>
<p>http://abc.com/ItemList.aspx?category=watch&amp;type=ladies</p>
<p>Above in the URL path, the query string starts with the question mark (?) and contains two attribute-value pairs: category and type. Information can be retried from the query string like the following:</p>
<p>Label1.Text=”Items of category ”+Request.QueryString[“category”].ToString()+” are displayed”;</p>
<p>But please remember that query string is the most hackable element on a web site. Users can play with it by changing values and may enter in the restricted pages. A good idea is to return Response.StatusCode=404 when someone changes a URL to an unreasonable value.</p>
<p><strong>3.Hidden Fields</strong></p>
<p>Hidden input fields are sent back as name-value pairs in a Form POST exactly like any other control , except they are not rendered. They are like hidden text boxes. Figure-2 shows a Hidden Field control with the available properties in Visual Studio:</p>
<div id="attachment_1350" class="wp-caption aligncenter" style="width: 475px"><img class="size-full wp-image-1350" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/Figure-2.jpg" alt=".Net Tutorial" width="465" height="305" /><p class="wp-caption-text">Figure-2: Hidden Field and its Properties</p></div>
<p>When this control is drag and dropped in the test page the following line is also added in the source section.</p>
<p>&lt;asp:HiddenField ID=&#8221;HiddenField1&#8243; runat=&#8221;server&#8221; /&gt;</p>
<p>Now add a string value in this hidden field as shown in Figure-3:</p>
<div id="attachment_1354" class="wp-caption aligncenter" style="width: 451px"><img class="size-full wp-image-1354" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/Figure-3.jpg" alt=".Net Tutorial" width="441" height="142" /><p class="wp-caption-text">Figure-3: Add a string value in the Hidden Field</p></div>
<p>When we run the page we will find the value is added in the HTML code like Figure-4:</p>
<div id="attachment_1355" class="wp-caption aligncenter" style="width: 475px"><img class="size-full wp-image-1355" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/Figure-4.jpg" alt=".Net Tutorial" width="465" height="335" /><br />
<p class="wp-caption-text">Figure-4: HTML code changed for the Hidden Field</p></div>
<p><strong>4. View State</strong></p>
<p>Web forms provide the ViewState property as a built-in structure for automatically retaining values between multiple requests for same page. ViewState exposes itself as a collection of key/value pairs but renders itself as a hidden field with the name “__VIEWSTATE “ (Shown in Figure-5)</p>
<div id="attachment_1356" class="wp-caption aligncenter" style="width: 475px"><img class="size-full wp-image-1356" src="http://www.skill-guru.com/blog/wp-content/uploads/2010/01/Figure-5.jpg" alt="Figure-5:  ViewState and its value" width="465" height="335" /><p class="wp-caption-text">Figure-5:  ViewState and its value</p></div>
<p>View state can store both simple and complex type objects. We can simply add values in ViewState like the following:</p>
<p>ViewState["Name"] = &#8220;Scott&#8221;;</p>
<p>Note that ViewState value uses only valid ASCII characters to represent all its contents. It is big and appears to be opaque. Viewstate is not acceptable for any kind of sensitive data.</p>
<p><strong>Conclusion</strong></p>
<p>ASP.NET provides lots of functions and utilities (which we discussed in our tutorial above) to store page state in an efficient and effective manner. Choosing among the options will depend on the web application but we should think about the following points before making the choice:<br />
• Amount of information we need to store<br />
• Sensitivity of the information<br />
• Performance expectation from the pages</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2010/01/04/state-management-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Web Services with ASP .NET- Part-II</title>
		<link>http://www.skill-guru.com/blog/2009/12/13/web-services-with-asp-net-part-ii/</link>
		<comments>http://www.skill-guru.com/blog/2009/12/13/web-services-with-asp-net-part-ii/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 18:02:20 +0000</pubDate>
		<dc:creator>Arunava</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1212</guid>
		<description><![CDATA[This is second part of the tutorial &#8216;Web Services with ASP.NET&#8217;. Please go through Web Services with ASP.NET&#8211;Part-I before you continue further.
Consuming a XML Web Service
Exposing data and logic as SOAP to disparate systems across the world becomes simple with the help of ASP.NET. But users are not limited to consuming XML Web services only [...]]]></description>
			<content:encoded><![CDATA[<p>This is second part of the tutorial &#8216;Web Services with ASP.NET&#8217;. Please go through <a href="http://www.skill-guru.com/blog/2009/12/13/web-services-with-asp-net-part-i">Web Services with ASP.NET&#8211;Part-I</a> before you continue further.</p>
<p><strong>Consuming a XML Web Service</strong></p>
<p>Exposing data and logic as SOAP to disparate systems across the world becomes simple with the help of ASP.NET. But users are not limited to consuming XML Web services only into ASP.NET application. Web Services can be consumed in Windows forms, mobile applications, databases and more. But here we show the example of how to consume a web service from a .net based web application. Again we are describing the whole process step by step. <span id="more-1212"></span></p>
<p>1. Create a new Web site by selecting File-&gt;New-&gt;Web Site from the IDE. When the New Web Site dialog opens , select the ASP.NET Web Site and name it ‘BindWebService’ as shown in Figure-9:</p>
<div id="attachment_1213" class="wp-caption aligncenter" style="width: 459px"><img class="size-medium wp-image-1213" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-9-300x193.jpg" alt=".Net chart tutorial" width="449" height="218" /><p class="wp-caption-text">Figure-9: Creating Web Site ‘BindWebService’</p></div>
<p>2. To consume the web service ‘TestService’ that we have already created right click on the project in the solution explorer of ‘BindWebService’ and select ‘Add Reference’ as shown in Figure-10:</p>
<div id="attachment_1214" class="wp-caption aligncenter" style="width: 281px"><img class="size-medium wp-image-1214" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-10-158x300.jpg" alt=".Net chart tutorial" width="271" height="337" /><p class="wp-caption-text">Figure-10: ‘Add Web Reference’ in the project</p></div>
<p>3. This pulls up the Add Web Reference dialog box as shown in Figure-11</p>
<div id="attachment_1215" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1215" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-11-300x208.jpg" alt=".Net chart tutorial" width="300" height="208" /><p class="wp-caption-text">Figure-11: ‘Add Web Reference’ Dialog Box</p></div>
<p>This dialog box enables users to point to a particular .asmx file to make a reference.</p>
<p>4. Now write down the URL of our created web service and click on ‘GO’. It will automatically find out the proper web service from localhost (as our test web service is in local machine).Now  give the Web reference name as ‘MyService’ and then click on ‘Add Reference’ (Figure-12).When any third party wants to use our service he/she needs to mention the proper URL to fetch it (i.e http://abc.com/TestService/Service.asmx where abc.com is the server in which the web service is deployed for hosting)</p>
<div id="attachment_1216" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1216" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-12-300x208.jpg" alt=".Net chart tutorial" width="300" height="208" /><p class="wp-caption-text">Figure-12: Adding the proper web reference and rename it accordingly</p></div>
<p>5. Clicking the ‘Add Reference’ button causes Visual Studio to make an actual reference to the web service and we will find some additional files (web service’s WSDL file) as shown in Figure-13.<br />
The application’s web.config file also contains the reference to the web service in its  section.</p>
<div id="attachment_1217" class="wp-caption aligncenter" style="width: 267px"><img class="size-full wp-image-1217" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-13.jpg" alt=".Net chart tutorial" width="257" height="240" /><p class="wp-caption-text">Figure-13: Web service reference and additional files within solution explorer</p></div>
<p>6. Now we will show how to utilize web methods in our ‘BindWebService’ application.  In the ‘Default.aspx’ page add the code as shown in Figure-14:</p>
<div id="attachment_1218" class="wp-caption aligncenter" style="width: 749px"><img class="size-medium wp-image-1218" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-14-300x176.jpg" alt=".Net chart tutorial" width="739" height="407" /><p class="wp-caption-text">Figure-14: Source code for Default.aspx page  </p></div>
<p>Here we take two text boxes in which user will enter two integers and after pressing the ‘ADD’ button the result (called through the web method) will be displayed at the ‘lblResult’ label.</p>
<p>7. Now from the design window double click on the ‘ADD’ button and this will give us the option to write code in the code behind page for the click event of ‘ADD’. The code is given within Figure-15:</p>
<div id="attachment_1219" class="wp-caption aligncenter" style="width: 698px"><img class="size-medium wp-image-1219" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-15-300x122.jpg" alt=".Net chart tutorial" width="688" height="218" /><p class="wp-caption-text">Figure-15:  Code for Click event of ‘btnAdd’</p></div>
<p>Here first we check the text boxes are blank or not. If any of them is blank the system will through an error message. Otherwise when the end user clicks the ‘ADD’ button after providing two integers , the application sends a SOAP request to the remote XML web service with the two input values as parameters and gets back a SOAP response containing the result (return value of ‘add’ web method). Proper parsing is required as we are converting string to integer (for arguments) and integer to string (for result).</p>
<p>8. So our application is ready for testing. Press ‘F5’ to run the application. Give two integers as input in the text boxes and press ‘ADD’ which will give you the result. Here we test the application for the values 10 and 15 and get the result 25 (shown in Figure-16)</p>
<div id="attachment_1220" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1220" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-16-300x184.jpg" alt=".Net chart tutorial" width="300" height="184" /><p class="wp-caption-text">Figure-16: Desired Output</p></div>
<p>We do not write code for addition in the code behind page and thus the web method ‘add’ for our previously build web service provide the proper result. Hence we can conclude that our application and the web service is working properly.</p>
<p><strong>Summary</strong></p>
<p>Web Services are an integral part of .Net platform and Visual Studio makes building and consuming web service very easy. This tutorial provides you a simple idea of what is web service and how to build it and access it from .Net based web application. This tutorial focuses on the basic functionalities of web service so that the beginners clearly understand the whole procedure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2009/12/13/web-services-with-asp-net-part-ii/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Web Services with ASP .NET- Part I</title>
		<link>http://www.skill-guru.com/blog/2009/12/13/web-services-with-asp-net-part-i/</link>
		<comments>http://www.skill-guru.com/blog/2009/12/13/web-services-with-asp-net-part-i/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 17:27:29 +0000</pubDate>
		<dc:creator>Arunava</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1198</guid>
		<description><![CDATA[Introduction
Web services are a new way of performing remote method calls over HTTP with the use of Simple Object Access Protocol (SOAP) . It becomes very easy for us to use all of this with the help of .Net framework.  This tutorial covers building XML Web services and how we can consume XML Web [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Web services are a new way of performing remote method calls over HTTP with the use of Simple Object Access Protocol (SOAP) . It becomes very easy for us to use all of this with the help of .Net framework.  This tutorial covers building XML Web services and how we can consume XML Web service interfaces and integrate them into ASP.NET applications.  But first we examine what is Web service  some of the underlying technologies such as SOAP, WSDL and more.</p>
<p><strong>Objective</strong></p>
<p>The main objectives of this tutorial are<br />
a.Give a simple idea about XML web service and the backend technologies.<br />
b.How to build XML web service with the help of Visual Studio 2008<br />
c.How to consume the web service within a web application built in .Net<br />
We will cover the first two portions in Part-I of this tutorial and Part-II will cover the remaining portion. <span id="more-1198"></span></p>
<p><strong>What is Web Service?</strong></p>
<p>In short we can define Web service as small units of code which is independent of operating system and programming languages and use XML based communicating protocol.</p>
<p>XML is considered ideal for data representation purpose because it enables developers to structure XML documents. But sending self structured XML documents between dissimilar systems cannot solve the purpose. The industry decided on using SOAP (Simple Object Access Protocol) to make the standard XML structure work. SOAP enables  user to expose and consume complex data structures such as Datasets or Datatables. So actually ASP.NET Web services generally use SOAP over HTTP using the HTTP post protocol.</p>
<p><strong>WSDL (Web Service Description Language)</strong> is another fully XML compliant syntax  and specifies Web services by the available methods, the types used by these methods, the request and response message format sent by the methods via protocols like SOAP,HTTP-GET etc. We can say WSDL completely describes Web services, the available methods and the various ways of calling these methods.</p>
<p><strong>Building a Simple XML Web Service</strong></p>
<p>In this tutorial we use Visual Studio 2008 to build an XML Web service. Like our previous tutorial we will provide step by step procedures to create the application:</p>
<p>1.Create a new Web site by selecting File-&gt;New-&gt;Web Site from the IDE. When the New Web Site dialog opens , select the ASP.NET Web Service and name it ‘TestService’ as shown in Figure-1:</p>
<div id="attachment_1199" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1199" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-1-300x194.jpg" alt=".Net chart tutorial" width="300" height="194" /><p class="wp-caption-text">   Figure-1: Select ASP.NET Web Service and name it ‘TestService’ </p></div>
<p>2. In the solution explorer there is a single XML Web service named Service.asmx and its code-behind file is located in the App_Code folder (Service.cs).</p>
<div id="attachment_1201" class="wp-caption aligncenter" style="width: 218px"><img class="size-full wp-image-1201" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-2.jpg" alt=".Net chart tutorial" width="208" height="294" /><p class="wp-caption-text">Figure-2: Files in Solution Explorer</p></div>
<p>3.Open the Service.asmx file in Visual Studio and you can see the file contains only WebService page directive as shown in Figure-3:</p>
<div id="attachment_1202" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1202" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-3-300x25.jpg" alt=".Net chart tutorial" width="300" height="25" /><p class="wp-caption-text">Figure-3: Webservice directive in Service.asmx page</p></div>
<p>4. Now look at the WebService.cs file—the code behind file for the XML Web. By default a structure of code is already in place in this file. Now  we will add a method which we will from our .Net web application in this Web service. Adding a method accessible through the Web service simply requires defining the method  as public and giving it ‘WebMethod’ attribute.<br />
Here we will include a function called ‘add’ which will take two integers as arguments and simply returns the added output as result.  We will call this function from our .net application Figure-4 shows you the code for that:</p>
<div id="attachment_1203" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1203" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-4-300x184.jpg" alt=".Net chart tutorial" width="300" height="184" /><p class="wp-caption-text">Figure-4: ‘add’ function is added</p></div>
<p>5. Like the ‘WebService’ attribute ‘WebMethod’ can also contain some properties.  Some of them are described in short below:<br />
BufferResponse: When it is set to ‘TRUE’ ,the response from the XML web service is held in memory.<br />
CacheDuration: Specifies the life time (in seconds) of the response in system’s cache<br />
Description:  Add a description for the WebMethod<br />
EnableSession: ‘TRUE’ enables session state for a method. Default setting is ‘FALSE’</p>
<p>6. Running ‘Service.asmx’ in the browser pulls up the ASP.NET Web service test page. This visual interface is really important for the testing purpose. The page generated for the ‘TestService’ web service is shown in Figure-5:</p>
<div id="attachment_1204" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1204" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-5-300x187.jpg" alt=".Net chart tutorial" width="300" height="187" /><p class="wp-caption-text">Figure-5: Exposed web methods for ‘TestService’</p></div>
<p>The interface shows the name of the Web service in the blue bar with white color at the top of the page. By default the name of the class is used and in this case we have not renamed it. A bulleted list of links to all the Web service’s WebMethods is displayed.</p>
<p>7. A link to the Web Services Description Language (WSDL) document is also available with the link titled ‘Service Description’ in the above figure (Figure-5). Everything we need for the request and the response is described in the WSDL document. Figure-6  shows you the WSDL (just click on the ‘Service Description’ to get the WSDL) for the ‘TestService’:</p>
<div id="attachment_1207" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1207" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-6-300x167.jpg" alt=".Net chart tutorial" width="300" height="167" /><p class="wp-caption-text">Figure-6: ‘WSDL’ for ‘TestService’ </p></div>
<p>8. User can test the WebMethod directly from the service.asmx page. Once you click on the ‘add’ method you will find the following screen (Figure-7):</p>
<div id="attachment_1208" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1208" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-7-300x228.jpg" alt=".Net chart tutorial" width="300" height="228" /><p class="wp-caption-text">Figure-7: Testing WebMethod directly from the page</p></div>
<p>As our webmethod ‘add’ requires two input parameters to get a response , we see the two textboxes included in the page. If the webmethod does not require any parameter then there will be only the ‘Invoke’ method.</p>
<p>9. Now put  two integers in the two textboxes respectively (as parameter) and click on the ‘Invoke’ button to send SOAP request to the web server. Here we give a=8 b=7 and invoke the method and it will cause a new browser instance with the result to appear (shown in Figure-8)</p>
<div id="attachment_1209" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1209" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/12/Figure-8-300x123.jpg" alt=".Net chart tutorial" width="300" height="123" /><p class="wp-caption-text">Figure-8: Expected output</p></div>
<p>Now we are sure that our webmethod is working properly and we can consume it in an ASP.NET application. This is discussed in <a href="http://www.skill-guru.com/blog/2009/12/13/web-services-with-asp-net-part-ii/">Web Services with ASP.NET&#8211;Part-II</a> of this tutorial</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2009/12/13/web-services-with-asp-net-part-i/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ASP.Net Chart Control Quiz</title>
		<link>http://www.skill-guru.com/blog/2009/12/02/asp-net-chart-control-quiz/</link>
		<comments>http://www.skill-guru.com/blog/2009/12/02/asp-net-chart-control-quiz/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 21:06:01 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1190</guid>
		<description><![CDATA[Arunava is an experienced .NEt developer with very good knowledge of ASP.Net Chart Control. He has added some very good tutorials on
Microsoft Chart Control Tutorial
Advanced features of ASP .Net Chart Control
Recently he created a quiz on ASP .net Chart control Quiz which you will find helpful to test your knowledge on chart controls.
]]></description>
			<content:encoded><![CDATA[<p>Arunava is an experienced .NEt developer with very good knowledge of ASP.Net Chart Control. He has added some very good tutorials on</p>
<p><a href="http://www.skill-guru.com/blog/2009/11/03/microsoft-chart-control-tutorial/">Microsoft Chart Control Tutorial</a><br />
<a href="http://www.skill-guru.com/blog/2009/11/29/advanced-features-of-net-chart-control/">Advanced features of ASP .Net Chart Control</a></p>
<p>Recently he created a quiz on <a href="http://www.skill-guru.com/skill/login/testDetails.faces?testId=55&amp;testName=ASP.NET-Chart-Control-Quiz">ASP .net Chart control Quiz </a>which you will find helpful to test your knowledge on chart controls.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2009/12/02/asp-net-chart-control-quiz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced features of ASP .Net Chart Control</title>
		<link>http://www.skill-guru.com/blog/2009/11/29/advanced-features-of-net-chart-control/</link>
		<comments>http://www.skill-guru.com/blog/2009/11/29/advanced-features-of-net-chart-control/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 19:55:18 +0000</pubDate>
		<dc:creator>Arunava</dc:creator>
				<category><![CDATA[Programming / tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=1136</guid>
		<description><![CDATA[This is the second part of .Net chart control and this is going to cover some advanced topic. Please go thorugh Microsoft Chart Control Tutorial before you continue this. 
Introduction
In this tutorial we will discuss some advanced features on .Net chart control. As our previous tutorial covers the basics of chart control, we will not [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second part of .Net chart control and this is going to cover some advanced topic. Please go thorugh <a href="http://www.skill-guru.com/blog/2009/11/03/microsoft-chart-control-tutorial/">Microsoft Chart Control Tutorial </a>before you continue this.<strong> </strong></p>
<p><strong>Introduction</strong></p>
<p>In this tutorial we will discuss some advanced features on .Net chart control. As our previous tutorial covers the basics of chart control, we will not discuss those same things over here. Here we focus on the advanced features primarily based on two examples:<br />
1. Creating .Net chart from the data of an XML file<br />
2. Creating .Net chart only by configuring ‘ChartArea’ sectionof the control from the source page<br />
Both of these two examples also show you different features of .Net chart .</p>
<p><strong> </strong></p>
<ul><strong>Displaying XML data using .Net chart</strong></ul>
<p><strong> </strong><br />
We are going to mention the steps one by one to create the same things in your machine for practice: <span id="more-1136"></span></p>
<p>a. First we will add an XML file in our existing project. Right click on the ‘ChartExample’ (the same project created in the last example) in the solution explorer and click ‘Add New Item’ and select ‘XML File’ like Figure-1:</p>
<div id="attachment_1139" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1139" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-110-300x198.jpg" alt=".Net chart tutorial " width="300" height="198" /><p class="wp-caption-text">Figure-1: Adding ‘XMLFile.XML’ in the project</p></div>
<p>b. Add the following data as shown in the snapshot in the XML file:</p>
<div id="attachment_1143" class="wp-caption aligncenter" style="width: 357px"><img class="size-full wp-image-1143" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-210.jpg" alt=".Net chart tutorial" width="347" height="565" /><p class="wp-caption-text">Figure-2: Data for the XML file</p></div>
<p>Here we have added the maximum and minimum temperature for a region from the month January to June. Don’t forget to add the ‘’ element otherwise you will encounter an XML exception later.</p>
<p>c. Add another web page in the project and rename it as ‘FromXML.aspx’<br />
d. In the design section drag and drop a Microsoft Chart control from the toolbox.<br />
e. In the code behind page (FromXML.aspx.cs) add the following code within the ‘Page_Load()’ event:</p>
<div id="attachment_1144" class="wp-caption aligncenter" style="width: 590px"><img class="size-full wp-image-1144" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-34.jpg" alt=".Net chart tutorial" width="580" height="401" /><p class="wp-caption-text">Figure-3: Code within the ‘Page_Load()’ event</p></div>
<p>Let’s discuss few things about the code mentioned above:<br />
The Dataset gets the XML document using ReadXML() function. You just need to specify the location correctly. Here we will show the maximum and minimum temperature of a region as bar chart. So we need two series with same X axis value within a chart.</p>
<p>We add Series[0] and set the ‘Name’ and ‘temperaturemax’ of each month as X and Y axis value.After that we add another series (‘Series2’) within the same chart and set ‘Name’ and ‘temperaturemin’ of each month as X and Y axis value. Please have a look on Figure-4 and Figure-5 for more clarification.</p>
<div id="attachment_1145" class="wp-caption aligncenter" style="width: 590px"><img class="size-full wp-image-1145" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-43.jpg" alt=".Net chart tutorial" width="580" height="57" /><p class="wp-caption-text">Figure-4: Binding the first series </p></div>
<div id="attachment_1146" class="wp-caption aligncenter" style="width: 590px"><img class="size-full wp-image-1146" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-51.jpg" alt=".Net chart tutorial" width="580" height="80" /><p class="wp-caption-text">Figure-5: Binding the second series</p></div>
<p>Although data is required for a chart but ‘Title’ is also necessary for better understanding. They can be added in design time as well as at run time. Here we have added title to the chart and the axes (Figure-6 )</p>
<div id="attachment_1149" class="wp-caption aligncenter" style="width: 590px"><img class="size-full wp-image-1149" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-62.jpg" alt="Net chart tutorial" width="580" height="187" /><p class="wp-caption-text">Figure-6: Setting the title of the chart and axes</p></div>
<p>f. Now run the application by setting this as start page you will find the output as shown in Figure-7.</p>
<div id="attachment_1150" class="wp-caption aligncenter" style="width: 629px"><img class="size-full wp-image-1150" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-71.jpg" alt=".Net chart tutorial" width="619" height="394" /><p class="wp-caption-text">Figure-7: Output with axes and chart title added </p></div>
<p>g. Sometimes in order to better execution of the details and to reduce the chart size it may be necessary to change the maximum and minimum for the axes. For example the graph shown in Figure-7 has used the default 0 and 50 as minimum and maximum for Y axis. This could be changed by using the maximum and minimum properties of Y axis as shown in Figure-8:</p>
<div id="attachment_1152" class="wp-caption aligncenter" style="width: 590px"><img class="size-full wp-image-1152" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-81.jpg" alt=".Net chart tutorial" width="580" height="150" /><p class="wp-caption-text">Figure-8: Changing the maximum and minimum for Y axis</p></div>
<p>Now we will get the chart like Figure-9 on run time</p>
<div id="attachment_1153" class="wp-caption aligncenter" style="width: 590px"><img class="size-full wp-image-1153" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-91.jpg" alt=".Net chart tutorial" width="580" height="401" /><p class="wp-caption-text">Figure-9: Output with changed minimum and maximum for Y axis</p></div>
<ul><strong>Creating .Net chart by configuring ‘ChartArea’ section</strong></ul>
<p>In this example we are going to plot another temperature –month graph but it will be a line graph. Here we will design it totally at design time. Please follow the mentioned steps again to recreate the application</p>
<p>a. Add a new web page in our existing project and rename it as ‘FromChartArea.aspx’<br />
b. In the design section drag and drop a Microsoft Chart control from the toolbox.<br />
c. Here we will build the chart totally at design time.<br />
d. First we will change the default backcolor and height, width of the chart. Change the first line of the chart control from the ‘Source’ window like the following:</p>
<p>&lt;asp:Chart ID=&#8221;TempChartData&#8221; runat=&#8221;server&#8221;  BackColor=&#8221;Aqua&#8221; Height=&#8221;400px&#8221; Width=&#8221;400px&#8221;&gt;</p>
<p>e. Now we will add the title and default legend for the graph with the following lines:</p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.75in; line-height: normal; mso-layout-grid-align: none;"><span style="font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;; mso-no-proof: yes;">&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: &quot;Courier New&quot;; mso-no-proof: yes;">Titles</span><span style="font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;; mso-no-proof: yes;">&gt;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.75in; line-height: normal; mso-layout-grid-align: none;"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">&lt;</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">Title</span> <span style="color: red;">Text</span><span style="color: blue;">=&#8221;Monthwise Temperature Chart&#8221;</span> <span style="color: red;">ForeColor</span><span style="color: blue;">=&#8221;Red&#8221;</span> <span style="color: blue;">/&gt;</span><span style="mso-spacerun: yes;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.25in; line-height: normal; mso-layout-grid-align: none;"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">&lt;/</span><span style="color: #a31515;">Titles</span><span style="color: blue;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.25in; text-indent: 0.5in; line-height: normal; mso-layout-grid-align: none;"><span style="font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;; mso-no-proof: yes;">&lt;</span><span style="font-size: 10pt; color: #a31515; font-family: &quot;Courier New&quot;; mso-no-proof: yes;">Legends</span><span style="font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;; mso-no-proof: yes;">&gt;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.75in; line-height: normal; mso-layout-grid-align: none;"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">&lt;</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">Legend</span> <span style="color: red;">Name</span><span style="color: blue;">=&#8221;DefaultLegend&#8221;</span> <span style="color: red;">Docking</span><span style="color: blue;">=&#8221;Top&#8221;</span> <span style="color: blue;">/&gt;</span></span></p>
<p><span style="font-size: 10pt; line-height: 115%; font-family: &quot;Courier New&quot;; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">&lt;/</span><span style="color: #a31515;">Legends</span><span style="color: blue;">&gt;</span><span style="mso-spacerun: yes;"> </span></span></p>
<p>We can add multiple ‘Title’ and ‘Legend’ for our graph. We will show how the ‘Legend’ appears in a graph later in this example.</p>
<p>f. Now we will add the ‘ChartArea’ object which set up the charting area. This area contains the name of the charting region which is important because a chart can have multiple charting areas and series object.</p>
<p>&lt;ChartAreas&gt;&lt;asp:ChartArea Name=&#8221;MainChart&#8221;&gt;</p>
<p>&lt;InnerPlotPosition X=&#8221;10&#8243; Y=&#8221;10&#8243; Height=&#8221;80&#8243; Width=&#8221;80&#8243; /&gt;</p>
<p>The ‘InnerPlotPosition’ specifies the region of the charting area to render the chart itself in.</p>
<p>g. In this step we will configure the X and Y axes according to our preference and then close our ‘ChartArea’. Add the following lines now. We will explain the meaning for each line below:</p>
<p>&lt;AxisX Title=&#8221;Month&#8221;&gt;</p>
<p>&lt;LabelStyle Enabled=&#8221;true&#8221;  /&gt;</p>
<p>&lt;MajorGrid LineWidth=&#8221;1&#8243; /&gt;</p>
<p>&lt;CustomLabels&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;0.5&#8243; ToPosition=&#8221;1.5&#8243; Text=&#8221;Jan&#8221; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;1.5&#8243; ToPosition=&#8221;2.5&#8243; Text=&#8221;Feb&#8221; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;2.5&#8243; ToPosition=&#8221;3.5&#8243; Text=&#8221;Mar&#8221; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;3.5&#8243; ToPosition=&#8221;4.5&#8243; Text=&#8221;Apr&#8221; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;4.5&#8243; ToPosition=&#8221;5.5&#8243; Text=&#8221;May&#8221; /&gt;</p>
<p>&lt;/CustomLabels&gt;</p>
<p>&lt;/AxisX&gt;</p>
<p>&lt;AxisY Title=&#8221;Temperature in Deg. Celcius&#8221;&gt;</p>
<p>&lt;LabelStyle Enabled=&#8221;true&#8221; /&gt;</p>
<p>&lt;MajorGrid LineWidth=&#8221;1&#8243; /&gt;</p>
<p>&lt;CustomLabels&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;0.5&#8243;  ToPosition=&#8221;10.5&#8243; Text=&#8221;10&#8243;/&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;10.5&#8243; ToPosition=&#8221;20.5&#8243; Text=&#8221;20&#8243;/&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;20.5&#8243; ToPosition=&#8221;30.5&#8243; Text=&#8221;30&#8243;/&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;30.5&#8243; ToPosition=&#8221;40.5&#8243; Text=&#8221;40&#8243;/&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;40.5&#8243; ToPosition=&#8221;50.5&#8243; Text=&#8221;50&#8243;/&gt;</p>
<p>&lt;/CustomLabels&gt;</p>
<p>&lt;/AxisY&gt;</p>
<p>&lt;/asp:ChartArea&gt;</p>
<p>&lt;/ChartAreas&gt;</p>
<p>The ‘Title’ beside AxisX and AxisY sets the title for these two axes. We can also set the line color and other properties over here. The ‘LabelStyle’ object specifies settings to use for labels that will be appeared within the chart. The ‘MajorGrid’ specifies whether to draw a line for the major X or Y value and ‘LineWidth’ specifies the width of that line. The chart control automatically determine the major values to draw the grid lines. However we can override this feature to include those lines we prefer.</p>
<p>The .Net chart control provides the control to create custom labels along X and Y axes. We have taken decimal values because the X and Y values are double. So if we specify a value 25 , it may be either 24.9999999999 or 25.0000000001 and both of these is not perfect. That’s why it is good to use a decimal value.</p>
<p>After that we have closed the ‘ChartAreas’ for our chart control</p>
<p>h. Next we will add the ‘Series’ and &#8216;DataPoints’ in our chart. ‘ Series ‘ refers the reference object and ‘DataPoints’ represent actual data range. Here again we show the maximum and minimum temperature of a region in ‘Line Chart’ format. So we need to add two series (one for maximum and another for minimum)<br />
So just add the mentioned lines to complete the example:</p>
<p>&lt;Series&gt;</p>
<p>&lt;asp:Series Name=&#8221;Maximum Temperature&#8221; ChartArea=&#8221;MainChart&#8221; ChartType=&#8221;Line&#8221;&gt;</p>
<p>&lt;Points&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;1&#8243; Yvalues=&#8221;28&#8243;  /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;2&#8243; Yvalues=&#8221;33&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;3&#8243; Yvalues=&#8221;35&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;4&#8243; Yvalues=&#8221;40&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;5&#8243; Yvalues=&#8221;43&#8243; /&gt;</p>
<p>&lt;/Points&gt;</p>
<p>&lt;/asp:Series&gt;</p>
<p>&lt;/Series&gt;</p>
<p>&lt;Series&gt;</p>
<p>&lt;asp:Series Name=&#8221;Minimum Temperature&#8221; ChartArea=&#8221;MainChart&#8221; ChartType=&#8221;Line&#8221;&gt;</p>
<p>&lt;Points&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;1&#8243; Yvalues=&#8221;12&#8243;  /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;2&#8243; Yvalues=&#8221;15&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;3&#8243; Yvalues=&#8221;23&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;4&#8243; Yvalues=&#8221;25&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;5&#8243; Yvalues=&#8221;28&#8243; /&gt;</p>
<p>&lt;/Points&gt;</p>
<p>&lt;/asp:Series&gt;</p>
<p>&lt;/Series&gt;</p>
<p>Please note that each series contains the ‘ChartArea’ name in which it will be included. Here we only have one ‘ChartArea’ and the two ‘Series’ point that charting area. Below we are adding the total source code again for your reference:</p>
<p>&lt;%@ Page Language=&#8221;C#&#8221; AutoEventWireup=&#8221;true&#8221; CodeFile=&#8221;FromChartArea.aspx.cs&#8221; Inherits=&#8221;FromChartArea&#8221; %&gt;</p>
<p>&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;</p>
<p>&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;</p>
<p>&lt;head runat=&#8221;server&#8221;&gt;</p>
<p>&lt;title&gt;Untitled Page&lt;/title&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&gt;</p>
<p>&lt;div&gt;</p>
<p>&lt;asp:Chart ID=&#8221;TempChartData&#8221; runat=&#8221;server&#8221;  BackColor=&#8221;Aqua&#8221; Height=&#8221;400px&#8221; Width=&#8221;400px&#8221;&gt;</p>
<p>&lt;Titles&gt;</p>
<p>&lt;asp:Title Text=&#8221;Monthwise Temperature Chart&#8221; ForeColor=&#8221;Red&#8221;  /&gt;</p>
<p>&lt;/Titles&gt;</p>
<p>&lt;Legends&gt;</p>
<p>&lt;asp:Legend Name=&#8221;DefaultLegend&#8221; Docking=&#8221;Top&#8221; /&gt;</p>
<p>&lt;/Legends&gt;</p>
<p>&lt;ChartAreas&gt;</p>
<p>&lt;asp:ChartArea Name=&#8221;MainChart&#8221;&gt;</p>
<p>&lt;InnerPlotPosition X=&#8221;10&#8243; Y=&#8221;10&#8243; Height=&#8221;80&#8243; Width=&#8221;80&#8243; /&gt;</p>
<p>&lt;AxisX Title=&#8221;Month&#8221;&gt;</p>
<p>&lt;LabelStyle Enabled=&#8221;true&#8221;  /&gt;</p>
<p>&lt;MajorGrid LineWidth=&#8221;1&#8243; /&gt;</p>
<p>&lt;CustomLabels&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;0.5&#8243; ToPosition=&#8221;1.5&#8243; Text=&#8221;Jan&#8221; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;1.5&#8243; ToPosition=&#8221;2.5&#8243; Text=&#8221;Feb&#8221; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;2.5&#8243; ToPosition=&#8221;3.5&#8243; Text=&#8221;Mar&#8221; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;3.5&#8243; ToPosition=&#8221;4.5&#8243; Text=&#8221;Apr&#8221; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;4.5&#8243; ToPosition=&#8221;5.5&#8243; Text=&#8221;May&#8221; /&gt;</p>
<p>&lt;/CustomLabels&gt;</p>
<p>&lt;/AxisX&gt;</p>
<p>&lt;AxisY Title=&#8221;Temperature in Deg. Celcius&#8221; &gt;</p>
<p>&lt;LabelStyle Enabled=&#8221;true&#8221; /&gt;</p>
<p>&lt;MajorGrid LineWidth=&#8221;1&#8243; /&gt;</p>
<p>&lt;CustomLabels&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;0.5&#8243;  ToPosition=&#8221;10.5&#8243; Text=&#8221;10&#8243; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;10.5&#8243; ToPosition=&#8221;20.5&#8243; Text=&#8221;20&#8243; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;20.5&#8243; ToPosition=&#8221;30.5&#8243; Text=&#8221;30&#8243; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;30.5&#8243; ToPosition=&#8221;40.5&#8243; Text=&#8221;40&#8243; /&gt;</p>
<p>&lt;asp:CustomLabel FromPosition=&#8221;40.5&#8243; ToPosition=&#8221;50.5&#8243; Text=&#8221;50&#8243; /&gt;</p>
<p>&lt;/CustomLabels&gt;</p>
<p>&lt;/AxisY&gt;</p>
<p>&lt;/asp:ChartArea&gt;</p>
<p>&lt;/ChartAreas&gt;</p>
<p>&lt;Series&gt;</p>
<p>&lt;asp:Series Name=&#8221;Maximum Temperature&#8221; ChartArea=&#8221;MainChart&#8221; ChartType=&#8221;Line&#8221;&gt;</p>
<p>&lt;Points&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;1&#8243; Yvalues=&#8221;28&#8243;  /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;2&#8243; Yvalues=&#8221;33&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;3&#8243; Yvalues=&#8221;35&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;4&#8243; Yvalues=&#8221;40&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;5&#8243; Yvalues=&#8221;43&#8243; /&gt;</p>
<p>&lt;/Points&gt;</p>
<p>&lt;/asp:Series&gt;</p>
<p>&lt;/Series&gt;</p>
<p>&lt;Series&gt;</p>
<p>&lt;asp:Series Name=&#8221;Minimum Temperature&#8221; ChartArea=&#8221;MainChart&#8221; ChartType=&#8221;Line&#8221;&gt;</p>
<p>&lt;Points&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;1&#8243; Yvalues=&#8221;12&#8243;  /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;2&#8243; Yvalues=&#8221;15&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;3&#8243; Yvalues=&#8221;23&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;4&#8243; Yvalues=&#8221;25&#8243; /&gt;</p>
<p>&lt;asp:DataPoint XValue=&#8221;5&#8243; Yvalues=&#8221;28&#8243; /&gt;</p>
<p>&lt;/Points&gt;</p>
<p>&lt;/asp:Series&gt;</p>
<p>&lt;/Series&gt;</p>
<p>&lt;/asp:Chart&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;/form&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p>
<p>i. Now run the application by setting ‘FromChartArea.aspx’ as start page and you will find the following output (Figure-10)</p>
<div id="attachment_1164" class="wp-caption aligncenter" style="width: 417px"><img class="size-full wp-image-1164" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-101.jpg" alt=".Net chart tutorial" width="407" height="414" /><p class="wp-caption-text">Figure-10: Desired output for the Monthwise Temperature Chart</p></div>
<p>Please have a look in Figure-11 for explanation on the output</p>
<div id="attachment_1165" class="wp-caption aligncenter" style="width: 590px"><img class="size-full wp-image-1165" src="http://www.skill-guru.com/blog/wp-content/uploads/2009/11/Figure-111.jpg" alt=".Net chart tutorial" width="580" height="423" /><p class="wp-caption-text">Figure-11: Output with proper explanation</p></div>
<p><strong>Summary</strong></p>
<p>So in the first example we have shown the binding of .Net chart control to XML data. At the same time we have also explored the other chart properties. Chart title and the range of Y axis values are also explored in this example.</p>
<p>In the second example we have shown how the chart control uses ‘Series’ and ‘DataPoints’ to render a chart within a chart region controlled by a ‘ChartArea’ object. This example clearly shows how much control a developer can have over the colors, borders, lines, rendering regions and other styling of the chart.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skill-guru.com/blog/2009/11/29/advanced-features-of-net-chart-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
