<?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>Razeeb's Weblog</title>
	<atom:link href="http://razeeb.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://razeeb.wordpress.com</link>
	<description></description>
	<lastBuildDate>Wed, 12 Oct 2011 16:15:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='razeeb.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Razeeb's Weblog</title>
		<link>http://razeeb.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://razeeb.wordpress.com/osd.xml" title="Razeeb&#039;s Weblog" />
	<atom:link rel='hub' href='http://razeeb.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Searching for &#8216;%&#8217; using SQL &#8216;Like&#8217; predicate</title>
		<link>http://razeeb.wordpress.com/2009/07/28/searching-for-using-sql-like-predicate/</link>
		<comments>http://razeeb.wordpress.com/2009/07/28/searching-for-using-sql-like-predicate/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 18:58:00 +0000</pubDate>
		<dc:creator>razeeb</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://razeeb.wordpress.com/?p=86</guid>
		<description><![CDATA[A few day ago I was looking for a way to search a column for &#8216;%&#8217; using SQL &#8216;Like&#8217; predicate. I found 2 ways to do this while reading the book &#8220;Microsoft SQL Server 2008 T-SQL fundamentals&#8221; by Itzik Ben-Gan published by Microsoft Press. Solution 1: If the searched character is a wild card character [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=86&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A few day ago I was looking for a way to search a column for &#8216;%&#8217; using SQL &#8216;Like&#8217; predicate. I found 2 ways to do this while reading the book &#8220;Microsoft SQL Server 2008 T-SQL fundamentals&#8221; by Itzik Ben-Gan published by Microsoft Press.</p>
<p><strong>Solution 1:</strong></p>
<p>If the searched character is a wild card character (&#8220;%&#8221;, &#8220;_&#8221;, &#8220;["), then put it in a third bracket.</p>
<p>Example: For searching '%', use column_name LIKE '%[%]%&#8217;</p>
<p>Note that, for searching &#8220;]&#8221;, this method cannot be used. For this case, use Solution 2.</p>
<p><strong>Solution 2:</strong></p>
<p>Using this method we need to specify a character as an escape character in front of the character we are searching for, and specify the keyword &#8220;ESCAPE&#8221; followed by the escape character right after the pattern.</p>
<p>Example: For searching &#8216;%&#8217;, use column_name LIKE &#8216;%!%%&#8217; ESCAPE &#8216;!&#8217;</p>
<p>This syntax says that the character &#8220;!&#8221; is an escape character and therefore, the character just after &#8220;!&#8221; is to be searched. Note that, we need to make sure that the character we are using as an escape character must not appear in the data.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/razeeb.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/razeeb.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/razeeb.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/razeeb.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/razeeb.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/razeeb.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/razeeb.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/razeeb.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/razeeb.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/razeeb.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/razeeb.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/razeeb.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/razeeb.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/razeeb.wordpress.com/86/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=86&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://razeeb.wordpress.com/2009/07/28/searching-for-using-sql-like-predicate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a8b382f84a7d30a0a9c3ab18cd360fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">razeeb</media:title>
		</media:content>
	</item>
		<item>
		<title>Considerations while making a control invisible</title>
		<link>http://razeeb.wordpress.com/2009/04/05/considerations-while-making-a-control-invisible/</link>
		<comments>http://razeeb.wordpress.com/2009/04/05/considerations-while-making-a-control-invisible/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 04:14:33 +0000</pubDate>
		<dc:creator>razeeb</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://razeeb.wordpress.com/?p=78</guid>
		<description><![CDATA[If we want to make a control invisible in asp.net, may be the most straight forward way is to set the Visible property to &#8220;false&#8221;. As long as we are accessing this control from server side, there is no problem. However, if we need to access it from client side using JavaScript, then we have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=78&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If we want to make a control invisible in asp.net, may be the most straight forward way is to set the Visible property to &#8220;false&#8221;. As long as we are accessing this control from server side, there is no problem. However, if we need to access it from client side using JavaScript, then we have a problem. Once we make the control invisible by setting the Visible property to &#8220;false&#8221;, we will no longer be able to access it from client side using JavaScript and we will not find the control using document.getElementById(&#8220;controlID&#8221;).</p>
<p>Solution to this problem is to use the style property to make it invisible. Here are some considerations as well. By using style, we can make a control invisible in two ways.</p>
<ol>
<li>using visibility:hidden</li>
<li>using display:none</li>
</ol>
<p>By using any one of the above 2 ways we can still access a control by using document.getElementById(&#8220;controlID&#8221;) but if we use visibility:hidden, the control will still occupy the space. On the other hand, the control will not occupy space if &#8220;display:none&#8221; is used.</p>
<p><strong>Making a button coltrol invisible using style</strong></p>
<p>To make a control invisible from aspx page the following code can be used</p>
<div id="attachment_79" class="wp-caption alignnone" style="width: 520px"><img class="size-full wp-image-79" title="display_none_aspx" src="http://razeeb.files.wordpress.com/2009/04/display_none_aspx.jpg?w=510&#038;h=17" alt="Setting display style from aspx page" width="510" height="17" /><p class="wp-caption-text">Setting display style from aspx page</p></div>
<p>To make a control invisible from cs page the following code can be used</p>
<div id="attachment_80" class="wp-caption alignnone" style="width: 376px"><img class="size-full wp-image-80" title="display_none_cs" src="http://razeeb.files.wordpress.com/2009/04/display_none_cs.jpg?w=510" alt="setting display style from cs file"   /><p class="wp-caption-text">setting display style from cs file</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/razeeb.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/razeeb.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/razeeb.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/razeeb.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/razeeb.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/razeeb.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/razeeb.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/razeeb.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/razeeb.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/razeeb.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/razeeb.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/razeeb.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/razeeb.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/razeeb.wordpress.com/78/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=78&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://razeeb.wordpress.com/2009/04/05/considerations-while-making-a-control-invisible/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a8b382f84a7d30a0a9c3ab18cd360fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">razeeb</media:title>
		</media:content>

		<media:content url="http://razeeb.files.wordpress.com/2009/04/display_none_aspx.jpg" medium="image">
			<media:title type="html">display_none_aspx</media:title>
		</media:content>

		<media:content url="http://razeeb.files.wordpress.com/2009/04/display_none_cs.jpg" medium="image">
			<media:title type="html">display_none_cs</media:title>
		</media:content>
	</item>
		<item>
		<title>Postback a .Net page with JavaScript</title>
		<link>http://razeeb.wordpress.com/2009/01/19/postback-a-net-page-with-javascript/</link>
		<comments>http://razeeb.wordpress.com/2009/01/19/postback-a-net-page-with-javascript/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 20:08:06 +0000</pubDate>
		<dc:creator>razeeb</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://razeeb.wordpress.com/?p=60</guid>
		<description><![CDATA[A .Net page can be posted back with JavaScript. We can call __doPostBack() function to generate a manual postback. The following example shows how to do the postback manually with JavaScript and detect the manual postback from server side. In our example, we will call &#8220;PerformTask()&#8221; server side method on postback. The __doPostBack() function takes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=60&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A .Net page can be posted back with JavaScript. We can call __doPostBack() function to generate a manual postback.</p>
<p>The following example shows how to do the postback manually with JavaScript and detect the manual postback from server side. In our example, we will call &#8220;PerformTask()&#8221; server side method on postback. The __doPostBack() function takes two parameters &#8212; eventTarget and eventArgument.</p>
<p><strong>JavaScript:</strong></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;">__doPostBack(&#8216;__Page&#8217;, &#8216;performTask&#8217;);</span></p>
<p><strong>Server side:</strong></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;">protected void Page_Load(object sender, System.EventArgs e)</span></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;">{</span></p>
<p style="padding-left:60px;"><span style="color:#ff99cc;">if(Page.IsPostBack)</span></p>
<p style="padding-left:60px;"><span style="color:#ff99cc;">{</span></p>
<p style="padding-left:90px;"><span style="color:#ff99cc;">if(Request["__EVENTARGUMENT"] == &#8220;performTask&#8221;)</span></p>
<p style="padding-left:90px;"><span style="color:#ff99cc;">{</span></p>
<p style="padding-left:120px;"><span style="color:#ff99cc;">PerformTask();</span></p>
<p style="padding-left:90px;"><span style="color:#ff99cc;">}</span></p>
<p style="padding-left:60px;"><span style="color:#ff99cc;">}</span></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;">}</span></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;">private void PerformTask()</span></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;">{</span></p>
<p style="padding-left:60px;"><span style="color:#ff99cc;">//perform the processing after manual postback</span></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;">}</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/razeeb.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/razeeb.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/razeeb.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/razeeb.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/razeeb.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/razeeb.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/razeeb.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/razeeb.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/razeeb.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/razeeb.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/razeeb.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/razeeb.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/razeeb.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/razeeb.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=60&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://razeeb.wordpress.com/2009/01/19/postback-a-net-page-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a8b382f84a7d30a0a9c3ab18cd360fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">razeeb</media:title>
		</media:content>
	</item>
		<item>
		<title>Calling ASP.Net validators from JavaScript</title>
		<link>http://razeeb.wordpress.com/2009/01/11/calling-aspnet-validators-from-javascript/</link>
		<comments>http://razeeb.wordpress.com/2009/01/11/calling-aspnet-validators-from-javascript/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 09:28:05 +0000</pubDate>
		<dc:creator>razeeb</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://razeeb.wordpress.com/?p=23</guid>
		<description><![CDATA[There are situations when we want to call Asp.net validatiors form JavaScript. One such situation is when we want to close a pop up window on button click using window.close(). But before closing the window using JavaScript, we want to validate the data written in the controls of the window. It possible to call Asp.net [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=23&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are situations when we want to call Asp.net validatiors form JavaScript. One such situation is when we want to close a pop up window on button click using window.close(). But before closing the window using JavaScript, we want to validate the data written in the controls of the window.</p>
<p>It possible to call Asp.net validators from JavaScript. The following code shows a portion of asp.net page which includes one standard .net required field validator and one regular expression validator.</p>
<p><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;table&gt;</span></span></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;tr&gt;</span></span></p>
<p style="padding-left:60px;"><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;td&gt;&lt;asp:Label ID=&#8221;lbl1&#8243; runat=&#8221;server&#8221; Text=&#8221;Please enter a digit&#8221;&gt;&lt;/asp:Label&gt;&lt;/td&gt;</span></span></p>
<p style="padding-left:60px;"><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;td&gt;&lt;asp:TextBox ID=&#8221;txtbox1&#8243; runat=&#8221;server&#8221;&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;</span></span></p>
<p style="padding-left:60px;"><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;td&gt;&lt;asp:RequiredFieldValidator ID=&#8221;valReq&#8221; ControlToValidate=&#8221;txtbox1&#8243; runat=&#8221;server&#8221; ErrorMessage=&#8221;*&#8221; Display=&#8221;Dynamic&#8221;&gt;<br />
&lt;/asp:RequiredFieldValidator&gt;<br />
&lt;asp:RegularExpressionValidator ID=&#8221;valreg&#8221; ControlToValidate=&#8221;txtbox1&#8243; runat=&#8221;server&#8221; ErrorMessage=&#8221;Not valid character&#8221; ValidationExpression=&#8221;[0-9]&#8220;&gt;<br />
&lt;/asp:RegularExpressionValidator&gt;&lt;/td&gt;</span></span></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;/tr&gt;</span></span></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;tr&gt;</span></span></p>
<p style="padding-left:60px;"><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;td&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;asp:Button ID=&#8221;btn1&#8243; runat=&#8221;server&#8221; Text=&#8221;Submit&#8221; OnClientClick=&#8221;performCheck()&#8221;/&gt;&lt;/td&gt;</span><span style="color:#ff99cc;"> &lt;td&gt;&lt;/td&gt;<br />
</span></span></p>
<p style="padding-left:30px;"><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;/tr&gt;</span></span></p>
<p><span style="color:#ff99cc;"><span style="color:#ff99cc;">&lt;/table&gt;</span><br />
</span></p>
<p>In design mode, it looks as below</p>
<div id="attachment_26" class="wp-caption alignnone" style="width: 285px"><img class="size-full wp-image-26" title="ui" src="http://razeeb.files.wordpress.com/2009/01/ui.gif?w=510" alt="View in design mode"   /><p class="wp-caption-text">View in design mode</p></div>
<p>Now we want to make sure that .net validators get fired up on &#8220;Submit&#8221; button click before closing the window using javascript window.close(). In our example, we have a text box where we expect a single digit before closing the window.</p>
<p>All we have to do to fire up .net validators is to call &#8220;Page_ClientValidate()&#8221; function.  The following JavaScript code shows how &#8220;Page_ClientValidate()&#8221; function can be used before closeing window.</p>
<p><span style="color:#000000;"><span style="color:#ff99cc;">&lt;script type=&#8221;text/javascript&#8221; language=&#8221;javascript&#8221;&gt;</span></span></p>
<p><span style="color:#000000;"><span style="color:#ff99cc;">function performCheck()<br />
{</span></span></p>
<p style="padding-left:30px;"><span style="color:#000000;"><span style="color:#ff99cc;">if(Page_ClientValidate())<br />
{</span></span></p>
<p style="padding-left:60px;"><span style="color:#000000;"><span style="color:#ff99cc;">window.close();</span></span></p>
<p style="padding-left:30px;"><span style="color:#000000;"><span style="color:#ff99cc;">}</span></span></p>
<p><span style="color:#000000;"><span style="color:#ff99cc;">}<br />
&lt;/script&gt;</span><br />
</span></p>
<p>Now, if the Submit button is clicked leaving the text box empty, the required field validator will fire up as shown in the below screen shot.</p>
<div id="attachment_28" class="wp-caption alignnone" style="width: 301px"><img class="size-full wp-image-28" title="result1" src="http://razeeb.files.wordpress.com/2009/01/result1.gif?w=510" alt="Required field validotor fires up"   /><p class="wp-caption-text">Required field validotor fires up</p></div>
<p>If any thing is written in other than a single digit, we will get the following output.</p>
<div id="attachment_30" class="wp-caption alignnone" style="width: 403px"><img class="size-full wp-image-30" title="result2" src="http://razeeb.files.wordpress.com/2009/01/result21.gif?w=510" alt="Regular Expression Validator fires up"   /><p class="wp-caption-text">Regular Expression Validator fires up</p></div>
<p><strong>What about Calling any specific validator rather than all?</strong></p>
<p>Well, this can be done as well. In this case we need to provide a ValidationGroup name for the validator and pass the validator group name to Page_ClientValidate() function as parameter. The following code segment shows a group name is provided for the required field validator and passed it to <img src="/DOCUME%7E1/Sweep/LOCALS%7E1/Temp/moz-screenshot.jpg" alt="" /><img src="/DOCUME%7E1/Sweep/LOCALS%7E1/Temp/moz-screenshot-1.jpg" alt="" />Page_ClientValidate() function. In this case, only required field validatior will be fired up and not the regular expression validator.</p>
<p><span style="color:#000000;"><span style="color:#ff99cc;">&lt;table&gt;</span></span></p>
<p style="padding-left:30px;"><span style="color:#000000;"><span style="color:#ff99cc;">&lt;tr&gt;</span></span></p>
<p style="padding-left:60px;"><span style="color:#000000;"><span style="color:#ff99cc;">&lt;td&gt;&lt;asp:Label ID=&#8221;lbl1&#8243; runat=&#8221;server&#8221; Text=&#8221;Please enter a digit&#8221;&gt;&lt;/asp:Label&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;asp:TextBox ID=&#8221;txtbox1&#8243; runat=&#8221;server&#8221;&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;asp:RequiredFieldValidator ID=&#8221;valReq&#8221; ControlToValidate=&#8221;txtbox1&#8243; runat=&#8221;server&#8221;<br />
ErrorMessage=&#8221;*&#8221; <span style="color:#ff0000;">ValidationGroup=&#8221;Required&#8221;</span> Display=&#8221;Dynamic&#8221;&gt;<br />
&lt;/asp:RequiredFieldValidator&gt;<br />
&lt;asp:RegularExpressionValidator ID=&#8221;valreg&#8221; ControlToValidate=&#8221;txtbox1&#8243; runat=&#8221;server&#8221;<br />
ErrorMessage=&#8221;Not valid character&#8221; ValidationExpression=&#8221;[0-9]&#8220;<span style="color:#ff0000;"> ValidationGroup=&#8221;RegExpression&#8221;</span>&gt;<br />
&lt;/asp:RegularExpressionValidator&gt;&lt;/td&gt;</span></span></p>
<p style="padding-left:30px;"><span style="color:#000000;"><span style="color:#ff99cc;">&lt;/tr&gt;</span></span></p>
<p style="padding-left:30px;"><span style="color:#000000;"><span style="color:#ff99cc;">&lt;tr&gt;<br />
</span></span></p>
<p style="padding-left:60px;"><span style="color:#000000;"><span style="color:#ff99cc;">&lt;td&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;asp:Button ID=&#8221;btn1&#8243; runat=&#8221;server&#8221; Text=&#8221;Submit&#8221; OnClientClick=&#8221;performCheck()&#8221;/&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;/td&gt;</span></span></p>
<p style="padding-left:30px;"><span style="color:#000000;"><span style="color:#ff99cc;">&lt;/tr&gt;</span></span></p>
<p><span style="color:#000000;"><span style="color:#ff99cc;">&lt;/table&gt;</span><br />
</span></p>
<p><span style="color:#000000;"><span style="color:#ff99cc;">&lt;script type=&#8221;text/javascript&#8221; language=&#8221;javascript&#8221;&gt;<br />
function performCheck()<br />
{</span></span></p>
<p style="padding-left:30px;"><span style="color:#000000;"><span style="color:#ff99cc;">if(Page_ClientValidate(<span style="color:#ff0000;">&#8220;Required&#8221;</span>))<br />
{</span></span></p>
<p style="padding-left:60px;"><span style="color:#000000;"><span style="color:#ff99cc;">window.close();</span></span></p>
<p style="padding-left:30px;"><span style="color:#000000;"><span style="color:#ff99cc;">}</span></span></p>
<p><span style="color:#000000;"><span style="color:#ff99cc;">}<br />
&lt;/script&gt;</span></span></p>
<p><span style="color:#000000;"><span style="color:#ff99cc;"><br />
</span></span></p>
<p><strong>Advantage</strong></p>
<p>By using standard asp.net validators for validation, we don&#8217;t have to write JavaScript code to do the validation. This can minimize the development time to a great extent.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/razeeb.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/razeeb.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/razeeb.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/razeeb.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/razeeb.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/razeeb.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/razeeb.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/razeeb.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/razeeb.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/razeeb.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/razeeb.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/razeeb.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/razeeb.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/razeeb.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=23&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://razeeb.wordpress.com/2009/01/11/calling-aspnet-validators-from-javascript/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a8b382f84a7d30a0a9c3ab18cd360fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">razeeb</media:title>
		</media:content>

		<media:content url="http://razeeb.files.wordpress.com/2009/01/ui.gif" medium="image">
			<media:title type="html">ui</media:title>
		</media:content>

		<media:content url="http://razeeb.files.wordpress.com/2009/01/result1.gif" medium="image">
			<media:title type="html">result1</media:title>
		</media:content>

		<media:content url="http://razeeb.files.wordpress.com/2009/01/result21.gif" medium="image">
			<media:title type="html">result2</media:title>
		</media:content>
	</item>
		<item>
		<title>Unit testing private method using System.Reflection in .NET</title>
		<link>http://razeeb.wordpress.com/2009/01/02/unit-testing-private-method-using-systemreflection-in-net/</link>
		<comments>http://razeeb.wordpress.com/2009/01/02/unit-testing-private-method-using-systemreflection-in-net/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 17:15:33 +0000</pubDate>
		<dc:creator>razeeb</dc:creator>
				<category><![CDATA[NUnit test]]></category>

		<guid isPermaLink="false">http://razeeb.wordpress.com/?p=7</guid>
		<description><![CDATA[Though we cannot test a private method using NUnit, we can do this using Reflection. Suppose, we have a class named &#8220;CellPhone&#8221; and it has a private method with the following signature &#8211; private bool SendMessage(string MsgBody, int length) We can test the method using the the following code segment &#8211; Type cellPhoneType = type0f(CellPhone); [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=7&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Though we cannot test a private method using NUnit, we can do this using Reflection. Suppose, we have a class named &#8220;CellPhone&#8221; and it has a private method with the following signature &#8211;</p>
<p><span style="color:#ff99cc;">private bool SendMessage(string MsgBody, int length)</span></p>
<p>We can test the method using the the following code segment &#8211;</p>
<p><span style="color:#ff99cc;">Type cellPhoneType = type0f(CellPhone);</span></p>
<p><span style="color:#ff99cc;">MethodInfo sendMessageInfo = cellPhoneType.GetMethod(&#8220;SendMessage&#8221;, BindingFlags.NonPublic | BindingFlags.Instance);</span></p>
<p><span style="color:#ff99cc;">bool isSent = (bool) sendMessageInfo.Invoke(new CellPhone(), new object[]{&#8220;Hello there, how are you&#8221;,  24});</span></p>
<p><strong><br />
</strong></p>
<p>The first parameter to the Invoke method is an object on which the method will be operated and the second parameter an array of object. This array contains the parameter values of the method.</p>
<p>The MethodInfo class is in System.Reflection package. Please note that if the &#8220;SendMessage&#8221; Method was a static method then we had to set the BindingFlags.Static instead of BindingFlags.Instance and in Invoke method, we had to pass null instead of an object. For private static method we will have the following code -</p>
<p><span style="color:#ff99cc;">Type cellPhoneType = type0f(CellPhone);</span></p>
<p><span style="color:#ff99cc;">MethodInfo sendMessageInfo = cellPhoneType.GetMethod(&#8220;SendMessage&#8221;, BindingFlags.NonPublic | BindingFlags.Static);</span></p>
<p><span style="color:#ff99cc;">bool isSent = (bool) sendMessageInfo.Invoke(null, new object[]{&#8220;Hello there, how are you&#8221;,  24});</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/razeeb.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/razeeb.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/razeeb.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/razeeb.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/razeeb.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/razeeb.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/razeeb.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/razeeb.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/razeeb.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/razeeb.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/razeeb.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/razeeb.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/razeeb.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/razeeb.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=7&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://razeeb.wordpress.com/2009/01/02/unit-testing-private-method-using-systemreflection-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a8b382f84a7d30a0a9c3ab18cd360fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">razeeb</media:title>
		</media:content>
	</item>
		<item>
		<title>Formatting a double value to monetary value in .NET</title>
		<link>http://razeeb.wordpress.com/2008/04/20/formatting-a-double-value-to-monetary-value-in-net/</link>
		<comments>http://razeeb.wordpress.com/2008/04/20/formatting-a-double-value-to-monetary-value-in-net/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 18:09:40 +0000</pubDate>
		<dc:creator>razeeb</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://razeeb.wordpress.com/?p=4</guid>
		<description><![CDATA[Sometimes we want to format a double value to monetary value. For example, consider the double value &#8220;1234.5678&#8243;. We want to format this value as &#8220;$1,234.56&#8243;. We can do this very easily. double d = 2234500.2345; Response.Write("$" + d.ToString("#,#.00")); //output - $2,234,500.23 Response.Write("$" + d.ToString("#,#.000")); //output - $2,234,500.235 Response.Write("$" + d.ToString("#,#.0000")); //output - $2,234,500.2345 It [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=4&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes we want to format a double value to monetary value. For example, consider the double value &#8220;1234.5678&#8243;. We want to format this value as &#8220;$1,234.56&#8243;. We can do this very easily.</p>
<p><code><br />
<span style="color:#ff99cc;">double d = 2234500.2345;<br />
Response.Write("$" + d.ToString("#,#.00"));<br />
//output - $2,234,500.23<br />
Response.Write("$" + d.ToString("#,#.000"));<br />
//output - $2,234,500.235<br />
Response.Write("$" + d.ToString("#,#.0000"));<br />
//output - $2,234,500.2345</span></code></p>
<p>It also takes care of rounding the value. consider the following code.</p>
<p><code><br />
<span style="color:#ff99cc;">double d1 = 1234.124;<br />
double d2 = 1234.125;<br />
Response.Write("$" + d1.ToString("#,#.00"));<br />
//outputs $1,234.12<br />
Response.Write("$" + d2.ToString("#,#.00"));<br />
//outputs $1,234.13</span><br />
</code></p>
<p>This technique may be useful in the case when we retrieve data from the database and have to convert a varchar to monetary value. For example, if we are retrieving data using data reader, we can do the following:</p>
<p><code><br />
<span style="color:#ff99cc;">//dr is DataReader<br />
Response.Write("$" + (Convert.ToDouble(dr["ColumnName"].ToString())).ToString("#,#.00"));</span><br />
</code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/razeeb.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/razeeb.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/razeeb.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/razeeb.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/razeeb.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/razeeb.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/razeeb.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/razeeb.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/razeeb.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/razeeb.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/razeeb.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/razeeb.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/razeeb.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/razeeb.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/razeeb.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/razeeb.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=razeeb.wordpress.com&amp;blog=3152037&amp;post=4&amp;subd=razeeb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://razeeb.wordpress.com/2008/04/20/formatting-a-double-value-to-monetary-value-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a8b382f84a7d30a0a9c3ab18cd360fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">razeeb</media:title>
		</media:content>
	</item>
	</channel>
</rss>
