<?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>You need hard work to get Lucky!</title>
	<atom:link href="http://zeemalik.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://zeemalik.wordpress.com</link>
	<description>They are ill discoverers that think there is no land, when they can see nothing but sea.</description>
	<lastBuildDate>Tue, 22 Nov 2011 12:20:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='zeemalik.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>You need hard work to get Lucky!</title>
		<link>http://zeemalik.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://zeemalik.wordpress.com/osd.xml" title="You need hard work to get Lucky!" />
	<atom:link rel='hub' href='http://zeemalik.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How to handle single quote in SQL Query or DataSet.Select ?</title>
		<link>http://zeemalik.wordpress.com/2010/06/30/how-to-handle-single-quote-in-sql-query-or-dataset-select/</link>
		<comments>http://zeemalik.wordpress.com/2010/06/30/how-to-handle-single-quote-in-sql-query-or-dataset-select/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 07:53:35 +0000</pubDate>
		<dc:creator>zeemalik</dc:creator>
				<category><![CDATA[Asp.net]]></category>
		<category><![CDATA[DataSet.Select]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[Single Quote]]></category>
		<category><![CDATA[SQL Query]]></category>

		<guid isPermaLink="false">http://zeemalik.wordpress.com/?p=17</guid>
		<description><![CDATA[Problem : When we try to select/filter records based on a column value which contains a single quote then the SQL server will give syntax error because there is a single quote in the start and at the end of SQL query normaly. Solution 1:  Parameterized Query We can use parameterized query to avoid the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeemalik.wordpress.com&amp;blog=2188373&amp;post=17&amp;subd=zeemalik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Problem :</strong> When we try to select/filter records based on a column value which contains a single quote then the SQL server will give syntax error because there is a single quote in the start and at the end of SQL query normaly.</p>
<p><strong>Solution 1:</strong>  <span style="text-decoration:underline;">Parameterized Query</span></p>
<p>We can use parameterized query to avoid the single quote issue like this:</p>
<p>string VendorName = &#8220;John O&#8217;Corner&#8221;;</p>
<p>command.CommandText = &#8220;SELECT * FROM Products WHERE VendorName= @VendorName&#8221;;</p>
<p>command.Parameters.Add(<br />
       new SqlParameter(&#8220;@VendorName&#8221;, SqlDbType.VarChar, 50)).Value = VendorName;</p>
<p><strong>Solution 2:</strong>  <span style="text-decoration:underline;">Replace Single Quote</span></p>
<p>Another option is that you can replace single quote with two single quotes. This will give an effect of a string end then string start in SQL Query. This method is especially suitable while we are selecting records in a dataset.</p>
<p><span style="color:#000000;"><span style="font-size:x-small;">SystemDataSet.ProductRow</span><span style="font-size:x-small;">[] productRows = </span><span style="font-size:x-small;"> dataSet.Products.Select( </span><span style="color:#a31515;font-size:x-small;"><span style="color:#a31515;font-size:x-small;">&#8221; VendorName = &#8216;&#8221;</span></span><span style="font-size:x-small;"> + VendorName.Replace( </span><span style="color:#a31515;font-size:x-small;"><span style="color:#a31515;font-size:x-small;">&#8220;&#8216;&#8221;</span></span><span style="font-size:x-small;">, </span><span style="color:#a31515;font-size:x-small;"><span style="color:#a31515;font-size:x-small;">&#8220;&#8221;&#8221;</span></span><span style="font-size:x-small;"> ) + </span><span style="color:#a31515;font-size:x-small;"><span style="color:#a31515;font-size:x-small;">&#8220;&#8216;&#8221;</span></span><span style="font-size:x-small;"> );</span></span></p>
<br />Filed under: <a href='http://zeemalik.wordpress.com/category/aspnet/'>Asp.net</a> Tagged: <a href='http://zeemalik.wordpress.com/tag/dataset-select/'>DataSet.Select</a>, <a href='http://zeemalik.wordpress.com/tag/filter/'>Filter</a>, <a href='http://zeemalik.wordpress.com/tag/single-quote/'>Single Quote</a>, <a href='http://zeemalik.wordpress.com/tag/sql-query/'>SQL Query</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeemalik.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeemalik.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeemalik.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeemalik.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zeemalik.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zeemalik.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zeemalik.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zeemalik.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeemalik.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeemalik.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeemalik.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeemalik.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeemalik.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeemalik.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeemalik.wordpress.com&amp;blog=2188373&amp;post=17&amp;subd=zeemalik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zeemalik.wordpress.com/2010/06/30/how-to-handle-single-quote-in-sql-query-or-dataset-select/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba3c2fe89dcf18cff621c1ead5da5abb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zeemalik</media:title>
		</media:content>
	</item>
		<item>
		<title>How to access deleted rows in a typed dataset?</title>
		<link>http://zeemalik.wordpress.com/2010/03/09/how-to-access-deleted-rows-in-a-typed-dataset/</link>
		<comments>http://zeemalik.wordpress.com/2010/03/09/how-to-access-deleted-rows-in-a-typed-dataset/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 07:32:55 +0000</pubDate>
		<dc:creator>zeemalik</dc:creator>
				<category><![CDATA[Asp.net]]></category>

		<guid isPermaLink="false">http://zeemalik.wordpress.com/?p=11</guid>
		<description><![CDATA[  Sometimes after doing some processing on a dataset and before finally committing the changes in the database we need to know some information about added, modified, deleted or dispatched rows in the dataset. One of the well known approaches  is to loop the rows of a data set and check the &#8216;RowState&#8217; value of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeemalik.wordpress.com&amp;blog=2188373&amp;post=11&amp;subd=zeemalik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>Sometimes after doing some processing on a dataset and before finally committing the changes in the database we need to know some information about added, modified, deleted or dispatched rows in the dataset. One of the well known approaches  is to loop the rows of a data set and check the &#8216;RowState&#8217; value of each row which could be added, modified, deleted or dispatched. But when you are using a transaction in your code then you will notice that after updating the changes in database and before committing the transaction you will lose the deleted rows although you will still be able to get the rowstate of added and modified rows. This was irritating for me as i wanted to get the count of deleted rows in my code. The fortunately i came accross another nicer method of accessing added, modified, deleted and dispatched rows which is <span style="color:#0000ff;"><strong>Table.GetChanges(&#8216;RowsState&#8217;)</strong></span>. In this way you can separately make tables for each kind of rows and then use them for your purpose. Here is an example of &#8216;Customer&#8217; table.</p>
<p><span style="color:#0000ff;"> DataTable tableAddedRows, tableModifiedRows, tableDeletedRows, tableDispatchedRows;</span><br />
<span style="color:#0000ff;"><br />
 tableAddedRows = myDataSet.tables["Customer"].Rows()[0].Table.GetChanges( DataRowState.Added );<br />
 tableModifiedRows = myDataSet.tables["Customer"].Rows()[0].Table.GetChanges( DataRowState.Modified); <br />
 tableDeletedRows = myDataSet.tables["Customer"].Rows()[0].Table.GetChanges( DataRowState.Deleted );<br />
 tableDispatchedRows = myDataSet.tables["Customer"].Rows()[0].Table.GetChanges( DataRowState.Dispatched);</span></p>
<p><span style="color:#0000ff;"><br />
</span>Now you can use these tables to do whatever you want. Please note that if there is no row of any one of these rowstates then its corresponding table will be null.</p>
<p>I hope this helps!</p>
<br />Filed under: <a href='http://zeemalik.wordpress.com/category/aspnet/'>Asp.net</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeemalik.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeemalik.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeemalik.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeemalik.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zeemalik.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zeemalik.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zeemalik.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zeemalik.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeemalik.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeemalik.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeemalik.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeemalik.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeemalik.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeemalik.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeemalik.wordpress.com&amp;blog=2188373&amp;post=11&amp;subd=zeemalik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zeemalik.wordpress.com/2010/03/09/how-to-access-deleted-rows-in-a-typed-dataset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba3c2fe89dcf18cff621c1ead5da5abb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zeemalik</media:title>
		</media:content>
	</item>
		<item>
		<title>The SMTP server requires a secure connection or the client was not authenticated</title>
		<link>http://zeemalik.wordpress.com/2009/02/18/the-smtp-server-requires-a-secure-connection-or-the-client-was-not-authenticated/</link>
		<comments>http://zeemalik.wordpress.com/2009/02/18/the-smtp-server-requires-a-secure-connection-or-the-client-was-not-authenticated/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 20:41:44 +0000</pubDate>
		<dc:creator>zeemalik</dc:creator>
				<category><![CDATA[Asp.net]]></category>

		<guid isPermaLink="false">http://zeemalik.wordpress.com/?p=4</guid>
		<description><![CDATA[Problem: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. c25sm1228430ika.11     Solution:     Public Shared Sub SendEmail()         Dim Message As New Net.Mail.MailMessage()       Dim FromEmail As New Net.Mail.MailAddress(&#8220;From Email Address&#8221;)     Message.From = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeemalik.wordpress.com&amp;blog=2188373&amp;post=4&amp;subd=zeemalik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="margin:auto 0;"><span style="font-size:12pt;color:windowtext;font-family:&quot;">Problem</span><span style="font-size:large;color:#800000;font-family:Verdana;">: </span><span class="SubtitleChar"><span style="font-size:12pt;color:windowtext;"><span style="font-family:Cambria;">The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. c25sm1228430ika.11 </span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><span class="value1"><span style="font-size:8pt;color:#333333;font-family:&quot;"> </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:small;"><span style="font-family:Times New Roman;"><strong>Solution</strong>: </span></span></p>
<p class="MsoNormal" style="margin:0;"><span class="value1"><span style="font-size:8pt;color:#333333;font-family:&quot;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span class="value1"><span style="font-size:8pt;color:#333333;font-family:&quot;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:blue;font-family:&quot;">Public</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">Shared</span> <span style="color:blue;">Sub</span> SendEmail()</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span><span style="color:blue;">Dim</span> Message <span style="color:blue;">As</span> <span style="color:blue;">New</span> Net.Mail.MailMessage()</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span><span style="color:blue;">Dim</span> FromEmail <span style="color:blue;">As</span> <span style="color:blue;">New</span> Net.Mail.MailAddress(<span style="color:#a31515;">&#8220;From Email Address&#8221;</span>)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span>Message.From = FromEmail</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span>Message.To.Add(<span style="color:#a31515;">&#8220;To Email Address&#8221;</span>)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span>Message.Subject = <span style="color:#a31515;">&#8220;Subject of the Email&#8221;</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span>Message.Body = <span style="color:#a31515;">&#8220;Body of the Email&#8221;</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span><span style="color:green;">&#8216;Message.SubjectEncoding = System.Text.Encoding.UTF8</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span><span style="color:green;">&#8216;Message.BodyEncoding = System.Text.Encoding.UTF8</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span><span style="color:green;">&#8216;Message.IsBodyHtml = False</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span><span style="color:green;">&#8216;Message.Priority = Net.Mail.MailPriority.High</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:green;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span><span style="color:blue;">Dim</span> SmtpClient <span style="color:blue;">As</span> <span style="color:blue;">New</span> Net.Mail.SmtpClient(<span style="color:#a31515;">&#8220;smtp.YourEmailServer.com&#8221;</span>, PortNo eg: 587 for gmail )</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span>SmtpClient.EnableSsl = <span style="color:blue;">True</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span><span style="color:green;">&#8216;smtp.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span><span style="color:green;">&#8216;smtp.UseDefaultCredentials = False</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:green;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0 0 0 24pt;"><span style="font-size:10pt;font-family:&quot;">SmtpClient.Credentials = <span style="color:blue;">New</span> Net.NetworkCredential(<span style="color:#a31515;">&#8220;YourEmailAddress&#8221;</span>, <span style="color:#a31515;">&#8220;YourEmailPassword&#8221;</span>)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"><span>    </span>SmtpClient.Send(Message)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span style="font-size:10pt;color:blue;font-family:&quot;">End</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">Sub</span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span style="font-size:10pt;color:blue;font-family:&quot;"> </span></p>
<h2 style="margin:auto 0;"><span style="color:#800000;"><span style="font-family:Verdana;"><span>Note:<span style="font-size:large;"> </span></span></span></span><span class="SubtitleChar"><span style="font-size:12pt;color:windowtext;"><span style="font-family:Cambria;">An important point to note is that you have to set the EnableSSl to True before you set the NetWork Credentials of your SMTP client.</span></span></span></h2>
<table border="0" width="100%" align="center">
<tbody>
<tr valign="middle">
<td width="100%" align="left"><a title="Bookmark using any bookmark manager!" href="http://www.addthis.com/bookmark.php" target="_blank"><img src="http://s9.addthis.com/button1-bm.gif" border="0" alt="AddThis Social Bookmark Button" width="125" height="16" /> </a></td>
</tr>
<tr valign="middle">
<td width="100%" align="left"><a href="http://www.linkedin.com/in/zeeshanmalik"><span style="font:80% Arial,sans-serif;color:#0783B6;"><img style="vertical-align:middle;" src="http://www.linkedin.com/img/webpromo/btn_in_20x15.gif" border="0" alt="View zeeshan malik's LinkedIn profile" width="20" height="15" />View zeeshan malik&#8217;s profile</span></a></td>
</tr>
</tbody>
</table>
<br />Posted in Asp.net  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeemalik.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeemalik.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeemalik.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeemalik.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zeemalik.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zeemalik.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zeemalik.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zeemalik.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeemalik.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeemalik.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeemalik.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeemalik.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeemalik.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeemalik.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeemalik.wordpress.com&amp;blog=2188373&amp;post=4&amp;subd=zeemalik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zeemalik.wordpress.com/2009/02/18/the-smtp-server-requires-a-secure-connection-or-the-client-was-not-authenticated/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba3c2fe89dcf18cff621c1ead5da5abb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zeemalik</media:title>
		</media:content>

		<media:content url="http://s9.addthis.com/button1-bm.gif" medium="image">
			<media:title type="html">AddThis Social Bookmark Button</media:title>
		</media:content>

		<media:content url="http://www.linkedin.com/img/webpromo/btn_in_20x15.gif" medium="image">
			<media:title type="html">View zeeshan malik's LinkedIn profile</media:title>
		</media:content>
	</item>
		<item>
		<title>How to call client-side Javascript function after an UpdatePanel asychronous (Ajax) request is over</title>
		<link>http://zeemalik.wordpress.com/2007/11/27/how-to-call-client-side-javascript-function-after-an-updatepanel-asychronous-ajax-request-is-over/</link>
		<comments>http://zeemalik.wordpress.com/2007/11/27/how-to-call-client-side-javascript-function-after-an-updatepanel-asychronous-ajax-request-is-over/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 13:18:03 +0000</pubDate>
		<dc:creator>zeemalik</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Asp.net]]></category>
		<category><![CDATA[Asychronous post back]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Asynchronous post back]]></category>
		<category><![CDATA[Client side scripting]]></category>
		<category><![CDATA[EndRequestHandler]]></category>
		<category><![CDATA[UpdatePanel]]></category>

		<guid isPermaLink="false">http://zeemalik.wordpress.com/2007/11/27/how-to-call-client-side-javascript-function-after-an-updatepanel-asychronous-ajax-request-is-over/</guid>
		<description><![CDATA[If you are using AJAX then the only way i have found yet to give an alert to a user on return to the Asynchronous post back is to add an &#8220;end request&#8221; handler to the PageRequestManager. In this way you can tell the request manager to run a javascript function on returning from a Asynchronous post back event [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeemalik.wordpress.com&amp;blog=2188373&amp;post=3&amp;subd=zeemalik&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font face="Times New Roman">If you are using AJAX then the only way i have found yet to give an alert to a user on return to the Asynchronous post back is to add an &#8220;end request&#8221; handler to the </font><span style="font-family:'Courier New';">PageRequestManager.</span></p>
<p><font face="Times New Roman">In this way you can tell the request manager to run a javascript function on returning from a Asynchronous post back event of AJAX.</font></p>
<p><font face="Times New Roman">Code for doing this is :</font></p>
<p><span style="font-family:'Courier New';">function load() </span></p>
<p><span style="font-family:'Courier New';">{<br />
   Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);<br />
}</span></p>
<p><font face="Times New Roman">where &#8220;EndRequestHandler&#8221; will be the name of your javascript function you want to call.<br />
Call the above function in Onload event of &lt;body&gt; tag: </font></p>
<p><span style="font-family:'Courier New';">&lt;body onload=&#8221;load()&#8221;&gt;</span></p>
<p><font face="Times New Roman">function EndRequestHandler()</font></p>
<p><font face="Times New Roman">{</font></p>
<p><font face="Times New Roman">          alert(&#8220;You record has been saved successfully&#8221;);</font></p>
<p><font face="Times New Roman">}</font></p>
<p><font face="Times New Roman">Now If you want to give a different message based on your logic in server side code (code behind) then you can use a server side Hidden Field:</font></p>
<p><font face="Times New Roman"><span style="font-size:10pt;color:blue;">&lt;</span><span style="font-size:10pt;color:maroon;">input</span><span style="font-size:10pt;"> <span style="color:red;">id</span><span style="color:blue;">=&#8221;hdnValue&#8221;</span> <span style="color:red;">type</span><span style="color:blue;">=&#8221;hidden&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span>  <span style="color:red;">value</span><span style="color:blue;">=&#8221;"</span> <span style="color:blue;">/&gt;</span></span></font></p>
<p><font face="Times New Roman">Set its value in server side code on Asychronous Post Back: </font></p>
<p><font face="Times New Roman"><span style="color:blue;">Protected</span> <span style="color:blue;">Sub</span> btn_Click(<span style="color:blue;">ByVal</span> sender <span style="color:blue;">As</span> Object, <span style="color:blue;">ByVal</span> e <span style="color:blue;">As</span> System.EventArgs) <span style="color:blue;">Handles</span> btnCreateSample.Click</font></p>
<p><font face="Times New Roman"><span>    </span><span style="color:blue;">If</span> condition <span style="color:blue;">Then</span></font></p>
<blockquote><p><font face="Times New Roman"><span style="color:blue;"></span></font><font face="Times New Roman">hdnValue.value = &#8220;do this&#8221;</font></p></blockquote>
<p><font face="Times New Roman"><span>    </span><span style="color:blue;">Else</span></font><font face="Times New Roman"><span>      </span></font></p>
<blockquote><p><font face="Times New Roman"><span></span></font><font face="Times New Roman">hdnValue.value = &#8220;do that&#8221; </font></p></blockquote>
<p><font face="Times New Roman"><span style="color:blue;">    End If</span></font><span style="color:blue;"><font face="Times New Roman"><span>  </span></font></span></p>
<p><span style="color:blue;"><font face="Times New Roman"><span></span></font></span><span style="color:blue;"><font face="Times New Roman"><span></span>End Sub</font></span></p>
<p><span style="color:blue;"></span><font face="Times New Roman">Now you can check the value of this Hidden Field in your Client Side EndRequestHandler function and give a different alert to user based on its value:</font></p>
<p><font face="Times New Roman">function EndRequestHandler()<br />
</font><font face="Times New Roman">{<br />
</font><font face="Times New Roman">     if (document.getElementById(&#8216;&lt;%= hdnValue.ClientID %&gt;&#8217;).value == &#8220;do this&#8221;)</font></p>
<p><font face="Times New Roman">     { <br />
</font><font face="Times New Roman">          alert(&#8220;You record has been saved successfully&#8221;);<br />
</font><font face="Times New Roman">     } <br />
</font><font face="Times New Roman">     else<br />
</font><font face="Times New Roman">     {<br />
</font><font face="Times New Roman">          alert(&#8220;There is an error&#8221;);<br />
</font><font face="Times New Roman">     }<br />
</font><font face="Times New Roman"> }</font></p>
<table align="center" width="100%">
<tr vAlign="middle">
<td width="100%" align="left"><a target="_blank" href="http://www.addthis.com/bookmark.php" title="Bookmark using any bookmark manager!"><img border="0" width="125" src="http://s9.addthis.com/button1-bm.gif" alt="AddThis Social Bookmark Button" height="16" />  </a></td>
</tr>
<tr vAlign="middle">
<td width="100%" align="left">
<a href="http://www.linkedin.com/in/zeeshanmalik"><span style="font:80% Arial,sans-serif;color:#0783B6;"><img src="http://www.linkedin.com/img/webpromo/btn_in_20x15.gif" width="20" height="15" alt="View zeeshan malik's LinkedIn profile" style="vertical-align:middle;" border="0">View zeeshan malik&#8217;s profile</span></a>
</td>
</tr>
</table>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/zeemalik.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/zeemalik.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/zeemalik.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/zeemalik.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/zeemalik.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/zeemalik.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/zeemalik.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/zeemalik.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/zeemalik.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/zeemalik.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/zeemalik.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/zeemalik.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/zeemalik.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/zeemalik.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/zeemalik.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/zeemalik.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=zeemalik.wordpress.com&amp;blog=2188373&amp;post=3&amp;subd=zeemalik&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://zeemalik.wordpress.com/2007/11/27/how-to-call-client-side-javascript-function-after-an-updatepanel-asychronous-ajax-request-is-over/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba3c2fe89dcf18cff621c1ead5da5abb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">zeemalik</media:title>
		</media:content>

		<media:content url="http://s9.addthis.com/button1-bm.gif" medium="image">
			<media:title type="html">AddThis Social Bookmark Button</media:title>
		</media:content>

		<media:content url="http://www.linkedin.com/img/webpromo/btn_in_20x15.gif" medium="image">
			<media:title type="html">View zeeshan malik's LinkedIn profile</media:title>
		</media:content>
	</item>
	</channel>
</rss>
