<?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>HaresH Chaudhari</title>
	<atom:link href="http://hareshchaudhari.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://hareshchaudhari.wordpress.com</link>
	<description>Freelance Web Developer</description>
	<lastBuildDate>Fri, 30 Apr 2010 13:14:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hareshchaudhari.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/5ba2a8333d9d8f994005f423c73efc9a?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>HaresH Chaudhari</title>
		<link>http://hareshchaudhari.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hareshchaudhari.wordpress.com/osd.xml" title="HaresH Chaudhari" />
	<atom:link rel='hub' href='http://hareshchaudhari.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Get First and Last Date from Calender control in Asp.Net</title>
		<link>http://hareshchaudhari.wordpress.com/2010/04/30/get-first-and-last-date-from-calender-control-in-asp-net/</link>
		<comments>http://hareshchaudhari.wordpress.com/2010/04/30/get-first-and-last-date-from-calender-control-in-asp-net/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 13:11:33 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Get Dates from Calender control]]></category>
		<category><![CDATA[Get First and Last Date from Asp.Net Calender control]]></category>
		<category><![CDATA[How to get First Date and Last Date from Calender control in asp.net]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/?p=93</guid>
		<description><![CDATA[Hello guys Here I am going to explain how we can get the first date and last date for selected month and year from asp.net calender control. Here we just need quite easy logic on 2 events on calender. The events are Prerender and Dayrender. In PreRender, I have take session as null so everytime [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=93&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hello guys</p>
<p>Here I am going to explain how we can get the first date and last date for selected month and year from asp.net calender control. Here we just need quite easy logic on 2 events on calender. The events are Prerender and Dayrender. In PreRender, I have take session as null so everytime when page is loading, it get null before processing on calender days. Then I have write some logic to show FirstDate, Lastdate and also same for each week in the month.</p>
<p>C# Code<br />
protected void Calendar1_PreRender(object sender, EventArgs e)<br />
{<br />
Session["FirstDay"] = null;<br />
Session["LastDay"] = null;<br />
}</p>
<p>protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)<br />
{<br />
if (Session["FirstDay"] == null)<br />
Session["FirstDay"] = e.Day.Date;</p>
<p>if (Session["LastDay"] == null)<br />
Session["LastDay"] = e.Day.Date.AddDays(41);</p>
<p>string LastDates = Convert.ToDateTime(Session["LastDay"]).ToShortDateString();<br />
if (e.Day.Date.ToShortDateString() == LastDates)<br />
{<br />
DateTime FirstDate = Convert.ToDateTime(Session["FirstDay"]);<br />
DateTime LastDate = Convert.ToDateTime(Session["LastDay"]);<br />
Response.Write(&#8220;FirstDay:&#8221;+Session["FirstDay"].ToString() + &#8220;&lt;br /&gt;&#8221;);<br />
Response.Write(&#8220;LastDay:&#8221;+Session["LastDay"].ToString() + &#8220;&lt;br /&gt;&#8221;);<br />
for (DateTime i = FirstDate; i &lt;= LastDate; )<br />
{<br />
DateTime WeekStart = i;<br />
DateTime WeekEnd = i.AddDays(6);<br />
Response.Write(&#8220;Week Start: &#8221; + WeekStart.ToShortDateString() + &#8220;&lt;br /&gt;&#8221;);<br />
Response.Write(&#8220;WeekEnd: &#8221; + WeekEnd.ToShortDateString() + &#8220;&lt;br /&gt;&lt;br /&gt;&#8221;);<br />
i = i.AddDays(7);<br />
}<br />
}<br />
}<br />
<a href="http://hareshchaudhari.files.wordpress.com/2010/04/calender1.jpg"><img class="alignleft size-full wp-image-95" title="Calender" src="http://hareshchaudhari.files.wordpress.com/2010/04/calender1.jpg?w=406&#038;h=308" alt="" width="406" height="308" /></a><br />
I have also attached screen for better understand. I hope this will be helpful for you guys.</p>
<p>Thanks</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/93/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=93&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2010/04/30/get-first-and-last-date-from-calender-control-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>

		<media:content url="http://hareshchaudhari.files.wordpress.com/2010/04/calender1.jpg" medium="image">
			<media:title type="html">Calender</media:title>
		</media:content>
	</item>
		<item>
		<title>Remove duplicate rows from dataset or datatable in Asp.Net</title>
		<link>http://hareshchaudhari.wordpress.com/2010/02/02/remove-duplicate-rows-from-dataset-or-datatable-in-asp-net/</link>
		<comments>http://hareshchaudhari.wordpress.com/2010/02/02/remove-duplicate-rows-from-dataset-or-datatable-in-asp-net/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 13:57:57 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[Duplicate rows in dataset]]></category>
		<category><![CDATA[duplicate rows removal in asp.net]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/2010/02/02/remove-duplicate-rows-from-dataset-or-datatable-in-asp-net/</guid>
		<description><![CDATA[Hello friend have take look on below code which might useful for you to remove any duplicate rows from your dataset or data table in asp.net with C#. The first methods return the datatabe which removed duplicate row from your dataset. You cahve to fill your dataset and then in temporary table you can store [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=92&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hello friend have take look on below code which might useful for you to remove any duplicate rows from your dataset or data table in asp.net with C#.<br />
The first methods return the datatabe which removed duplicate row from your dataset. You cahve to fill your dataset and then in temporary table you can store new returned datatable and store in dataset.</p>
<p>public DataTable RemoveDuplicateRows(DataTable dTable, string colName)<br />
{<br />
Hashtable hTable = new Hashtable();<br />
ArrayList duplicateList = new ArrayList();</p>
<p>foreach (DataRow drow in dTable.Rows)<br />
{<br />
if (hTable.Contains(drow[colName]))<br />
duplicateList.Add(drow);<br />
else<br />
hTable.Add(drow[colName], string.Empty);<br />
}</p>
<p>foreach (DataRow dRow in duplicateList)<br />
dTable.Rows.Remove(dRow);</p>
<p>return dTable;<br />
}</p>
<p>protected void btnRemoveDuplicate_Click(object sender, EventArgs e)<br />
{<br />
Fill your dataset<br />
string strConn = ConfigurationManager.ConnectionStrings["Your Connection String key from config file"].ToString();<br />
SqlConnection conn = new SqlConnection(strConn);<br />
SqlDataAdapter da = new SqlDataAdapter(&#8220;select * from Test&#8221;, conn);<br />
DataSet ds = new DataSet();<br />
da.Fill(ds, &#8220;Test&#8221;);</p>
<p>Take Temporary table and store 0th position&#8217;s table from dataset in your temp table.<br />
DataTable dt = ds.Tables["Test"];</p>
<p>Pass that temp table in above method, so it return fresh table with duplicating rows. You must have to define the columnname for which you are going to remove duplicate rows. Here in example, &#8220;Name&#8221; column is passed for duplicate wors removal.<br />
dt = RemoveDuplicateRows(dt, &#8220;Name&#8221;);</p>
<p>You have fresh table with distinct records here in dt table, you can assign in dataset of bing to your any data control<br />
dgTest.DataSource = ds.Tables["Test"].DefaultView;<br />
dgTest.DataBind();<br />
}</p>
<p>I hope it helpful for you.<br />
Thanks</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=92&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2010/02/02/remove-duplicate-rows-from-dataset-or-datatable-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>
	</item>
		<item>
		<title>How to expand panel with CollapsiblePanelExtender in Code behind</title>
		<link>http://hareshchaudhari.wordpress.com/2010/01/20/how-to-expand-panel-with-collapsiblepanelextender-in-code-behind/</link>
		<comments>http://hareshchaudhari.wordpress.com/2010/01/20/how-to-expand-panel-with-collapsiblepanelextender-in-code-behind/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 14:35:57 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/2010/01/20/how-to-expand-panel-with-collapsiblepanelextender-in-code-behind/</guid>
		<description><![CDATA[Hi, you can use following properties to make your extender as expanded in code behind file YourExtenderControlIDClientState = &#8220;false&#8221; YourExtenderControlID.Collapsed = False Hope this would be helpful for you guys Thanks<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=91&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi, you can use following properties to make your extender as expanded in code behind file</p>
<p>YourExtenderControlIDClientState = &#8220;false&#8221;<br />
YourExtenderControlID.Collapsed = False</p>
<p>Hope this would be helpful for you guys<br />
Thanks</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=91&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2010/01/20/how-to-expand-panel-with-collapsiblepanelextender-in-code-behind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>
	</item>
		<item>
		<title>Select All Checkboxes in GridView in Asp.Net</title>
		<link>http://hareshchaudhari.wordpress.com/2009/12/24/select-all-checkboxes-in-gridview-in-asp-net/</link>
		<comments>http://hareshchaudhari.wordpress.com/2009/12/24/select-all-checkboxes-in-gridview-in-asp-net/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 14:08:11 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[Select All Checkboxes in GridView in Asp.Net]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/?p=86</guid>
		<description><![CDATA[I hope the following code will help you out to select all checkboxes in gridview in asp.net. function SelectAllCheckboxesCategoryList(spanChk) { var chkALL = document.getElementById(spanChk); var the_form = window.document.forms[0]; for(var i=0; i -1) { the_form.elements[i].checked = chkALL.checked; } } } } function UncheckAllCategoryList(CheckItemClientID) { var chkItem = document.getElementById(CheckItemClientID); var the_form = window.document.forms[0]; for(var i=0; i -1) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=86&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I hope the following code will help you out to select all checkboxes in gridview in asp.net.</p>
<p>function SelectAllCheckboxesCategoryList(spanChk)<br />
{<br />
   var chkALL = document.getElementById(spanChk);<br />
            var the_form = window.document.forms[0];<br />
            for(var i=0; i -1)<br />
                    {<br />
                        the_form.elements[i].checked = chkALL.checked;<br />
                    }<br />
                }<br />
            }<br />
}</p>
<p>function UncheckAllCategoryList(CheckItemClientID)<br />
        {<br />
            var chkItem = document.getElementById(CheckItemClientID);<br />
            var the_form = window.document.forms[0];<br />
            for(var i=0; i -1)<br />
                        {<br />
                            if(the_form.elements[i].checked = false)<br />
                            the_form.elements[i].checked = chkItem.checked;<br />
                        }</p>
<p>                }<br />
            }<br />
        }<br />
         function ConfirmDelete()<br />
        {<br />
            var the_form = window.document.forms[0];<br />
            var flagDel=1;<br />
            for(var i=0; i -1)<br />
                    {<br />
                         if(the_form.elements[i].checked == true)<br />
                         {<br />
                            flagDel=0;<br />
                            break;<br />
                         }</p>
<p>                    }<br />
                }<br />
            }<br />
            if(flagDel==0)<br />
            {<br />
                var DialogRes = confirm(&#8220;Are you sure you want to delete records?&#8221;);<br />
                return DialogRes;<br />
            }<br />
            else<br />
             {<br />
                   alert(&#8220;Must Select Atleast One Record To Delete.&#8221;);<br />
                   return false;<br />
             }<br />
        }</p>
<p>Take one HeaderTemplate column and add one checkbox with ID=cbheaderCategory</p>
<p>Take one ItemTemplate column and add one checkbox with ID=chkDeleteCategory</p>
<p>Add following vb.net code in code behind file<br />
Protected Sub dgrdCategory_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgrdCategory.ItemDataBound<br />
        If (e.Item.ItemType = ListItemType.Header) Then<br />
            Dim chk As CheckBox = CType(e.Item.Cells(0).FindControl(&#8220;cbheaderCategory&#8221;), CheckBox)<br />
            chk.Attributes.Add(&#8220;onclick&#8221;, &#8220;SelectAllCheckboxesCategoryList(&#8216;&#8221; + chk.ClientID + &#8220;&#8216;);&#8221;)<br />
        End If</p>
<p>        If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then<br />
            Dim chk As CheckBox = CType(e.Item.Cells(1).FindControl(&#8220;chkDeleteCategory&#8221;), CheckBox)<br />
            chk.Attributes.Add(&#8220;onclick&#8221;, &#8220;UncheckAllCategoryList(&#8216;&#8221; + chk.ClientID + &#8220;&#8216;);&#8221;)<br />
        End If<br />
    End Sub</p>
<p>To add event to check selected check boxes and confirmation message on delete button, use following code.</p>
<p> btnDelete.Attributes.Add(&#8220;OnClick&#8221;, &#8220;javascript: return ConfirmDelete();&#8221;)</p>
<p>I hope it helps you.<br />
Thanks</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/86/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/86/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/86/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=86&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2009/12/24/select-all-checkboxes-in-gridview-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>
	</item>
		<item>
		<title>How to embad Images in mail body in asp.net</title>
		<link>http://hareshchaudhari.wordpress.com/2009/06/25/how-to-embad-images-in-mail-body-in-asp-net/</link>
		<comments>http://hareshchaudhari.wordpress.com/2009/06/25/how-to-embad-images-in-mail-body-in-asp-net/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 10:07:14 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[Embad images in mail bosy; Embad Image in mail]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/2009/06/25/how-to-embad-images-in-mail-body-in-asp-net/</guid>
		<description><![CDATA[When we send email with images, we must have to provide phisical path of the host where our images are located.  But here is the one solution that we can embad images in email body. Here we don&#8217;t need to provide the path. We just have to create Linked resource and Alternative view  from the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=80&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When we send email with images, we must have to provide phisical path of the host where our images are located.  But here is the one solution that we can embad images in email body.</p>
<p>Here we don&#8217;t need to provide the path. We just have to create Linked resource and Alternative view  from the mail message object. Now we just have to provide the Resource Id to Alternative view object and bind that linked resource to alternative view&#8217;s object. That&#8217;s all.  See the following code with example&#8230;</p>
<p>//Holds message information.<br />
System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage();<br />
//Add basic information.<br />
mailMessage.From = new System.Net.Mail.MailAddress(txtFrom.Text.Trim());<br />
mailMessage.To.Add(txtTo.Text.Trim());<br />
mailMessage.Subject = txtSubject.Text.Trim();</p>
<p>//Add image to HTML version<br />
string path = Server.MapPath(@&#8221;Your Image Name.extention&#8221;); // my logo is placed in images folder</p>
<p>System.Net.Mail.LinkedResource imageResource = new System.Net.Mail.LinkedResource(path, &#8220;image/gif&#8221;);<br />
imageResource.ContentId = &#8220;HDIImage&#8221;;<br />
//Create two views, one text, one HTML.<br />
System.Net.Mail.AlternateView htmlView = AlternateView.CreateAlternateViewFromString(&#8220;<img alt="" /><br />
&#8221; + txtBody, null, MediaTypeNames.Text.Html);<br />
htmlView.LinkedResources.Add(imageResource);</p>
<p>mailMessage.AlternateViews.Add(htmlView);<br />
mailMessage.IsBodyHtml = true;<br />
//Send message<br />
System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(&#8220;Your Mail Server Name&#8221;);<br />
//SmtpClient client = new SmtpClient(strSMTPserver);<br />
smtpClient.Credentials = new NetworkCredential(&#8220;Username&#8221;, &#8220;Password&#8221;);<br />
smtpClient.Send(mailMessage);</p>
<p>Thanks you and hope this article will help you lot&#8217;s</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=80&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2009/06/25/how-to-embad-images-in-mail-body-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>
	</item>
		<item>
		<title>Check file extension using regular expression in asp.net</title>
		<link>http://hareshchaudhari.wordpress.com/2009/06/04/check-file-extension-using-regular-expression-in-asp-net/</link>
		<comments>http://hareshchaudhari.wordpress.com/2009/06/04/check-file-extension-using-regular-expression-in-asp-net/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 13:07:16 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[Validate File Extencion in asp.net]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/2009/06/04/check-file-extension-using-regular-expression-in-asp-net/</guid>
		<description><![CDATA[Following is the regular expression validator that check the list of file extension. You need to write all the extension in expression of the validator. &#60;asp:FileUpload ID=&#8221;txtUpload&#8221; runat=&#8221;server&#8221; /&#62; &#60;asp:RegularExpressionValidator ID=&#8221;RegularExpressionValidator6&#8243; runat=&#8221;server&#8221; ControlToValidate=&#8221;txtUpload&#8221; ErrorMessage=&#8221;*&#8221; ValidationExpression=&#8221;^.+\.((jpg)&#124;(gif)&#124;(jpeg)&#124;(png)&#124;(bmp))$&#8221;&#62; &#60;/asp:RegularExpressionValidator&#62; Hope this example helpful for you<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=76&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Following is the regular expression validator that check the list of file extension.<br />
You need to write all the extension in expression of the validator.</p>
<p>&lt;asp:FileUpload ID=&#8221;txtUpload&#8221; runat=&#8221;server&#8221; /&gt;</p>
<p>&lt;asp:RegularExpressionValidator ID=&#8221;RegularExpressionValidator6&#8243; runat=&#8221;server&#8221; ControlToValidate=&#8221;txtUpload&#8221; ErrorMessage=&#8221;*&#8221;<br />
ValidationExpression=&#8221;^.+\.((jpg)|(gif)|(jpeg)|(png)|(bmp))$&#8221;&gt;<br />
&lt;/asp:RegularExpressionValidator&gt;</p>
<p>Hope this example helpful for you</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=76&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2009/06/04/check-file-extension-using-regular-expression-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>
	</item>
		<item>
		<title>Regular expression validatior to allow only numeric value in textbox in asp.net</title>
		<link>http://hareshchaudhari.wordpress.com/2009/06/01/regular-expression-validation-tp-allow-only-numeric-value-in-textbox-in-asp-net-validator/</link>
		<comments>http://hareshchaudhari.wordpress.com/2009/06/01/regular-expression-validation-tp-allow-only-numeric-value-in-textbox-in-asp-net-validator/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 13:38:59 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[Regular expression validation tp allow only numeric value in textbox in asp.net validator]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/2009/06/01/regular-expression-validation-tp-allow-only-numeric-value-in-textbox-in-asp-net-validator/</guid>
		<description><![CDATA[Following is the regular expression validator that allo only numeric value in textbox in asp.net &#60;asp:RegularExpressionValidator ID=&#8221;RegularExpressionValidator1&#8243; runat=&#8221;server&#8221; ControlToValidate=&#8221;YourControlId&#8221; CssClass=&#8221;Message&#8221; Display=&#8221;Dynamic&#8221; ErrorMessage=&#8221;Please enter valid number.&#8221; ValidationExpression=&#8221;\d[0-9]*&#8221; ValidationGroup=&#8221;Issue&#8221;&#62;&#60;/asp:RegularExpressionValidator&#62; Hope this one helpful for you<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=74&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Following is the regular expression validator that allo only numeric value in textbox in asp.net</p>
<p>&lt;asp:RegularExpressionValidator ID=&#8221;RegularExpressionValidator1&#8243; runat=&#8221;server&#8221;<br />
ControlToValidate=&#8221;YourControlId&#8221; CssClass=&#8221;Message&#8221; Display=&#8221;Dynamic&#8221;<br />
ErrorMessage=&#8221;Please enter valid number.&#8221;<br />
ValidationExpression=&#8221;\d[0-9]*&#8221; ValidationGroup=&#8221;Issue&#8221;&gt;&lt;/asp:RegularExpressionValidator&gt;</p>
<p>Hope this one helpful for you</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/74/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=74&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2009/06/01/regular-expression-validation-tp-allow-only-numeric-value-in-textbox-in-asp-net-validator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>
	</item>
		<item>
		<title>Encrypt and Decrypt values in C#.Net</title>
		<link>http://hareshchaudhari.wordpress.com/2009/05/07/encrypt-and-decrypt-values-in-cnet/</link>
		<comments>http://hareshchaudhari.wordpress.com/2009/05/07/encrypt-and-decrypt-values-in-cnet/#comments</comments>
		<pubDate>Thu, 07 May 2009 08:37:54 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Cryptography in asp.Net]]></category>
		<category><![CDATA[Encrypt and Decrypt values in Asp.Net]]></category>
		<category><![CDATA[Encrypt and Decrypt values in C#.Net]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/?p=72</guid>
		<description><![CDATA[This article gives a brief overview of Cryptography and the Cryptography support provided by the .NET Framework. I begin by introducing Cryptography and then proceed to examine the various types of it. In particular, I review and analyze the various cryptography algorithms and objects supported by .NET. I conclude after proposing and briefly discussing the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=72&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:x-small;"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">This article gives a brief overview of Cryptography and the Cryptography support provided by the .NET Framework. I begin by introducing Cryptography and then proceed to examine the various types of it. In particular, I review and analyze the various cryptography algorithms and objects supported by .NET. I conclude after proposing and briefly discussing the algorithmic technique that would work best for you.</span></span></p>
<p>Please find below a  simple code for how to do encrypt and decrypt values in c#.net</p>
<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;</p>
<p>namespace Test<br />
{<br />
public class EncryptDecrypt<br />
{<br />
#region Declaration<br />
static byte[] TripleDESKey1 = new byte[] { 51, 11, 17, 11, 31, 31, 37, 7, 23, 13, 23, 31, 43, 41, 7, 19, 91, 91, 47, 7, 37, 13, 19, 41 };<br />
static byte[] TripleDESIV1 = new byte[] { 55, 13, 17, 31, 41, 51, 23, 7 };</p>
<p>#endregion</p>
<p>/// &lt;summary&gt;<br />
/// To Encrypt String<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;value&#8221;&gt;String To Encrypt&lt;/param&gt;<br />
/// &lt;returns&gt;Returns Encrypted String&lt;/returns&gt;<br />
public static string ToEncrypt(string value)<br />
{<br />
System.Security.Cryptography.TripleDESCryptoServiceProvider des = new System.Security.Cryptography.TripleDESCryptoServiceProvider();</p>
<p>//des.GenerateIV();<br />
//des.GenerateKey();</p>
<p>des.Key = TripleDESKey1;<br />
des.IV = TripleDESIV1;<br />
//TripleDESKey1 = des.Key;//To Store Current Key To Use it in Decryption<br />
//TripleDESIV1 = des.IV;//To Store Current IV To Use it in Decryption</p>
<p>System.IO.MemoryStream ms;</p>
<p>if (value.Length &gt;= 1)<br />
ms = new System.IO.MemoryStream(((value.Length * 2) &#8211; 1));<br />
else<br />
ms = new System.IO.MemoryStream();</p>
<p>ms.Position = 0;<br />
System.Security.Cryptography.CryptoStream encStream = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);<br />
byte[] plainBytes = System.Text.Encoding.UTF8.GetBytes(value);<br />
encStream.Write(plainBytes, 0, plainBytes.Length);<br />
encStream.FlushFinalBlock();<br />
encStream.Close();</p>
<p>return Convert.ToBase64String(plainBytes);<br />
}</p>
<p>/// &lt;summary&gt;<br />
/// To Decrypt Data Encrypted From TripleDEC Algoritham<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;value&#8221;&gt;String Value To Decrypt&lt;/param&gt;<br />
/// &lt;returns&gt;Return Decrypted Data&lt;/returns&gt;<br />
public static string ToDecrypt(string value)<br />
{<br />
try<br />
{<br />
System.Security.Cryptography.TripleDESCryptoServiceProvider des = new System.Security.Cryptography.TripleDESCryptoServiceProvider();<br />
//System.IO.MemoryStream ms = new System.IO.MemoryStream(((value.Length * 2) &#8211; 1));<br />
System.IO.MemoryStream ms;<br />
if (value.Length &gt;= 1)<br />
ms = new System.IO.MemoryStream(((value.Length * 2) &#8211; 1));<br />
else<br />
ms = new System.IO.MemoryStream();</p>
<p>ms.Position = 0;<br />
System.Security.Cryptography.CryptoStream encStream = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(TripleDESKey1, TripleDESIV1), System.Security.Cryptography.CryptoStreamMode.Write);<br />
byte[] plainBytes = Convert.FromBase64String(value);<br />
encStream.Write(plainBytes, 0, plainBytes.Length);<br />
return System.Text.Encoding.UTF8.GetString(plainBytes);<br />
}<br />
catch (Exception ex)<br />
{<br />
throw ex;<br />
}</p>
<p>}<br />
}<br />
}</p>
<p>Thank you</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=72&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2009/05/07/encrypt-and-decrypt-values-in-cnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>
	</item>
		<item>
		<title>how to access active directory for authentication in c# and asp.net</title>
		<link>http://hareshchaudhari.wordpress.com/2009/04/17/how-to-access-active-directory-for-authentication-in-c-and-aspnet/</link>
		<comments>http://hareshchaudhari.wordpress.com/2009/04/17/how-to-access-active-directory-for-authentication-in-c-and-aspnet/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 09:07:32 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[1]]></category>
		<category><![CDATA[how to access active directory for authentication in c# and asp.net]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/?p=69</guid>
		<description><![CDATA[Here how you will access active directory for authentication in c# and asp.net It get the current name of your machine and compare with domain which you have defined in webconfig file. You must have Domain name and its password so you can check your machne name in active directory of that domain. using System.DirectoryServices; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=69&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here how you will access active directory for authentication in c# and asp.net</p>
<p>It get the current name of your machine and compare with domain which you have defined in webconfig file.</p>
<p>You must have Domain name and its password so you can check your machne name in active directory of that domain.</p>
<p>using System.DirectoryServices;</p>
<p>public Boolean CheckActiveDirectory(string strUsername)<br />
{<br />
DirectoryEntry de = null;<br />
DirectorySearcher searchUser = null;<br />
DirectoryEntry localMachine = null;<br />
DirectorySearcher search = null;</p>
<p>try<br />
{<br />
string struser = ConfigurationSettings.AppSettings["DomainUserName"];<br />
string domainName = ConfigurationSettings.AppSettings["DomainName"];<br />
string servername = ConfigurationSettings.AppSettings["serverpath"];<br />
string pwd = ConfigurationSettings.AppSettings["DomainPassword"];<br />
string domainAndUsername = strUsername;// domainName + &#8220;\\&#8221; + struser;</p>
<p>localMachine = new DirectoryEntry(&#8220;LDAP://&#8221; + servername, domainAndUsername, pwd);<br />
search = new DirectorySearcher(localMachine);</p>
<p>search.Filter = &#8220;(&amp;(objectcategory=user)(name=*))&#8221;;<br />
search.SearchScope = SearchScope.Subtree;<br />
search.PropertiesToLoad.Add(&#8220;cn&#8221;);</p>
<p>string userid = Convert.ToString(Session["CurrentUser"]);<br />
string[] strUserDetails = userid.Split(&#8216;\\&#8217;);<br />
bool StatusFlag = false;<br />
if (Convert.ToString(strUserDetails[0]) == domainName)<br />
{<br />
foreach (SearchResult sr in search.FindAll())<br />
{<br />
de = sr.GetDirectoryEntry();<br />
strUsername = de.Properties["sAMAccountName"].Value.ToString();<br />
if (Convert.ToString(strUserDetails[1]) == strUsername)<br />
{<br />
StatusFlag = true;<br />
break;<br />
}<br />
}<br />
}<br />
return StatusFlag;<br />
}<br />
catch (Exception ex)<br />
{<br />
throw ex;<br />
return false;<br />
}<br />
finally<br />
{<br />
if (de != null)<br />
de.Dispose();<br />
if (searchUser != null)<br />
searchUser.Dispose();<br />
if (localMachine != null)<br />
localMachine.Dispose();<br />
if (search != null)<br />
search.Dispose();</p>
<p>}<br />
}</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=69&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2009/04/17/how-to-access-active-directory-for-authentication-in-c-and-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>
	</item>
		<item>
		<title>javascript&#8217;s article to insert text on focus of mouse cursor in Textbox</title>
		<link>http://hareshchaudhari.wordpress.com/2009/04/17/javascripts-article-to-insert-text-on-focus-of-mouse-cursor-in-textbox/</link>
		<comments>http://hareshchaudhari.wordpress.com/2009/04/17/javascripts-article-to-insert-text-on-focus-of-mouse-cursor-in-textbox/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 08:56:32 +0000</pubDate>
		<dc:creator>HaresH Chaudhari</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://hareshchaudhari.wordpress.com/?p=66</guid>
		<description><![CDATA[Here i am posting this javascript&#8217;s article to insert text on focus of mouse cursor in Textbox. The whole concept behind this is somethng like to insert some text where your mouse cursor in other text ares. Here i have taken one DataList control and one multiline textbox. I have filled 3 countryname in DataList [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=66&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here i am posting this javascript&#8217;s article to insert text on focus of mouse cursor in Textbox.</p>
<p>The whole concept behind this is somethng like to insert some text where your mouse cursor in other text ares.</p>
<p>Here i have taken one DataList control and one multiline textbox. I have filled 3 countryname in DataList control.<br />
In ItemDataBound event of datalist control, i have set Attributes on onclick client side event, I have pass client id of control which contain the name of 3 countres and called one function insertAtCursor().</p>
<p><img class="alignnone size-full wp-image-67" title="inertoncursor" src="http://hareshchaudhari.files.wordpress.com/2009/04/inertoncursor.jpg?w=454&#038;h=359" alt="inertoncursor" width="454" height="359" /></p>
<p>Here we get the start and end points of the selection. Then we create substrings up to the start of the selection and from the end point of the selection to the end of the field value. Then we concatenate the first substring, myValue, and the second substring to get the new value.</p>
<p><strong>Javascript:</strong></p>
<p>&lt;script type=&#8221;text/javascript&#8221; language=&#8221;javascript&#8221;&gt;<br />
function insertAtCursor(myValue)<br />
{<br />
if (document.selection)<br />
{<br />
document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).focus();<br />
sel = document.selection.createRange();<br />
sel.text = myValue;<br />
}</p>
<p>else if (document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).selectionStart &gt;= &#8217;0&#8242;)<br />
{<br />
var startPos = document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).selectionStart;<br />
var endPos = document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).selectionEnd;<br />
alert(document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).value.substring(0, startPos) + myValue + document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).value.substring(endPos, document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).value.length));<br />
document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).value = document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).value.substring(0, startPos)+ myValue+ document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).value.substring(endPos, document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).value.length);<br />
}<br />
else<br />
{<br />
document.getElementById(&#8216;&lt;%=txtBody.ClientID %&gt;&#8217;).value += myValue;<br />
}<br />
return false;<br />
}<br />
&lt;/script&gt;<br />
&lt;!&#8211;<br />
function insertAtCursor(myValue)<br />
    {<br />
        if (document.selection)<br />
        {<br />
            document.getElementById(&#8221;).focus();<br />
            sel = document.selection.createRange();<br />
            sel.text = myValue;<br />
          }</p>
<p>        else if (document.getElementById(&#8221;).selectionStart &gt;= &#8217;0&#8242;)<br />
        {<br />
            var startPos = document.getElementById(&#8221;).selectionStart;<br />
            var endPos = document.getElementById(&#8221;).selectionEnd;<br />
            alert(document.getElementById(&#8221;).value.substring(0, startPos) + myValue + document.getElementById(&#8221;).value.substring(endPos, document.getElementById(&#8221;).value.length));<br />
            document.getElementById(&#8221;).value = document.getElementById(&#8221;).value.substring(0, startPos)+ myValue+ document.getElementById(&#8221;).value.substring(endPos, document.getElementById(&#8221;).value.length);<br />
        }<br />
        else<br />
        {<br />
            document.getElementById(&#8221;).value += myValue;<br />
        }<br />
        return false;<br />
    }<br />
// &#8211;&gt;</p>
<p><strong>Html Code:</strong></p>
<p>&lt;asp:DataList ID=&#8221;dlValues&#8221; runat=&#8221;server&#8221; OnItemDataBound=&#8221;dlDynamicHeaders_ItemDataBound&#8221;&gt;<br />
&lt;ItemTemplate&gt;<br />
&lt;asp:LinkButton ID=&#8221;lbtnName&#8221; CausesValidation=&#8221;false&#8221; runat=&#8221;server&#8221; Text=&#8217;&lt;%# DataBinder.Eval(Container.DataItem,&#8221;Name&#8221;) %&gt;&#8217;&gt;&lt;/asp:LinkButton&gt;<br />
&lt;/ItemTemplate&gt;<br />
&lt;/asp:DataList&gt;<br />
&lt;br /&gt;<br />
&lt;br /&gt;<br />
&lt;asp:TextBox ID=&#8221;txtBody&#8221; runat=&#8221;server&#8221; TextMode=&#8221;MultiLine&#8221; Width=&#8221;300&#8243; Wrap=&#8221;true&#8221;<br />
Height=&#8221;80&#8243; CssClass=&#8221;marginleft&#8221;&gt;&lt;/asp:TextBox&gt;</p>
<p><strong>C#.Net Code:</strong><br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
DataTable dt = new DataTable();<br />
dt.Columns.Add(&#8220;Name&#8221;);</p>
<p>if (!IsPostBack)<br />
{<br />
DataRow dr1 = dt.NewRow();<br />
dr1["Name"] = &#8220;America&#8221;;<br />
dt.Rows.Add(dr1);</p>
<p>DataRow dr2 = dt.NewRow();<br />
dr2["Name"] = &#8220;Canada&#8221;;<br />
dt.Rows.Add(dr2);</p>
<p>DataRow dr3 = dt.NewRow();<br />
dr3["Name"] = &#8220;India&#8221;;<br />
dt.Rows.Add(dr3);</p>
<p>dlValues.DataSource = dt.DefaultView;<br />
dlValues.DataBind();<br />
}<br />
}<br />
protected void dlDynamicHeaders_ItemDataBound(object sender, DataListItemEventArgs e)<br />
{<br />
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)<br />
{<br />
LinkButton lbtnName = (LinkButton)e.Item.FindControl(&#8220;lbtnName&#8221;);<br />
lbtnName.Attributes.Add(&#8220;onclick&#8221;, &#8220;javascript:return insertAtCursor(&#8216;[" + lbtnName.Text.Trim() + "]&#8216;);&#8221;);<br />
}<br />
}</p>
<p><strong>Hope this article will help you.<br />
Thank you<br />
</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hareshchaudhari.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hareshchaudhari.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hareshchaudhari.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hareshchaudhari.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hareshchaudhari.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hareshchaudhari.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hareshchaudhari.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hareshchaudhari.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hareshchaudhari.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hareshchaudhari.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hareshchaudhari.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hareshchaudhari.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hareshchaudhari.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hareshchaudhari.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hareshchaudhari.wordpress.com&amp;blog=4366858&amp;post=66&amp;subd=hareshchaudhari&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hareshchaudhari.wordpress.com/2009/04/17/javascripts-article-to-insert-text-on-focus-of-mouse-cursor-in-textbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0c9bf89558ab1ae6dd4c4b9bfa9e4867?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">HaresH Chaudhari</media:title>
		</media:content>

		<media:content url="http://hareshchaudhari.files.wordpress.com/2009/04/inertoncursor.jpg" medium="image">
			<media:title type="html">inertoncursor</media:title>
		</media:content>
	</item>
	</channel>
</rss>
