<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ganeshmohan&#039;s Weblog</title>
	<atom:link href="http://ganeshmohan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ganeshmohan.wordpress.com</link>
	<description>Ruby on Rails, ASP.Net, C#</description>
	<lastBuildDate>Wed, 18 Jan 2012 12:56:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ganeshmohan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ganeshmohan&#039;s Weblog</title>
		<link>http://ganeshmohan.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ganeshmohan.wordpress.com/osd.xml" title="Ganeshmohan&#039;s Weblog" />
	<atom:link rel='hub' href='http://ganeshmohan.wordpress.com/?pushpress=hub'/>
		<item>
		<title>FCK Editor Plugin in ActiveScaffold</title>
		<link>http://ganeshmohan.wordpress.com/2008/11/12/fck-editor-plugin-in-activescaffold/</link>
		<comments>http://ganeshmohan.wordpress.com/2008/11/12/fck-editor-plugin-in-activescaffold/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 08:11:40 +0000</pubDate>
		<dc:creator>Ganesh Mohan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Active Scaffold]]></category>
		<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[FCK Editor]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://ganeshmohan.wordpress.com/?p=39</guid>
		<description><![CDATA[Integrating FCK Editor Plugin in Active Scaffold is very easy Assuming FCK Editor Plugin is installed in your application. In controller we need to write the following code to make it work: Considering the category we have this as usual active_scaffold :category do &#124;config&#124; config.label = &#8220;Category&#8221; # Display page name config.columns = [:name, :rank, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=39&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">Integrating FCK Editor Plugin in Active Scaffold is very easy</p>
<p class="MsoNormal">Assuming FCK Editor Plugin is installed in your application.</p>
<p class="MsoNormal">In controller we need to write the following code to make it work:</p>
<p class="MsoNormal">Considering the category we have this as usual</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">active_scaffold </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:category</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">do</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> |config|</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Category&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Display page name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns = [</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:rank</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:description</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">] </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># all fields are taken</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>list.columns.exclude </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:description</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;">#exclude description column in list</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span>In Category_Helper.rb we need to add the following code</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;">#description field is shown in FCK editor format</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> description_form_column(record, input_name)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>fckeditor_textarea( </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:record</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:description</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:toolbarSet</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> =&gt; </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8216;Simple&#8217;</span><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">=&gt; input_name, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:width</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> =&gt; </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;800px&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:height</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> =&gt; </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;200px&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> )</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;">#description text is displayed in rich format</span><span></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> description_column(record)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>sanitize(record.description)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>and <span> </span>we need to copy the “_create_form.rhtml” &amp; “_update_form.rhtml” from ..</span><span style="font-size:9pt;font-family:&quot;color:#1e1e1e;">\vendor\plugins\active_scaffold\frontends\default\views </span><span>to Views/Category and edit _create_form.rhtml by adding following code to it</span></p>
<p class="MsoNormal"><span>Instead of </span><span style="background:white none repeat scroll 0;font-size:10pt;font-family:&quot;color:black;">&lt;%= submit_tag as_(</span><span style="background:white none repeat scroll 0;font-size:10pt;font-family:&quot;color:#2a00ff;">&#8216;Create&#8217;</span><span style="background:white none repeat scroll 0;font-size:10pt;font-family:&quot;color:black;">), </span><strong><span style="background:white none repeat scroll 0;font-size:10pt;font-family:&quot;color:#ff4040;">:class</span></strong><span style="background:white none repeat scroll 0;font-size:10pt;font-family:&quot;color:black;"> =&gt; </span><span style="background:white none repeat scroll 0;font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;submit&#8221;</span><span style="background:white none repeat scroll 0;font-size:10pt;font-family:&quot;color:black;"> %&gt;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span></p>
<p class="MsoNormal"><span>we add following code </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f7f;">&lt;input </span><span style="font-size:10pt;font-family:&quot;color:#7f007f;">type</span><span style="font-size:10pt;font-family:&quot;color:black;">=</span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;submit&#8221;</span><span style="font-size:10pt;font-family:&quot;color:#3f7f7f;"> </span><span style="font-size:10pt;font-family:&quot;color:#7f007f;">value</span><span style="font-size:10pt;font-family:&quot;color:black;">=</span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Create&#8221;</span><span style="font-size:10pt;font-family:&quot;color:#3f7f7f;"> </span><span style="font-size:10pt;font-family:&quot;color:#7f007f;">class</span><span style="font-size:10pt;font-family:&quot;color:black;">=</span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;submit&#8221;</span><span style="font-size:10pt;font-family:&quot;color:#3f7f7f;"> </span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#7f007f;">onClick</span><span style="font-size:10pt;font-family:&quot;color:black;">=</span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;var oEditor = FCKeditorAPI.GetInstance(&#8216;record_&lt;%=@record.id%&gt;_&lt;%=&#8217;description&#8217;%&gt;_editor&#8217;); </span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">document.getElementById(&#8216;record_&lt;%=@record.id%&gt;_&lt;%=&#8217;description&#8217;%&gt;_editor&#8217;).value = oEditor.GetXHTML();&#8221;</span><span style="font-size:10pt;font-family:&quot;color:#3f7f7f;"> /&gt;</span><span></span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>and the same in _update_form.rhtml just replacing the value “Create” to “Update”</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>and your code will be working fine.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ganeshmohan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ganeshmohan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ganeshmohan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ganeshmohan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ganeshmohan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ganeshmohan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ganeshmohan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ganeshmohan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ganeshmohan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ganeshmohan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ganeshmohan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ganeshmohan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ganeshmohan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ganeshmohan.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=39&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ganeshmohan.wordpress.com/2008/11/12/fck-editor-plugin-in-activescaffold/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a383411b9a4f1ce9a6a0264c0d90448b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">GaneshMohan</media:title>
		</media:content>
	</item>
		<item>
		<title>File Column Plugin in ActiveScaffold</title>
		<link>http://ganeshmohan.wordpress.com/2008/11/12/file-column-plugin-in-activescaffold/</link>
		<comments>http://ganeshmohan.wordpress.com/2008/11/12/file-column-plugin-in-activescaffold/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 08:06:32 +0000</pubDate>
		<dc:creator>Ganesh Mohan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Active Scaffold]]></category>
		<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[File Column]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://ganeshmohan.wordpress.com/?p=36</guid>
		<description><![CDATA[Integrating File Column Plugin in Active Scaffold is very easy Assuming File Column Plugin is installed in your application. In controller we need to write the following code to make it work: Considering there is a field called Product_Image in product active_scaffold :product do &#124;config&#124; config.label = &#8220;Product Page&#8221; config.columns = [:product_name, :product_description, :product_image] config.create.multipart [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=36&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">Integrating File Column Plugin in Active Scaffold is very easy</p>
<p class="MsoNormal">Assuming File Column Plugin is installed in your application.</p>
<p class="MsoNormal">In controller we need to write the following code to make it work:</p>
<p class="MsoNormal">Considering there is a field called Product_Image in product</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">active_scaffold </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">do</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> |config|</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Product Page&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns = [</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_description</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_image</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">] </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.create.multipart = </span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">true</span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.update.multipart = </span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">true</span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span><span> </span>config.columns[</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_image</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">].label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Product Image&#8221;</span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span>Its not yet done we need to do few coding in helper and model also</span></p>
<p class="MsoNormal"><span>In Product_Helper.rb we need to add the following code</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> product_image_form_column(record, input_name)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>file_column_field </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8216;record&#8217;</span><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_image</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;"> <img src='http://s1.wp.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nkeypress</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">=&gt;</span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;return numbersonly(event, false)&#8221;</span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;">#onkeypress event is used to advoid typing characters in file field</span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> product_image_column(record)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>image_tag url_for_file_column(record, </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">product_image</span></strong><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;</span><span style="font-size:10pt;font-family:&quot;color:black;">) </span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">if</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> record.</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">product_image</span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>and In Product_Image.rb we need to write a single line code</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">file_column </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_image</span></strong></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>Its Done and when you upload a image it will create that image in a folder named by the Product_id in public/Product_images and will insert the image name in product_image<span> </span>product table </span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ganeshmohan.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ganeshmohan.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ganeshmohan.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ganeshmohan.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ganeshmohan.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ganeshmohan.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ganeshmohan.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ganeshmohan.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ganeshmohan.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ganeshmohan.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ganeshmohan.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ganeshmohan.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ganeshmohan.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ganeshmohan.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=36&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ganeshmohan.wordpress.com/2008/11/12/file-column-plugin-in-activescaffold/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a383411b9a4f1ce9a6a0264c0d90448b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">GaneshMohan</media:title>
		</media:content>
	</item>
		<item>
		<title>Search in ActiveScaffold</title>
		<link>http://ganeshmohan.wordpress.com/2008/11/12/search-in-activescaffold/</link>
		<comments>http://ganeshmohan.wordpress.com/2008/11/12/search-in-activescaffold/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 08:03:55 +0000</pubDate>
		<dc:creator>Ganesh Mohan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Active Scaffold]]></category>
		<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://ganeshmohan.wordpress.com/?p=34</guid>
		<description><![CDATA[Integrating Search in Active Scaffold is very easy In controller we need to write the following code to make it work: Considering the category we have active_scaffold :category do &#124;config&#124; config.label = &#8220;Category&#8221; # Display page name config.columns = [:name, :rank, :description, :products] config.columns[:name].label = &#8220;Some Name&#8221; update.columns.exclude :rank # exclude rank column during edit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=34&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">Integrating Search in Active Scaffold is very easy</p>
<p class="MsoNormal">In controller we need to write the following code to make it work:</p>
<p class="MsoNormal">Considering the category we have</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">active_scaffold </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:category</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">do</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> |config|</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Category&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Display page name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns = [</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:rank</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:description, :products</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">]<span> </span><span> </span></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns[</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">].label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Some Name&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span><span> </span>update.columns.exclude </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:rank</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># exclude rank column during edit</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"><span> </span># Search the list by name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns[</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">].search_sql = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;name&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span><span> </span></span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.search.columns &lt;&lt; </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"><span> </span># Search the list by product name</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;"></span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;"><span> </span></span></strong><span style="font-size:10pt;font-family:&quot;color:black;">config.columns[</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:products</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">].search_sql = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;products.name&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span></span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.search.columns &lt;&lt; </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:products</span></strong><span></span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;"> </span></strong></p>
<p class="MsoNormal"><span>We can search both the parent and child i.e Category and Product names in the same page.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ganeshmohan.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ganeshmohan.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ganeshmohan.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ganeshmohan.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ganeshmohan.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ganeshmohan.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ganeshmohan.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ganeshmohan.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ganeshmohan.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ganeshmohan.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ganeshmohan.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ganeshmohan.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ganeshmohan.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ganeshmohan.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=34&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ganeshmohan.wordpress.com/2008/11/12/search-in-activescaffold/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a383411b9a4f1ce9a6a0264c0d90448b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">GaneshMohan</media:title>
		</media:content>
	</item>
		<item>
		<title>Customizing ActiveScaffold</title>
		<link>http://ganeshmohan.wordpress.com/2008/11/12/customizing-activescaffold/</link>
		<comments>http://ganeshmohan.wordpress.com/2008/11/12/customizing-activescaffold/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 08:01:13 +0000</pubDate>
		<dc:creator>Ganesh Mohan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Active Scaffold]]></category>
		<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://ganeshmohan.wordpress.com/?p=31</guid>
		<description><![CDATA[Customizing Active Scaffold according to your requirements is very easy. Example :- Removing create, edit or delete links from your page and add your own links Also add nested links if this model is related to other model. Example there is another model name as Product which is related to Category model say category has [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=31&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">Customizing Active Scaffold according to your requirements is very easy.</p>
<p class="MsoNormal">Example :- Removing<span> </span>create, edit or delete links from your page and add your own links</p>
<p class="MsoNormal">Also add nested links if this model is related to other model. Example there is another model name as Product which is related to Category model say category has many products and product belongs to Category.</p>
<p class="MsoNormal">For that we need to do the following</p>
<p class="MsoNormal">
<p class="MsoNormal">Now in controller we need to write the following code:</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">active_scaffold </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:category</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">do</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> |config|</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Category&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Display page name</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns = [</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:rank</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:description, :products</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">]</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns[</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">].label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Some Name&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># customize column name</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>update.columns.exclude </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:rank</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># exclude rank column during edit</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>list.columns.exclude </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:description</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;">#exclude description column in list</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"><span> </span>#this is a extra link which is applicable for every row if type record and if type is table then it is for all records</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"><span> </span></span><span style="font-size:10pt;font-family:&quot;color:black;">config.action_links.add </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;cat&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:label</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">=&gt;</span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Categories&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:type</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">=&gt;</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:record</span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;"><span> </span></span></strong><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;">#this is a link to products where you can list add edit delete and associate products to category</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"><span> </span><span style="color:black;">config.nested.add_link </span><span style="color:#2a00ff;">&#8220;Add Products&#8221;</span><span style="color:black;">, [</span><strong><span style="color:#ff4040;">:products</span></strong><span style="color:black;">]</span></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;"> </span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> cat</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"><span> </span>#your required code</span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;"> </span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><span>Considering product model we have fields like product_name, product_description, category_id </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">active_scaffold </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">do</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> |config|</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Product Page&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Display page name</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"><span> </span># Category_id not needed by default it will take while adding</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns = [</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_description</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">]</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns[</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">].label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Product Name&#8221;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>list.columns.exclude </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:product_description</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>and we need to add the required code in Product_Helper.rb as we did in category_helper.rb</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>and also we can add our own code if required during update and create by copying the code from …</span><span style="font-size:9pt;font-family:&quot;color:#1e1e1e;">\vendor\plugins\active_scaffold\lib\actions<span> </span></span><span>to your controller and edit it as required</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>Now in your page you can add and associate products to category.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ganeshmohan.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ganeshmohan.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ganeshmohan.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ganeshmohan.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ganeshmohan.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ganeshmohan.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ganeshmohan.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ganeshmohan.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ganeshmohan.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ganeshmohan.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ganeshmohan.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ganeshmohan.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ganeshmohan.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ganeshmohan.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=31&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ganeshmohan.wordpress.com/2008/11/12/customizing-activescaffold/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a383411b9a4f1ce9a6a0264c0d90448b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">GaneshMohan</media:title>
		</media:content>
	</item>
		<item>
		<title>Active Scaffold</title>
		<link>http://ganeshmohan.wordpress.com/2008/11/12/active-scaffold/</link>
		<comments>http://ganeshmohan.wordpress.com/2008/11/12/active-scaffold/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 07:54:55 +0000</pubDate>
		<dc:creator>Ganesh Mohan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Active Scaffold]]></category>
		<category><![CDATA[ActiveScaffold]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://ganeshmohan.wordpress.com/?p=28</guid>
		<description><![CDATA[Acivescaffold is a plugin which makes the life easier for many programmers. Assuming that you have downloaded and installed the plugin. We proceed with an example. Consider there is a model named as “category” with fields like name, rank and description and we are now integrating this with Activescaffold Now in controller we need to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=28&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">Acivescaffold is a plugin which makes the life easier for many programmers. Assuming that you have downloaded and installed the plugin. We proceed with an example.</p>
<p class="MsoNormal">Consider there is a model named as “category” with fields like name, rank and description and we are now integrating this with Activescaffold</p>
<p class="MsoNormal">
<p class="MsoNormal">Now in controller we need to write the following code:</p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">active_scaffold </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:category</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">do</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> |config|</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Category&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Display page name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns = [</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:rank</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:description</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">] </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># all fields are taken</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>config.columns[</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">].label = </span><span style="font-size:10pt;font-family:&quot;color:#2a00ff;">&#8220;Some Name&#8221;</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># customize column name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>update.columns.exclude </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:rank</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># exclude rank column during edit</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>list.columns.exclude </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:description</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;">#exclude description column in list</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;"> </span></strong></p>
<p class="MsoNormal"><span>Now in Category_helper.rb we need to write the following code to display the field format Ex:- Textbox, Dropdown , checkbox etc.</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Textbox to enter name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> name_form_column(record,input_name)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>textbox </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:record</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">=&gt; input_name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span></span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Label to display name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> name_column(record)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>record.name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Textarea to enter the description</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> description_form_column(record,input_name)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>textarea </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:record</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">, </span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">=&gt; input_name</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span></span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Label to display description</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> description_column(record)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>record.description</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span></span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Dropdown to select rank</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> rank_form_column(record,input_name)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>select(</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:record</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:pricing</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,[</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">1</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">2</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">3</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">4</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">5</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">6</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">7</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">8</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">9</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">,</span><strong><span style="font-size:10pt;font-family:&quot;color:#0080ff;">10</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">],</span><strong><span style="font-size:10pt;font-family:&quot;color:#ff4040;">:name</span></strong><span style="font-size:10pt;font-family:&quot;color:black;">=&gt; input_name)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:#3f7f5f;"># Label to display rank</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">def</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> rank_column(record)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>record.rank</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal"><strong><span style="font-size:10pt;font-family:&quot;color:#a4357a;">end</span></strong><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;"><span> </span></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal"><span>That’s it your code will work fine. No rhtml code is required.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ganeshmohan.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ganeshmohan.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ganeshmohan.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ganeshmohan.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ganeshmohan.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ganeshmohan.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ganeshmohan.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ganeshmohan.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ganeshmohan.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ganeshmohan.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ganeshmohan.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ganeshmohan.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ganeshmohan.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ganeshmohan.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=28&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ganeshmohan.wordpress.com/2008/11/12/active-scaffold/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a383411b9a4f1ce9a6a0264c0d90448b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">GaneshMohan</media:title>
		</media:content>
	</item>
		<item>
		<title>C# windows validation by ErrorProvider Control</title>
		<link>http://ganeshmohan.wordpress.com/2008/05/16/c-windows-validation-by-errorprovider-control/</link>
		<comments>http://ganeshmohan.wordpress.com/2008/05/16/c-windows-validation-by-errorprovider-control/#comments</comments>
		<pubDate>Fri, 16 May 2008 11:29:39 +0000</pubDate>
		<dc:creator>Ganesh Mohan</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[C# Windows]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[ErrorProvider]]></category>
		<category><![CDATA[Validation]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://ganeshmohan.wordpress.com/?p=17</guid>
		<description><![CDATA[C# Windows Validation by ErrorProvider   In ASP.Net 2.0 we use different Validation controls from Toolbox for validations (Just Drag &#38; Drop, No need of writing code in C#). But in Case of C# windows application this feature is not available so we use Error Provider control to do any type of validation.     [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=17&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin:0;"><strong><span style="text-decoration:underline;"><span style="font-size:20pt;font-family:'BankGothic Md BT';">C# Windows Validation by ErrorProvider</span></span></strong></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">In ASP.Net 2.0 we use different Validation controls from Toolbox for validations (Just Drag &amp; Drop, No need of writing code in C#). But in Case of C# windows application this feature is not available so we use Error Provider control to do any type of validation.</span></span></p>
<p class="MsoNormal" style="margin:0;"> </p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:20pt;font-family:'BankGothic Md BT';"><img class="alignnone size-medium wp-image-15" src="http://ganeshmohan.files.wordpress.com/2008/05/1.png?w=240&#038;h=300" alt="" width="240" height="300" /></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"></span> </p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">For example:-</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">If we take a Employee data…</span></span></p>
<ol style="margin-top:0;" type="1">
<li class="MsoNormal"><span style="font-family:Verdana;"><span style="font-size:small;">Name (Text)</span></span></li>
<li class="MsoNormal"><span style="font-family:Verdana;"><span style="font-size:small;">Age (Integer)</span></span></li>
<li class="MsoNormal"><span style="font-family:Verdana;"><span style="font-size:small;">Salary (Double)</span></span></li>
</ol>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">Form looks like </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:20pt;font-family:'BankGothic Md BT';"><img class="alignnone size-medium wp-image-16" src="http://ganeshmohan.files.wordpress.com/2008/05/2.png?w=283&#038;h=239" alt="" width="283" height="239" /></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">In ADD button click you need to write the following code.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:'Courier New';">private</span><span style="font-size:10pt;font-family:'Courier New';"> <span style="color:#0000ff;">void</span> ADD_Click(<span style="color:#0000ff;">object</span> sender, <span style="color:#008080;">EventArgs</span> e)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';">{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>  </span><span style="color:#0000ff;">if</span> (is_validate())</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>  </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>errorProvider1.Clear();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span><span style="color:#008000;">// Write Coding to add into database</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span><span style="color:#008080;">MessageBox</span>.Show(<span style="color:#800000;">&#8220;Data Successfully Added&#8221;</span>);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>  </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';">}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:'Courier New';">private</span><span style="font-size:10pt;font-family:'Courier New';"> <span style="color:#0000ff;">bool</span> is_validate()</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';">{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>  </span><span style="color:#0000ff;">bool</span> no_error = <span style="color:#0000ff;">true</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>  </span><span style="color:#0000ff;">if</span> (txtname.Text == <span style="color:#0000ff;">string</span>.Empty)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>  {</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>errorProvider1.SetError(txtname, <span style="color:#800000;">&#8220;Text Missing&#8221;</span>);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>no_error = <span style="color:#0000ff;">false</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>  </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>  </span><span style="color:#0000ff;">else</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>  {</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span><span style="color:#008000;">// Clear all Error Messages</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span><span style="color:#0000ff;">try</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>      </span><span style="color:#0000ff;">int</span> i = <span style="color:#008080;">Convert</span>.ToInt32(txtage.Text);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span><span style="color:#0000ff;">catch</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>      </span>errorProvider1.Clear(); <span style="color:#008000;">// Clear all Error Messages</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>      </span>errorProvider1.SetError(txtage, <span style="color:#800000;">&#8220;Enter Valid Age&#8221;</span>);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>      </span><span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span><span style="color:#0000ff;">try</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>      </span><span style="color:#0000ff;">double</span> j = <span style="color:#008080;">Convert</span>.ToDouble(txtsalary.Text);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span><span style="color:#0000ff;">catch</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>      </span>errorProvider1.Clear(); <span style="color:#008000;">// Clear all Error Messages</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>      </span>errorProvider1.SetError(txtsalary, <span style="color:#800000;">&#8220;Enter Valid Salary&#8221;</span>);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>      </span><span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>    </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>   </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';"><span>   </span><span style="color:#0000ff;">return</span> no_error;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:'Courier New';">}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">Here one Error Provider Control can be used for multiple fields.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">That’s it. It’s all done. Its Very Simple isn’t it??</span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">                       </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ganeshmohan.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ganeshmohan.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ganeshmohan.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ganeshmohan.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ganeshmohan.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ganeshmohan.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ganeshmohan.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ganeshmohan.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ganeshmohan.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ganeshmohan.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ganeshmohan.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ganeshmohan.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ganeshmohan.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ganeshmohan.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ganeshmohan.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ganeshmohan.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=17&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ganeshmohan.wordpress.com/2008/05/16/c-windows-validation-by-errorprovider-control/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a383411b9a4f1ce9a6a0264c0d90448b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">GaneshMohan</media:title>
		</media:content>

		<media:content url="http://ganeshmohan.files.wordpress.com/2008/05/1.png?w=240" medium="image" />

		<media:content url="http://ganeshmohan.files.wordpress.com/2008/05/2.png?w=283" medium="image" />
	</item>
		<item>
		<title>ASP.Net and C# Create HTML Controls Dynamically</title>
		<link>http://ganeshmohan.wordpress.com/2008/05/14/aspnet-and-c-create-controls-dynamically/</link>
		<comments>http://ganeshmohan.wordpress.com/2008/05/14/aspnet-and-c-create-controls-dynamically/#comments</comments>
		<pubDate>Wed, 14 May 2008 07:59:25 +0000</pubDate>
		<dc:creator>Ganesh Mohan</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[dynamic]]></category>

		<guid isPermaLink="false">http://ganeshmohan.wordpress.com/?p=11</guid>
		<description><![CDATA[ASP.Net &#38; C# Create HTML Controls Dynamically   It is very easy to create HTML controls before running a Web Page. Just Drag and Drop from ToolBox or write HTML code or ASP code for that Web Page (.aspx). But people think that generating HTML controls during runtime is difficult. But it’s quite easy. There [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=11&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin:0;"><strong><span style="text-decoration:underline;"><span style="font-size:20pt;">ASP.Net &amp; C# Create HTML Controls </span></span></strong></p>
<p class="MsoNormal" style="margin:0;"><strong></strong></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="text-decoration:underline;"><span style="font-size:20pt;">Dynamically</span></span></strong></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">It is very easy to create HTML controls before running a Web Page. Just Drag and Drop from ToolBox or write HTML code or ASP code for that Web Page (.aspx). But people think that generating HTML controls during runtime is difficult. But it’s quite easy.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">There are many methods of generating controls during runtime.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">Here is the one.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">First thing is that you need to add a Panel by drag and drop it from the toolbox.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">After that you need to write the C# code in Page Load event or button event as follows :</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">Panel1.Controls.Add(<span style="color:#0000ff;">new</span> <span style="color:#008080;">LiteralControl</span>(<span style="color:#800000;">&#8220;&lt;table&gt;&lt;tr&gt;&#8221;</span>));</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">Panel1.Controls.Add(<span style="color:#0000ff;">new</span> <span style="color:#008080;">LiteralControl</span>(<span style="color:#800000;">&#8220;&lt;td colspan=2 align=center <span>   </span>valign=middle &gt;&#8221;</span>));</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">Panel1.Controls.Add(<span style="color:#0000ff;">new</span> <span style="color:#008080;">LiteralControl</span>(<span style="color:#800000;">&#8220;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&#8221;</span>));</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">Panel1.Controls.Add(<span style="color:#0000ff;">new</span> <span style="color:#008080;">LiteralControl</span>(<span style="color:#800000;">&#8220;&lt;input id=&#8217;Text1&#8242; type=&#8217;text&#8217; value=&#8217;Ganesh Mohan&#8217; /&gt;&#8221;</span>));</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">Panel1.Controls.Add(<span style="color:#0000ff;">new</span> <span style="color:#008080;">LiteralControl</span>(<span style="color:#800000;">&#8220;&lt;/td&gt;&lt;td&gt;&#8221;</span>));</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">Panel1.Controls.Add(<span style="color:#0000ff;">new</span> <span style="color:#008080;">LiteralControl</span>(<span style="color:#800000;">&#8220;&lt;a href=http://ganeshmohan.wordpress.com&gt;&#8221;</span>));</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">Panel1.Controls.Add(<span style="color:#0000ff;">new</span> <span style="color:#008080;">LiteralControl</span>(<span style="color:#800000;">&#8220;Hi This is Ganesh&#8221;</span>));</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">Panel1.Controls.Add(<span style="color:#0000ff;">new</span> <span style="color:#008080;">LiteralControl</span>(<span style="color:#800000;">&#8220;&lt;/a&gt;&#8221;</span>));</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">Panel1.Controls.Add(<span style="color:#0000ff;">new</span> <span style="color:#008080;">LiteralControl</span>(<span style="color:#800000;">&#8220;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#8221;</span>));</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">That’s it. Its all Done. Its So Simple isn’t it!</span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ganeshmohan.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ganeshmohan.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ganeshmohan.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ganeshmohan.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ganeshmohan.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ganeshmohan.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ganeshmohan.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ganeshmohan.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ganeshmohan.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ganeshmohan.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ganeshmohan.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ganeshmohan.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ganeshmohan.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ganeshmohan.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ganeshmohan.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ganeshmohan.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=11&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ganeshmohan.wordpress.com/2008/05/14/aspnet-and-c-create-controls-dynamically/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a383411b9a4f1ce9a6a0264c0d90448b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">GaneshMohan</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.Net and C# Login Page</title>
		<link>http://ganeshmohan.wordpress.com/2008/05/13/aspnet-c-login-page/</link>
		<comments>http://ganeshmohan.wordpress.com/2008/05/13/aspnet-c-login-page/#comments</comments>
		<pubDate>Tue, 13 May 2008 06:05:32 +0000</pubDate>
		<dc:creator>Ganesh Mohan</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[Login]]></category>

		<guid isPermaLink="false">http://ganeshmohan.wordpress.com/?p=7</guid>
		<description><![CDATA[ASP.Net &#38; C# Login Page   Whenever we want to start any project the first thing we think about the User Roles and Login. Generally there will be mainly two User Roles a)    Administrator User b)    Client User   In VS 2005 its very simple to design a Login Page. Because there is no need [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=7&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin:0;"><strong><span style="text-decoration:underline;"><span style="font-size:20pt;">ASP.Net &amp; C# Login Page</span></span></strong></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">Whenever we want to start any project the first thing we think about the User Roles and Login. Generally there will be mainly two User Roles </span></span></p>
<p class="MsoNormal" style="text-indent:-0.25in;margin:0 0 0 0.5in;"><span style="font-family:Verdana;"><span><span style="font-size:small;">a)</span><span style="font:7pt;">    </span></span></span><span style="font-family:Verdana;"><span style="font-size:small;">Administrator User</span></span></p>
<p class="MsoNormal" style="text-indent:-0.25in;margin:0 0 0 0.5in;"><span style="font-family:Verdana;"><span><span style="font-size:small;">b)</span><span style="font:7pt;">    </span></span></span><span style="font-family:Verdana;"><span style="font-size:small;">Client User</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">In VS 2005 its very simple to design a Login Page. Because there is no need of bringing textboxes, labels &amp; buttons together to design a login page and writing code in that button click event. The VS 2005 have a readymade tool in its toolbox called as “Login”.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">You just have to Drag &amp; Drop that on your .aspx page</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">After drag &amp; drop you can change that to your desired design by clicking on Auto Format</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">Then we need to go to the ‘Properties’ of that Login Control and click on Events.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">There we can see a event called Authenticate, Double click on it.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">Once that is done. You have to write the C# code in that event</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System.Data;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System.Configuration;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System.Web;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System.Web.Security;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System.Web.UI;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System.Web.UI.WebControls;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System.Web.UI.WebControls.WebParts;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System.Web.UI.HtmlControls;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">using</span><span style="font-size:10pt;"> System.Data.SqlClient;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;">public</span><span style="font-size:10pt;"> <span style="color:#0000ff;">partial</span> <span style="color:#0000ff;">class</span> <span style="color:#008080;">_Default</span> : System.Web.UI.<span style="color:#008080;">Page</span> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span><span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> Page_Load(<span style="color:#0000ff;">object</span> sender, <span style="color:#008080;">EventArgs</span> e)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span><span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> Login1_Authenticate(<span style="color:#0000ff;">object</span> sender, <span style="color:#008080;">AuthenticateEventArgs</span> e)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>        </span><span style="color:#0000ff;">try</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>        </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>            </span><span style="color:#0000ff;">string</span> uname = Login1.UserName.Trim(); <span style="color:#008000;">//Get the username from the control</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>            </span><span style="color:#0000ff;">string</span> password = Login1.Password.Trim(); <span style="color:#008000;">//get the Password from the control</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>            </span><span style="color:#0000ff;">bool</span> flag = AuthenticateUser(uname, password);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>            </span><span style="color:#0000ff;">if</span> (flag == <span style="color:#0000ff;">true</span>)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>            </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>                </span>e.Authenticated = <span style="color:#0000ff;">true</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>                </span>Login1.DestinationPageUrl = <span style="color:#800000;">&#8220;After_Login.aspx&#8221;</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>            </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>            </span><span style="color:#0000ff;">else</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>                </span>e.Authenticated = <span style="color:#0000ff;">false</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>        </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>     </span><span>   </span><span style="color:#0000ff;">catch</span> (<span style="color:#008080;">Exception</span>)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>        </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>            </span>e.Authenticated = <span style="color:#0000ff;">false</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>        </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span><span style="color:#0000ff;">private</span> <span style="color:#0000ff;">bool</span> AuthenticateUser(<span style="color:#0000ff;">string</span> uname, <span style="color:#0000ff;">string</span> password)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span><span style="color:#0000ff;">bool</span> bflag = <span style="color:#0000ff;">false</span>;</span></p>
<p class="MsoNormal" style="margin:0 0 0 0.5in;"><span style="font-size:10pt;"><span> </span><span style="color:#0000ff;">string</span> connString = <span style="color:#800000;">&#8220;Server=localhost;Database=mproi;Uid=sa;Pwd=;&#8221;</span>;</span></p>
<p class="MsoNormal" style="text-indent:6pt;margin:0 0 0 0.5in;"><span style="font-size:10pt;color:#0000ff;">string</span><span style="font-size:10pt;"> strSQL = <span style="color:#800000;">&#8220;select * from tbl_user where user_name =&#8217;&#8221;</span> +<span>   </span>uname + <span style="color:#800000;">&#8220;&#8216; AND user_password =&#8217;&#8221;</span> + password + <span style="color:#800000;">&#8220;&#8216;&#8221;</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span><span style="color:#008080;">DataSet</span> userDS = <span style="color:#0000ff;">new</span> <span style="color:#008080;">DataSet</span>();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span><span style="color:#008080;">SqlConnection</span> m_conn;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span><span style="color:#008080;">SqlDataAdapter</span> m_dataAdapter;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span><span style="color:#008080;">SqlCommand</span> m_Command;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span><span style="color:#0000ff;">try</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>           </span>m_conn = <span style="color:#0000ff;">new</span> <span style="color:#008080;">SqlConnection</span>(connString);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>           </span>m_conn.Open();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>           </span>m_dataAdapter = <span style="color:#0000ff;">new</span> <span style="color:#008080;">SqlDataAdapter</span>(strSQL, m_conn);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>           </span>m_dataAdapter.Fill(userDS);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>           </span>m_conn.Close();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span><span style="color:#0000ff;">catch</span> (<span style="color:#008080;">Exception</span> ex)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span><span>   </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>           </span>userDS = <span style="color:#0000ff;">null</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span><span style="color:#0000ff;">if</span> (userDS != <span style="color:#0000ff;">null</span>)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>           </span><span style="color:#0000ff;">if</span>(userDS.Tables[0].Rows.Count &gt; 0)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>             </span>bflag = <span style="color:#0000ff;">true</span>;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>       </span><span style="color:#0000ff;">return</span> bflag;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span>    </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;">}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-family:Verdana;"><span style="font-size:small;">That’s it. Its all Done. Your Login Page is ready. Its So Simple isn’t it!</span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ganeshmohan.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ganeshmohan.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ganeshmohan.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ganeshmohan.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ganeshmohan.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ganeshmohan.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ganeshmohan.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ganeshmohan.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ganeshmohan.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ganeshmohan.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ganeshmohan.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ganeshmohan.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ganeshmohan.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ganeshmohan.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ganeshmohan.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ganeshmohan.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=7&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ganeshmohan.wordpress.com/2008/05/13/aspnet-c-login-page/feed/</wfw:commentRss>
		<slash:comments>114</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a383411b9a4f1ce9a6a0264c0d90448b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">GaneshMohan</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.Net C# and Javascript Count Down Timer</title>
		<link>http://ganeshmohan.wordpress.com/2008/05/12/count-down-timer-aspnet-javascript-c/</link>
		<comments>http://ganeshmohan.wordpress.com/2008/05/12/count-down-timer-aspnet-javascript-c/#comments</comments>
		<pubDate>Mon, 12 May 2008 06:54:08 +0000</pubDate>
		<dc:creator>Ganesh Mohan</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Count]]></category>
		<category><![CDATA[Down]]></category>
		<category><![CDATA[Timer]]></category>

		<guid isPermaLink="false">http://ganeshmohan.wordpress.com/?p=6</guid>
		<description><![CDATA[ASP.Net, C# and Javascript Count Down Timer ASP.Net Code While displaying a count down timer on your Web Page you need to do following things : On the web page you need to add 7 controls. In that one is HTML Text box which displays the count down time &#60;input type=&#8221;text&#8221; readonly =&#8221;true&#8221; size=&#8221;8&#8243; id=&#8221;counter&#8221; style=&#8221;text-align:center; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=6&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div><strong></strong></div>
<p><strong><span style="text-decoration:underline;"></span></strong></p>
<p class="MsoNormal" style="margin:0;"><strong><strong><span style="text-decoration:underline;"><span style="font-size:20pt;">ASP.Net, C# and Javascript Count Down Timer</span></span></strong></strong></p>
<p><strong></strong></p>
<p><strong><span style="text-decoration:underline;"><span style="font-size:10pt;color:#000000;font-family:Verdana;">ASP.Net Code</span></span></strong></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">While displaying a count down timer on your Web Page you need to do following things :</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">On the web page you need to add 7 controls.</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">In that one is HTML Text box which displays the count down time</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&lt;</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">input</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">type</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;text&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">readonly</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;true&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">size</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;8&#8243;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">id</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;counter&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">style</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;text-align:center; font-size:x-large; font-weight:bold; color:Red;&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">/&gt;</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;"> and rest of six are hidden fields in which three of them are HTML controls and other are ASP controls looks loke this </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&lt;</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">input</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">type</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;hidden&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">size</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;8&#8243;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">id</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;HidHours&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">value</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">&lt;%=HidH.Value%&gt;</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&#8220;/&gt;</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&lt;</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">input</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">type</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;hidden&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">size</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;8&#8243;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">id</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;HidMinutes&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">value</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">&lt;%=HidM.Value%&gt;</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&#8220;/&gt;</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&lt;</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">input</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">type</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;hidden&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">size</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;8&#8243;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">id</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;HidSeconds&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">value</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">&lt;%=HidS.Value%&gt;</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&#8220;/&gt;</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&lt;</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">asp</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">:</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">HiddenField</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">ID</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;HidH&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">runat</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;server&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">Value</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;0&#8243;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">/&gt;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&lt;</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">asp</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">:</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">HiddenField</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">ID</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;HidM&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">runat</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;server&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">Value</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;0&#8243;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> /&gt; </span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&lt;</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">asp</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">:</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">HiddenField</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">ID</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;HidS&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">runat</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;server&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#ff0000;font-family:Verdana;">Value</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">=&#8221;0&#8243;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">/&gt;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#000000;font-family:Verdana;"> Now you need to write the main JavaScript part which displays this count down time</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&lt;</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">script</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&gt;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">var</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> hours=document.getElementById(</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">&#8216;HidHours&#8217;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">).value;</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;"> </span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">var</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> minutes=document.getElementById(</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">&#8216;HidMinutes&#8217;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">).value;</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">var</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> seconds=document.getElementById(</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">&#8216;HidSeconds&#8217;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">).value;</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">function</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">display()</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">{ </span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">if</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> (seconds&lt;=0)</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">if </span><span style="font-size:10pt;color:#000000;font-family:Verdana;">((hours==0)&amp;&amp;(minutes==0)) </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">seconds=0;</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">else</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">{</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">seconds=60;</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">minutes-=1; </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">}</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">} </span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">if</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> (minutes&lt;=0)</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">{ </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">if </span><span style="font-size:10pt;color:#000000;font-family:Verdana;">((hours&lt;0)&amp;&amp;(minutes&lt;0)) </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">{</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">hours = minutes = seconds = 0;</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">else</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">if </span><span style="font-size:10pt;color:#000000;font-family:Verdana;">((hours==0)&amp;&amp;(minutes==0)) </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">hours=minutes=0;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">if </span><span style="font-size:10pt;color:#000000;font-family:Verdana;">((hours&gt;0)&amp;&amp;(minutes&lt;0)) </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">{</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">minutes=59;</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">hours-=1; </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">}</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">}</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">} </span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">if</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> ((minutes&lt;=-1)||(hours&lt;=-1))</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">{ </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">if </span><span style="font-size:10pt;color:#000000;font-family:Verdana;">(hours&lt;=-1) </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">{</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">minutes=0;</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">hours+=1;</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">}</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">else</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">minutes-=1;</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">seconds=0; </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">minutes+=1; </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">} </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">else</span><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">if </span><span style="font-size:10pt;color:#000000;font-family:Verdana;">(seconds&gt;0) </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">seconds-=1;</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;"> if (seconds &lt;= 9 &amp;&amp; seconds.toString().length &lt; 2)<br />
seconds = &#8220;0&#8243;+seconds;</p>
<p>if (minutes &lt;= 9 &amp;&amp; minutes.toString().length &lt; 2)<br />
minutes = &#8220;0&#8243;+minutes;</p>
<p>if (hours &lt;= 9  &amp;&amp; hours.toString().length &lt; 2)<br />
hours = &#8220;0&#8243;+hours;<br />
</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">document.getElementById(</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">&#8216;counter&#8217;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">).value=hours+</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">&#8220;:&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">+minutes+</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">&#8220;:&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">+seconds; </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">setTimeout(</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">&#8220;display()&#8221;</span><span style="font-size:10pt;color:#000000;font-family:Verdana;">,1000); </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">} </span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;">display(); </span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&lt;/</span><span style="font-size:10pt;color:#800000;font-family:Verdana;">script</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">&gt;</span></p>
<p><span style="font-size:10pt;color:#000000;font-family:Verdana;"> </span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">The Main Concept Over Here is the Time from where the count down begins that time you need to pass into ASP Hidden fields whose id are HidH, HidM and HidS which defines hours, minutes and seconds respectively. Now these values are passed to HTML Hidden Controls whose id are  HidHours, HidMinutes and HidSeconds since the values of ASP controls value&#8217;s can not be passed directly to JavaScript code. We kept HTML controls as bridge between ASP controls Value&#8217;s and JavaScript. and Now Javascript function display() is called recursively until hours, minutes and seconds becomes zero. Once it is zero you can redirect to any page you want</span></p>
<p><strong><span style="text-decoration:underline;"><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">C# Code</span></span></strong></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">TimeSpan ts;</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">HidH.Value = </span><span style="font-size:10pt;color:#008080;font-family:Verdana;">Convert</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">.ToString(ts.Hours);</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">HidM.Value = </span><span style="font-size:10pt;color:#008080;font-family:Verdana;">Convert</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">.ToString(ts.Minutes);</span></p>
<p><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">HidS.Value = </span><span style="font-size:10pt;color:#008080;font-family:Verdana;">Convert</span><span style="font-size:10pt;color:#0000ff;font-family:Verdana;">.ToString(ts.Seconds); </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> click here : <a href="http://groups.google.co.in/group/dotnethelp2008/web/count-down-timer-asp-net-javascript-and-c?hl=en&amp;msg=ns">http://groups.google.co.in/group/dotnethelp2008/web/count-down-timer-asp-net-javascript-and-c?hl=en&amp;msg=ns</a></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ganeshmohan.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ganeshmohan.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ganeshmohan.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ganeshmohan.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ganeshmohan.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ganeshmohan.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ganeshmohan.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ganeshmohan.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ganeshmohan.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ganeshmohan.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ganeshmohan.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ganeshmohan.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ganeshmohan.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ganeshmohan.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ganeshmohan.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ganeshmohan.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ganeshmohan.wordpress.com&amp;blog=3292742&amp;post=6&amp;subd=ganeshmohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ganeshmohan.wordpress.com/2008/05/12/count-down-timer-aspnet-javascript-c/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a383411b9a4f1ce9a6a0264c0d90448b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">GaneshMohan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
