<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;Ak4AR3g5fyp7ImA9WhRaEUw.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864</id><updated>2012-02-13T13:12:26.627+05:30</updated><category term="ToolkitScriptManager" /><category term="Autosuggest" /><category term="Export" /><category term="SQL" /><category term="URL Rewriting" /><category term="XMLHttpRequest" /><category term="WebRequest" /><category term="Hypertext Transfer Protocol" /><category term="Address bar" /><category term="DataTable" /><category term="Web page" /><category term="PageMethod" /><category term="Ajax" /><category term="Programming" /><category term="Ado.net" /><category term="String Function in JavaScript" /><category term="Asp.net 3.5" /><category term="Client-server" /><category term="Charts" /><category term="Script Manager" /><category term="Search Engine Optimization" /><category term="Google API" /><category term="BeginInvoke" /><category term="JSON" /><category term="Send Email In Asp.net" /><category term="Java Script" /><category term="URL redirection" /><category term="AsyncCallback" /><category term="ActiveDirectory" /><category term="MSSQL" /><category term="table" /><category term="Web Design and Development" /><category term="Asp.net 4.0" /><category term="User Management" /><category term="CSS" /><category term="Asp.Net" /><category term="GridView" /><category term="Gmail" /><category term="ASP" /><category term="Image Handling" /><category term="Callback (computer science)" /><category term="Cut  copy  and paste" /><category term="Yahoo Finance" /><category term="C#" /><category term="Callback" /><category term="MSSQL 2008" /><category term="Text box" /><category term="Replace All" /><category term="Stock Market" /><category term="Web Browser" /><category term="Database" /><category term="Excel Operations" /><category term="AjaxToolKit" /><category term="Web User Control" /><category term="HTML" /><category term="SqlMembershipProviders" /><category term="Hyperlink" /><category term="Grid View" /><category term="Calendar Extender" /><category term="Web development" /><category term="JavaScript" /><category term="ICallback" /><category term="Membership Provider" /><title>When it Comes to Asp.Net</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://aspdotnetmatters.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>45</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/aspdotnetmatters" /><feedburner:info uri="aspdotnetmatters" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by/2.0/" /><logo>http://creativecommons.org/images/public/somerights20.gif</logo><entry gd:etag="W/&quot;Ck4FQX86fip7ImA9WhRWFk0.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-7319319905985951418</id><published>2012-01-03T19:56:00.002+05:30</published><updated>2012-01-03T19:58:30.116+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-03T19:58:30.116+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="MSSQL 2008" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="SQL" /><category scheme="http://www.blogger.com/atom/ns#" term="MSSQL" /><title>Drop All Functions in SQL SERVER</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;To DROP All function in SQL SERVER Database use following lines of codes, use it in Query window for particular database. &lt;br /&gt;
&lt;br /&gt;
This code will save lots of time as DROPing All functions in SQL Server database is not a manual process, if we use this&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;WHERE [type] IN (N'FN', N'IF', N'TF', N'FS', N'FT')&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;AND category = 0 ORDER BY [name])&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;WHILE @name IS NOT NULL
BEGIN
    SELECT @SQL = 'DROP FUNCTION [dbo].[' + RTRIM(@name) +']'
    EXEC (@SQL)
    PRINT 'Dropped Function: ' + @name
    SELECT @name = (SELECT TOP 1 [name] FROM sysobjects 
WHERE [type] IN (N'FN', N'IF', N'TF', N'FS', N'FT') AND 
category = 0 AND [name] &amp;gt; @name ORDER BY [name])
END
GO
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-7319319905985951418?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/NffImFUrClI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/7319319905985951418/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=7319319905985951418" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/7319319905985951418?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/7319319905985951418?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/NffImFUrClI/drop-all-functions-in-sql-server.html" title="Drop All Functions in SQL SERVER" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2012/01/drop-all-functions-in-sql-server.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYGQ305fyp7ImA9WhRWFUQ.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-5421183815475233338</id><published>2012-01-03T18:05:00.000+05:30</published><updated>2012-01-03T18:05:22.327+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-03T18:05:22.327+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MSSQL 2008" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="SQL" /><title>Drop All Views in SQL SERVER</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;This is a very common scenario while updating or replacing database in SQL SERVER, we might need to delete all the views in SQL SERVER database. But to delete one view at a times is a time consuming process if database is huge with lots of Views. &lt;br /&gt;
&lt;br /&gt;
To Drop all views in SQL SERVER database use following &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql;"&gt;DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects 
WHERE [type] = 'V' AND category = 0 ORDER BY [name])
WHILE @name IS NOT NULL
BEGIN
    SELECT @SQL = 'DROP VIEW [dbo].[' + RTRIM(@name) +']'
    EXEC (@SQL)
    PRINT 'Dropped View: ' + @name
    SELECT @name = (SELECT TOP 1 [name] FROM sysobjects 
WHERE [type] = 'V' AND category = 0 AND [name] &amp;gt; @name 
ORDER BY [name])
END
GO
&lt;/pre&gt;&lt;br/&gt;&lt;br /&gt;
&lt;br/&gt;&lt;br /&gt;
&lt;br/&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-5421183815475233338?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/TsJRYWOrdho" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/5421183815475233338/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=5421183815475233338" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5421183815475233338?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5421183815475233338?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/TsJRYWOrdho/drop-all-views-in-sql-server.html" title="Drop All Views in SQL SERVER" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2012/01/drop-all-views-in-sql-server.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcMSX4-cCp7ImA9WhRWFUQ.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-702225439123994749</id><published>2012-01-03T17:48:00.000+05:30</published><updated>2012-01-03T17:48:08.058+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-03T17:48:08.058+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Web page" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="SQL" /><title>Delete All Store Procedures in SQL SERVER</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;While working on SQL Server 2008, there was a situation when I had to delete one Store Procedure at a time :(.&lt;br /&gt;
After doing some research to delete all store procedures with some query, I succeeded to save 2-3 hours or labour work :P&lt;br /&gt;
&lt;br /&gt;
To delete all store procedures in single we can use following code in SQL Query. &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;DECLARE @procedureName varchar(500)
DECLARE cur CURSOR
      FOR SELECT [name] FROM sys.objects WHERE type = 'p'
      OPEN cur

      FETCH NEXT FROM cur INTO @procedureName
      WHILE @@fetch_status = 0
      BEGIN
            EXEC('DROP PROCEDURE ' + @procedureName)
            FETCH NEXT FROM cur INTO @procedureName
      END
      CLOSE cur
      DEALLOCATE cur
&lt;/pre&gt;&lt;/div&gt;This will surely save time, required to Delete All Store Procedures in SQL SERVER Database&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-702225439123994749?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/pEbfaXpRqVU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/702225439123994749/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=702225439123994749" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/702225439123994749?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/702225439123994749?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/pEbfaXpRqVU/delete-all-store-procedures-in-sql.html" title="Delete All Store Procedures in SQL SERVER" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2012/01/delete-all-store-procedures-in-sql.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUCQXgzeCp7ImA9WhRSGU0.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-265823512978809034</id><published>2011-11-22T00:34:00.000+05:30</published><updated>2011-11-22T00:34:20.680+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-22T00:34:20.680+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="MSSQL 2008" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="Database" /><category scheme="http://www.blogger.com/atom/ns#" term="SQL" /><category scheme="http://www.blogger.com/atom/ns#" term="MSSQL" /><title>Delete All Tables MSSQL</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
While working on ASP.Net application, I came across a situation where I had to delete all the Tables of the MSSQL 2008 database, and it was really painful process.&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
In this case I had to delete all the SPs and all views as well. As I started searching like "Truncate database Sql 2008" or "Delete all tables in MSSQL" I came across two things and it worked for me.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;

(&lt;b&gt;I am really not sure whether it works in all the cases but for Deleting all tables in SQL, this worked for me&lt;/b&gt;.)&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Firstly we need to remove all indexs from SQL table, I found following code when I Google the term&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;pre class="brush: sql;"&gt;DECLARE @indexName NVARCHAR(128)
DECLARE @dropIndexSql NVARCHAR(4000)

DECLARE tableIndexes CURSOR FOR
SELECT name FROM sysindexes
WHERE id = OBJECT_ID(N'tableName') AND
  indid &amp;gt; 0 AND indid &amp;lt; 255 AND
  INDEXPROPERTY(id, name, 'IsStatistics') = 0
ORDER BY indid DESC

OPEN tableIndexes
FETCH NEXT FROM tableIndexes INTO @indexName
WHILE @@fetch_status = 0
BEGIN
  SET @dropIndexSql = N'DROP INDEX tableName.' + @indexName
  EXEC sp_executesql @dropIndexSql

  FETCH NEXT FROM tableIndexes INTO @indexName
END

CLOSE tableIndexes
DEALLOCATE tableIndexes&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
After this we need to delete all the tables in SQL, for this I used following SP
&lt;br /&gt;
&lt;pre class="brush: sql;"&gt;EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"
&lt;/pre&gt;
&lt;br /&gt;
It seems that this is a HIDDEN stored procedure in MSSQL.

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-265823512978809034?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/lctm48vlEJs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/265823512978809034/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=265823512978809034" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/265823512978809034?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/265823512978809034?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/lctm48vlEJs/delete-all-tables-mssql.html" title="Delete All Tables MSSQL" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/11/delete-all-tables-mssql.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYHQ3kycCp7ImA9WhRSF0Q.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-4419376783792511962</id><published>2011-11-20T17:58:00.000+05:30</published><updated>2011-11-20T17:58:52.798+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-20T17:58:52.798+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="User Management" /><category scheme="http://www.blogger.com/atom/ns#" term="Membership Provider" /><title>Access userName asp.net-membership without using Membership.getUser()</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;While I was working on Membership and User Management in Asp.Net 2010&lt;br /&gt;
Following Scenario&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;After creating user, admin sets subscribtion for the user.&lt;/li&gt;
&lt;li&gt;User logs in with id and password, after validating user, I check for subscription details.&lt;/li&gt;
&lt;li&gt;If user is logging in with subscription period he/she has access to the application else he/she will be redirected to Subscription Expired page.&lt;/li&gt;
&lt;/ul&gt;To check subscription, I had requirement to get username and check it in Subscription table.&lt;br /&gt;
I did not want to use getUser function, as I just wanted to get user name of currently logged in user.&lt;br /&gt;
&lt;br /&gt;
To get user name I used following line of code&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;System.Web.HttpContext.Current.User.Identity.Name
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-4419376783792511962?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/RmzyDEVav-k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/4419376783792511962/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=4419376783792511962" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/4419376783792511962?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/4419376783792511962?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/RmzyDEVav-k/access-username-aspnet-membership.html" title="Access userName asp.net-membership without using Membership.getUser()" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/11/access-username-aspnet-membership.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UAR3w5eyp7ImA9WhRSFkw.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-6896696963146030871</id><published>2011-11-18T16:50:00.000+05:30</published><updated>2011-11-18T16:50:46.223+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-18T16:50:46.223+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Calendar Extender" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="AjaxToolKit" /><category scheme="http://www.blogger.com/atom/ns#" term="Ajax" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="Script Manager" /><title>Error : Could not find any resources appropriate for the specified culture or   the neutral culture</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Just recieved this error:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;Could not find any resources appropriate for the specified culture or the neutral culture.&amp;nbsp; Make sure "AjaxControlToolkit.Properties.Resources.NET4.resources" was correctly embedded or linked into assembly "AjaxControlToolkit" at compile time, or that all the satellite assemblies required are loadable and fully signed.&amp;nbsp;&lt;/blockquote&gt;&lt;br /&gt;
&lt;pre&gt;Could not find any resources appropriate for the specified culture or&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;the neutral culture.&amp;nbsp; Make sure&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;"AjaxControlToolkit.Properties.Resources.NET4.resources"&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;was correctly embedded or linked into assembly "AjaxControlToolkit"&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;at compile time, or that all the satellite assemblies required are&lt;/pre&gt;&lt;pre&gt;loadable and fully signed.
&lt;/pre&gt;&lt;br /&gt;
Ajax Tool kit realted .Net errors look a lot more worse than they really are.&lt;br /&gt;
What we have to do is simply add scriptManager ;) &lt;br /&gt;
&amp;nbsp;&lt;pre&gt;&amp;lt;ajax:ToolkitScriptManager&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;ID="ToolkitScriptManager1"&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;runat="server" /&amp;gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-6896696963146030871?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/e10AIMFyDDU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/6896696963146030871/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=6896696963146030871" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/6896696963146030871?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/6896696963146030871?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/e10AIMFyDDU/error-could-not-find-any-resources.html" title="Error : Could not find any resources appropriate for the specified culture or   the neutral culture" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/11/error-could-not-find-any-resources.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcERnszeCp7ImA9WhRTFkQ.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-5219447260041098026</id><published>2011-11-08T00:23:00.000+05:30</published><updated>2011-11-08T00:23:27.580+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-08T00:23:27.580+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Web page" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="SqlMembershipProviders" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="User Management" /><title>Use Membership for user management - Basics</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;In this article we shall discuss the membership feature in ASP.NET applications. Asp.net has reduced the development drastically by introducing this. Membership feature of Asp.Net drastically reduces the amount of code we have to write to authenticate users at our Web site. In this article we are going to develop User Management system membership class, and SqlMembershipProvider.&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;Membership feature of Asp.net provides a membership API that simplifies the task of validating user credentials. SqlMembershipProvider uses SQL Database for storing membership details.&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;Step1: Install Membership Database for SQLMembershipProvider.&lt;/b&gt;&lt;br /&gt;
To install Membership Database we have to log on to our server with an account that has authority to administer SQL server. After this open Visual Studio 2010 Command prompt. &lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-25oOuwfdC8M/TrevvxWrPOI/AAAAAAAAAxw/OnO_DG1lTG8/s1600/Visual+Studio+2010+Command+Prompt.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-25oOuwfdC8M/TrevvxWrPOI/AAAAAAAAAxw/OnO_DG1lTG8/s1600/Visual+Studio+2010+Command+Prompt.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Run following command&lt;br /&gt;
&lt;b&gt;&lt;i&gt;aspnet_regsql.exe -E -S localhost -A m&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; -E indicates authenticate using the Windows credentials of the currently logged on user.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; -S (server) indicates the name of the server where the database will be installed or is already installed.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; -A m indicates add membership support. This creates the tables and stored procedures required by the membership provider.&lt;br /&gt;
&lt;br /&gt;
Above command mainly generates database naming "&lt;b&gt;aspnetdb&lt;/b&gt;" with following &amp;nbsp;schema&amp;nbsp;structure&amp;nbsp;and related &lt;b&gt;stored procedures&lt;/b&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-xq7esYDgGpU/TreyxRVKY5I/AAAAAAAAAx4/jX6bmfGxIxE/s1600/AspnetDBStructure.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://2.bp.blogspot.com/-xq7esYDgGpU/TreyxRVKY5I/AAAAAAAAAx4/jX6bmfGxIxE/s640/AspnetDBStructure.png" width="396" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;&lt;u&gt;* Please Note that Related stored procedures also get created with above command.&lt;/u&gt;&amp;nbsp;These stored procedures get called internally from Membership provider.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;Step2: Configure Forms Authentication&lt;/b&gt;&lt;br /&gt;
Set following authentication mode in Web.config file&lt;br /&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;authentication mode="Forms"&amp;gt;
    &amp;lt;forms loginUrl="Login.aspx" 
           protection="All" 
           timeout="30" 
           name="AppNameCookie" 
           path="/FormsAuth" 
           requireSSL="false" 
           slidingExpiration="true" 
           defaultUrl="default.aspx"
           cookieless="UseCookies"
           enableCrossAppRedirects="false"/&amp;gt;
&amp;lt;/authentication&amp;gt;&lt;/pre&gt;&lt;br /&gt;
If so many options are not required we can simply use following Tag for authentication&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush"&gt;&amp;lt;authentication mode="Forms"&amp;gt;
      &amp;lt;forms loginUrl="Login.aspx" timeout="2880" /&amp;gt;
    &amp;lt;/authentication&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
Add the following &amp;lt;authorization&amp;gt; element after the &lt;authentication&gt; element. This will allow only authenticated users to access the application. The previously established loginUrl attribute of the &amp;lt;authentication&amp;gt; element will redirect unauthenticated requests to the Login.aspx page.&lt;br /&gt;
&lt;br /&gt;
&lt;/authentication&gt;&lt;br /&gt;
&lt;pre class="brush"&gt;&amp;lt;authorization&amp;gt; 
   &amp;lt;deny users="?" /&amp;gt;
   &amp;lt;allow users="*" /&amp;gt;
&amp;lt;/authorization&amp;gt;
  &lt;/pre&gt;&lt;b&gt;Step 3: Configuring SQLMembership Provider&lt;/b&gt;&lt;br /&gt;
In Step 1, we created SQL Database for Membership Provider, in this step we will configure SQLMembership Provider in Web.config file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;connectionStrings&amp;gt;
  &amp;lt;add name="MyConnectionString" connectionString="Data Source=MySqlServer;Initial Catalog=aspnetdb;Integrated Security=SSPI;" /&amp;gt;
&amp;lt;/connectionStrings&amp;gt;
&amp;lt;system.web&amp;gt;
...
  &amp;lt;membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15"&amp;gt;
    &amp;lt;providers&amp;gt;
      &amp;lt;clear /&amp;gt;
      &amp;lt;add 
        name="SqlProvider" 
        type="System.Web.Security.SqlMembershipProvider" 
        connectionStringName="MyConnectionString"
        applicationName="/"
        enablePasswordRetrieval="false"
        enablePasswordReset="true"
        requiresQuestionAndAnswer="true"
        requiresUniqueEmail="true"
        passwordFormat="Hashed" /&amp;gt;
    &amp;lt;/providers&amp;gt;
  &amp;lt;/membership&amp;gt;&lt;/pre&gt;&lt;br /&gt;
Default passwordFormat is "Hashed", if we remove it from Configuration then by default Passwords are stored in Hashed format. We can change &lt;b&gt;passwordFormat&lt;/b&gt; to &lt;b&gt;Encrypted&lt;/b&gt;. (This is not the scope of this Article; I shall put another article for it.)&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;Step 4: Start using Membership class&lt;/b&gt;&lt;br /&gt;
Upto step 3 we were only doing configuration for using Membership class. After we done with step 3; whenever we use Membership class, if by default uses Database structure generated in Step 1. It internally manages all the Database calls.&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;pre class="c#" name="code"&gt;Membership.CreateUser("UserName","Password");
//This will create user in Database.
&lt;/pre&gt;Check out following Membership APIs for user management in Asp.net.&lt;br /&gt;
&lt;table border="1"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;Method&lt;/th&gt;&lt;th&gt;Parameters&lt;/th&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;CreateUser&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;string &lt;em&gt;username&lt;/em&gt;User name to create.&lt;br /&gt;
&lt;br /&gt;
string &lt;em&gt;password&lt;/em&gt;Password for new user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
string &lt;em&gt;email&lt;/em&gt;E-mail for new user.&lt;br /&gt;
&lt;br /&gt;
string &lt;em&gt;passwordQuestion&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
string &lt;em&gt;passwordAnswer&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
bool &lt;em&gt;IsApproved&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
object &lt;em&gt;providerUserKey&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Used to create a new user.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;DeleteUser&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;string &lt;em&gt;username&lt;/em&gt;User to delete.&lt;br /&gt;
&lt;br /&gt;
bool &lt;em&gt;removeAllRelatedData&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Used to immediately remove a user identified by the supplied username. Returns &lt;strong&gt;true&lt;/strong&gt; if the user was deleted or &lt;strong&gt;false&lt;/strong&gt; if not found.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;FindUsersByName&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;string &lt;em&gt;usernameToMatch&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
int &lt;em&gt;pageIndex&lt;/em&gt;&lt;strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/strong&gt;int &lt;em&gt;pageSize&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Returns a collection of users where the string parameter passed matches part of the username.&lt;br /&gt;
&lt;br /&gt;
Wildcard support depends on how each data store handles characters such as "&lt;strong&gt;*&lt;/strong&gt;", "&lt;strong&gt;%&lt;/strong&gt;" and "&lt;strong&gt;_&lt;/strong&gt;".&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;FindUsersByEmail&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;string &lt;em&gt;emailToMatch&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
int &lt;em&gt;pageIndex&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
int &lt;em&gt;pageSize&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Returns a collection of users whose e-mail addreses matches any part of the string parameter passed.&lt;br /&gt;
&lt;br /&gt;
Wildcard support depends on how each data store handles characters such as "&lt;strong&gt;*&lt;/strong&gt;", "&lt;strong&gt;%&lt;/strong&gt;" and "&lt;strong&gt;_&lt;/strong&gt;"&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;GeneratePassword&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;int &lt;em&gt;length&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Int &lt;em&gt;numberOfNonAlpha&lt;br /&gt;
&lt;br /&gt;
NumericCharacters&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Returns a password of the specified length that contains the specified number of non-alphanumeric characters.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;GetAllUsers&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;int &lt;em&gt;pageIndex&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
int &lt;em&gt;pageSize&lt;/em&gt;&lt;/td&gt;&lt;td&gt;Returns a subset of users from the collection of all users. The subset is based on the &lt;strong&gt;pageIndex &lt;/strong&gt;and &lt;strong&gt;pageSize&lt;/strong&gt; methods.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;GetNumberOfUsersOnline&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Returns a count of all the users who are currently online &lt;br /&gt;
&lt;br /&gt;
The Active Directory provider does not implement this functionality&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;GetUsernameByEmail&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;string &lt;em&gt;email&lt;/em&gt;Email of user to lookup.&lt;/td&gt;&lt;td&gt;Return a member's username.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;UpdateUser&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;MembershipUser&lt;/strong&gt; &lt;em&gt;user&lt;/em&gt;Membership user to update&lt;/td&gt;&lt;td&gt;Updates a member's properties; for example, an e-mail address.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;ValidateUser&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;string &lt;em&gt;username&lt;/em&gt;User name to validate.&lt;br /&gt;
&lt;br /&gt;
string &lt;em&gt;password&lt;/em&gt;User password to validate.&lt;/td&gt;&lt;td&gt;Validates a user's credentials. Returns &lt;strong&gt;true&lt;/strong&gt; if the credentials are valid and &lt;strong&gt;false&lt;/strong&gt; if they are not. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With Active Directory, regardless of the configured connection credentials, the provider connects to the directory with the username and password parameter as the connection credentials.  &lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;(Note: Above table is picked up from MSDN)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This is how we can use Membership class for User management in Asp.net using SQLMembershipProvider.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-5219447260041098026?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/mVz1KgVl0m4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/5219447260041098026/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=5219447260041098026" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5219447260041098026?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5219447260041098026?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/mVz1KgVl0m4/use-membership-for-user-management.html" title="Use Membership for user management - Basics" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-25oOuwfdC8M/TrevvxWrPOI/AAAAAAAAAxw/OnO_DG1lTG8/s72-c/Visual+Studio+2010+Command+Prompt.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/11/use-membership-for-user-management.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QBSXk_fSp7ImA9WhdUGUQ.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-6216586920237480575</id><published>2011-10-07T18:12:00.001+05:30</published><updated>2011-10-07T18:12:38.745+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-07T18:12:38.745+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title>Validation of viewstate mac failed</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
At times when we host our web application to server, we get following error.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;“Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster"&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The root cause of this error is, variation in the key to encrypt and decrypt viewstate data. View state data is transferred between the client and the server is always validated. This is required to ensure that viewstate data is not tempered. Viewstate data is in envrypted formate and is decrypted while validating it, unique key is used to encrypt and decrypt viewstate data. When application is hosted on single machine, there is no issue of key, as key remains same for single machine. But in case of web farm or other hosting environment in that case we have to fix this issue by providing encryption key.&lt;br /&gt;
&lt;br /&gt;
Add following line of in web.config under system.web tag&lt;br /&gt;
&lt;pre class="c#" name="code"&gt;  &lt;machinekey decryptionkey="2FC79A393A5A463F82D38828F43ED7D030C418B448C9E76C" validation="SHA1" validationkey="3AE041467624C0947FE562E2DBE6122B532FBC4AA9845AE3D82EC6AC473104EA40A27F8E89BADDAEE44B1F7582FC47299B674ED1FD2DDE1368710504EB2C54C1"&gt;
&amp;lt; / machinekey&amp;gt;
&lt;/machinekey&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Machine key configuration 

&lt;br /&gt;
&lt;pre class="c#" name="code"&gt;&lt;machinekey 3des="" [auto="" [sha1="" [string]="" aes="" alg:algorithm_name]="" decryption="Auto" decryptionkey="AutoGenerate,IsolateApps" des="" hmacsha256="" hmacsha384="" hmacsha512="" md5="" validation="HMACSHA256" validationkey="AutoGenerate,IsolateApps" |=""&gt;
&lt;/machinekey&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Even we can choose not to do validation of view state by adding following line of code, this disables validation of data which is not prefered in most of the environments.
&lt;br /&gt;
&lt;pre class="c#" name="code"&gt;&lt;pages enableeventvalidation="false" viewstateencryptionmode="Never"&gt;&lt;/pages&gt;&lt;/pre&gt;
&lt;/div&gt;
Refer this link ---&amp;gt; &lt;a href="http://msdn.microsoft.com/en-us/library/w8h3skw9.aspx"&gt;http://msdn.microsoft.com/en-us/library/w8h3skw9.aspx&lt;/a&gt;&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-6216586920237480575?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/kegWaBfAMCE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/6216586920237480575/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=6216586920237480575" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/6216586920237480575?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/6216586920237480575?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/kegWaBfAMCE/validation-of-viewstate-mac-failed.html" title="Validation of viewstate mac failed" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/10/validation-of-viewstate-mac-failed.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMFRHs4cSp7ImA9WhdWFk4.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-1231845441008859511</id><published>2011-09-10T11:20:00.001+05:30</published><updated>2011-09-10T11:30:15.539+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-10T11:30:15.539+05:30</app:edited><title>About Cloud Hosting</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;b&gt;What is Cloud hosting?&lt;/b&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Unlike traditional approach of single server hosting, a cloud-hosted website opearts on multiple connected servers; the website now has the access to multiple servers. Virtually, the processing power is unlimited as we can always add a new server which scale up the processing power.&lt;/div&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="390" src="http://www.youtube.com/embed/b29f-CCntcg" title="YouTube video player" width="640"&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Benefits of cloud hosting&lt;/b&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
It’s scalability and cost efficient is the commonly known advantages.

Highly scalable technology (load balancing, hardware upgrades, etc), virtually no limitations on website expansion.&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
NO hassle of migrating website from a shared server to a dedicated server.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
NO server crash when website experienced a sudden surge.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
In terms of costing &lt;a href="http://draft.blogger.com/%20http://www.youtube.com/watch?v=b29f-CCntcg"&gt;cloud hosting&lt;/a&gt; companies charge pay-per-use basis, so no need to reserve massive server powers to avoid website crash from sudden traffic surge. So Cost is another huge plus if we need a lot of processing power.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;a href="http://draft.blogger.com/%20http://www.youtube.com/watch?v=b29f-CCntcg"&gt;Cloud hosting&lt;/a&gt; companies charge their users based on the quantity of computing power consumed.
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-1231845441008859511?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/uUDwUEkqpUs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/1231845441008859511/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=1231845441008859511" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/1231845441008859511?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/1231845441008859511?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/uUDwUEkqpUs/about-cloud-hosting.html" title="About Cloud Hosting" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://img.youtube.com/vi/b29f-CCntcg/default.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/09/about-cloud-hosting.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcHSXk5eSp7ImA9WhRSEkg.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-9214030153861544660</id><published>2011-08-06T19:25:00.003+05:30</published><updated>2011-11-14T13:37:18.721+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-14T13:37:18.721+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="Autosuggest" /><category scheme="http://www.blogger.com/atom/ns#" term="AjaxToolKit" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Facebook like Autosuggest in Asp.net</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;This article is about using AjaxToolKit AutoCompleteExtender, to make Facebook like Autosuggest in asp.net. To use AutoCompleteExtender is simple, but we can modify the code little bit and make it more user friendly. Check out following Image. (Download &lt;a href="http://www.crocko.com/BF21124C1A0647EDB1072B903FD9771D/Facebook%20Like%20AutoSuggest%20in%20Asp.net.zip"&gt;Demo code&lt;/a&gt; for better understanding.)&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-lv740zjxVmE/TjwZHJP82lI/AAAAAAAAAw0/-9BtMt4sD7M/s1600/Facebook+like+Autosuggest+in+Asp.net.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ILHEJ4so4RA/TjwaOD4FKBI/AAAAAAAAAw4/ihmkPFobnmM/s1600/Facebook+like+Autosuggest+in+Asp.net.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-ILHEJ4so4RA/TjwaOD4FKBI/AAAAAAAAAw4/ihmkPFobnmM/s1600/Facebook+like+Autosuggest+in+Asp.net.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;u&gt;Note:&lt;a href="http://www.crocko.com/BF21124C1A0647EDB1072B903FD9771D/Facebook%20Like%20AutoSuggest%20in%20Asp.net.zip" target="_blank"&gt; Democode&lt;/a&gt; is developed in VS2010 and .net framework 4.0&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
AutoComplete extender can be used to extend behaviour of any ASP.NET TextBox control. Ajaxtoolkit autocomplete extender associates textbox control with a popup panel to display words which begins with the prefix that is entered into the text box. We can define the minimum length of charachters, after which extender displays a popup containing words or phrases that start with that value. &lt;/div&gt;&lt;br /&gt;
&lt;pre class="html" name="code"&gt;&lt;div&gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;&amp;lt;h2&amp;gt;
AutoComplete Demonstration&amp;lt;/h2&amp;gt;
Type some characters in this textbox.  The web service returns names which contains
           text you have typed.
&amp;lt;table&amp;gt;
&amp;lt;tbody&amp;gt;
&amp;lt;tr&amp;gt;            &amp;lt;td&amp;gt;
&amp;lt;asp:textbox autocomplete="off" id="txtAutoComplete" runat="server" width="300"&amp;gt;&amp;lt;/asp:textbox&amp;gt;&amp;lt;/td&amp;gt;            &amp;lt;td&amp;gt;&amp;lt;div id="divLoading" style="display: none;"&amp;gt;
Loading...&amp;lt;/div&amp;gt;
&amp;lt;/td&amp;gt;            &amp;lt;/tr&amp;gt;
&amp;lt;/tbody&amp;gt;&amp;lt;/table&amp;gt;
    &amp;lt;ajaxtoolkit:autocompleteextender behaviorid="AutoCompleteEx" 
      completioninterval="500" 
      completionlistcssclass="completionListClass"
      completionlisthighlighteditemcssclass="CompletionListHighlightedItemClass" 
      completionlistitemcssclass="completionlistItemClass" 
      completionsetcount="0"
      delimitercharacters=";, :" 
      enablecaching="true"
      id="autoComplete1"
      minimumprefixlength="2"
      onclienthidden="ListPopulated"
      onclientitemselected="onSelection" 
      onclientpopulated="ItemSelected"  
      onclientpopulating="ListPopulating"
      runat="server" 
      servicemethod="GetCompletionList" 
      servicepath="AutoComplete.asmx"
      showonlycurrentwordincompletionlistitem="true"
      targetcontrolid="txtAutoComplete"&amp;gt;
              
  &amp;lt;animations&amp;gt;
     &amp;lt;onshow&amp;gt;
     &amp;lt;sequence&amp;gt;
     &amp;lt;%-- Make the completion list transparent and then show it --%&amp;gt;
     &amp;lt;opacityaction opacity="0"&amp;gt;
       &amp;lt;hideaction visible="true"&amp;gt;
                            
      &amp;lt;%--Cache the original size of the completion list the first time the animation is played and then set it to zero --%&amp;gt;
      &amp;lt;scriptaction script="
      // Cache the size and setup the initial size
      var behavior = $find('AutoCompleteEx');
       if (!behavior._height)
          {
           var target = behavior.get_completionList();
           behavior._height = target.offsetHeight - 2;
           target.style.height = '0px';
           }"&amp;gt;
                        
      &amp;lt;%-- Expand from 0px to the appropriate size while fading in --%&amp;gt;
      &amp;lt;parallel duration=".4"&amp;gt;
      &amp;lt;fadein&amp;gt;
      &amp;lt;length endvaluescript="$find('AutoCompleteEx')._height" propertykey="height" startvalue="0"&amp;gt;
      &amp;lt;/length&amp;gt;&amp;lt;/fadein&amp;gt;&amp;lt;/parallel&amp;gt;
                        &amp;lt;/scriptaction&amp;gt;&amp;lt;/hideaction&amp;gt;&amp;lt;/opacityaction&amp;gt;&amp;lt;/sequence&amp;gt;
                    &amp;lt;/onshow&amp;gt;
                    &amp;lt;onhide&amp;gt;
                        &amp;lt;;%-- Collapse down to 0px and fade out --%&amp;gt;;
                        &amp;lt;parallel duration=".4"&amp;gt;
                            &amp;lt;fadeout&amp;gt;
                            &amp;lt;length endvalue="0" propertykey="height" startvaluescript="$find('AutoCompleteEx')._height"&amp;gt;
                        &amp;lt;/length&amp;gt;&amp;lt;/fadeout&amp;gt;&amp;lt;/parallel&amp;gt;
                    &amp;lt;/onhide&amp;gt;
                &amp;lt;/animations&amp;gt;
            &amp;lt;/ajaxtoolkit:autocompleteextender&amp;gt;
        
&amp;lt;%-- Prevent enter in textbox from causing the collapsible panel from operating --%&amp;gt;
 &amp;lt;input style="display: none;" type="submit" /&amp;gt;
           

&amp;lt;div id="divAddressDetails"&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
To Make AutoExtender work, we need to define certain properties.&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;TargetControlID&lt;/b&gt;:  The TextBox control where the user types content to be                 automatically completed.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ServicePath&lt;/b&gt;: The path to the web service that the extender will pull the                 word\sentence completions from.  If this is not provided, the service method should be a page                 method.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ServiceMethod&lt;/b&gt; - The web service method to be called.  The signature of this method must match the following: &lt;br /&gt;
&lt;pre class="c#" name="code"&gt;[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] YourFunctionName(string prefixText,int count)
&lt;/pre&gt;&lt;br /&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;Syntax of the function should remain same.&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;CompletionListCssClass&lt;/b&gt; - Css Class that will be used to style the completion list flyout.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;CompletionListItemCssClass&lt;/b&gt; - Css Class that will be used to style an item in the AutoComplete list flyout.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;CompletionListHighlightedItemCssClass&lt;/b&gt; - Css Class that will be used to style a highlighted item in the AutoComplete list flyout.&lt;/li&gt;
&lt;/ol&gt;(Refer &lt;a href="http://www.crocko.com/BF21124C1A0647EDB1072B903FD9771D/Facebook%20Like%20AutoSuggest%20in%20Asp.net.zip" target="_blank"&gt;DEMO CODE&lt;/a&gt; for better Understanding...)&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;In above HTML Autocompletete extender; we can display loading image; this will make user understand that something is happening behind the screen. We have used three properties to display &amp;amp; Hide loading image and to display YELLOW background for the text as in above screen shot... &lt;/u&gt;&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;OnClientPopulating&lt;/b&gt;: This adds event handler to Client side populating event. In our &lt;a href="http://www.crocko.com/88DA6397F3C84042A7B886157EDF9C98/Facebook%20Like%20AutoSuggest%20in%20Asp.net.zip"&gt;demo&lt;/a&gt; we have used &lt;i&gt;&lt;u&gt;&lt;b&gt;ListPopulating&lt;/b&gt;&lt;/u&gt;&lt;/i&gt; function as event handler, we use this handler to display loading image, which is as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" name="code"&gt;function ListPopulating(source, e) {
   window.document.getElementById('divLoading').style.display = "";
  
   var textboxControl = window.document.getElementById(source.get_element().id);
   // Get the textbox control.
  
   textboxControl.style.background = "url(Images/loader.gif) no-repeat right";
  //Above code displays loading image inside text box...
                }
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;OnClientHidden&lt;/b&gt;: This adds event handler to Client side hidden event of AutoExtentender. This handler gets fired when Autocomplete popup goes hidden. We have used &lt;i&gt;&lt;u&gt;&lt;b&gt;ListPopulated&lt;/b&gt;&lt;/u&gt;&lt;/i&gt; function to handle this event. We use this event to hide loading image. &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" name="code"&gt;function ListPopulated(source, e) {

  window.document.getElementById('divLoading').style.display = "none";
                    
  var textboxControl = window.document.getElementById(source.get_element().id); 
  // Get the textbox control.
                    
  textboxControl.style.background = "";
  }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;OnClientPopulated: &lt;/b&gt;This event handler can be used when Autosuggest list is populated. We have used this event handler to display YELLOW background in typed text. Check out above screenshot. Function name for this event is &lt;i&gt;&lt;u&gt;&lt;b&gt;ItemSelected,&lt;/b&gt;&lt;/u&gt;&lt;/i&gt; this JavaScript function is as follows. &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" name="code"&gt;function ItemSelected(source, e) {
   window.document.getElementById('divLoading').style.display = "none";
   var customers = source.get_completionList().childNodes;
   var searchText = source.get_element().value;

   for (var i = 0; i &amp;lt; customers.length; i++) {

   var customer;//  eval('(' + customers[i]._value + ')');

   customers[i].innerHTML = customers[i].innerHTML.replace(new RegExp('(' + searchText + ')', 'gi'), "&lt;span style="background-color: yellow;"&gt;&lt;b&gt;$1&lt;/b&gt;&lt;/span&gt;");

   //We can modify the innerHTML if we want to display more information.
   // e.g. some logo or image
        }  
   }
&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
Apart from HTML and javascript we used a webmethod naming &lt;i&gt;&lt;u&gt;&lt;b&gt;GetCompletionList&lt;/b&gt;&lt;/u&gt;&lt;/i&gt; which is as follows&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="html" name="code"&gt;[WebMethod]
    public string[] GetCompletionList(string prefixText, int count)
    {

        //string sql = "WRITE SQL QUERY with Like Statement and use prefix text e.g. PartnerName like '%" + prefixText + "%'";

        //SqlDataAdapter da = new SqlDataAdapter(sql, "ConnectionString");
       
        DataTable dt = DT;// new DataTable();
        DataRow [] dr = dt.Select("Name LIKE '%" + prefixText + "%'");
        //    da.Fill(dt);
        //    da.Dispose();
        
        if (count == 0)
        {
            count = dr.Length;
            //count = dt.Rows.Count;
        }

       
        List&lt;string&gt; items = new List&lt;string&gt;(count);
        for (int i = 0; i &amp;lt; count; i++)
        {
            string value = dr[i]["City"].ToString() + "|" + dr[i]["State"].ToString() + "|" + dr[i]["Country"].ToString() + "|" + dr[i]["PostalCode"].ToString();
            var Items = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(dr[i]["Name"].ToString(), value);
            //Using this we can send Name, Value pair client side. 
            //Value can be used to display related data of selected Name.

            //string value = dt.Rows[i]["City"].ToString() + "|" + dt.Rows[i]["State"].ToString() + "|" + dt.Rows[i]["Country"].ToString() + "|" + dt.Rows[i]["PostalCode"].ToString();
            //var items1 = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(dt.Rows[i]["Name"].ToString(), value);

            items.Add(Items);
        }
        

        return items.ToArray();
    }
&lt;/string&gt;&lt;/string&gt;
//Ignore above string string tag it is coming due to some editor issue of auto completing tags, some syntax issue.
&lt;/pre&gt;&lt;br /&gt;
Check out follwing screen shot, on selection of User we are displaying his/her information. (Note that we have created Name-Value pair in above code to display the information in following screen shot format.)&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-J_ulbrJxHho/Tj09qIFZScI/AAAAAAAAAw8/43rIqeOijK0/s1600/Facebook+like+Autosuggest+in+Asp.net-+1.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-J_ulbrJxHho/Tj09qIFZScI/AAAAAAAAAw8/43rIqeOijK0/s1600/Facebook+like+Autosuggest+in+Asp.net-+1.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Now to display Selected User related address information as in the Screen shot, we used event handler of AutoCompleteExtender naming &lt;i&gt;&lt;u&gt;&lt;b&gt;OnClientItemSelected&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;OnClientItemSelected&lt;/b&gt;: Handler to attach to the client-side itemSelected event. We used function naming &lt;b&gt;onSelection &lt;/b&gt;to display Address details, this JavaScript function is as follows&lt;/li&gt;
&lt;/ul&gt;&lt;pre class="JavaScript" name="code"&gt;function onSelection(source, e) {

var htmlString = "&lt;fieldset&gt;&lt;legend&gt;Address Details&lt;/legend&gt; " +
"


&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;City&lt;/td&gt;&lt;td&gt;" + e._value.split("|")[0] + "&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;State&lt;/td&gt;&lt;td&gt;" + e._value.split("|")[1] + "&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Country&lt;/td&gt;&lt;td&gt;" + e._value.split("|")[2] + "&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Postal Code&lt;/td&gt;&lt;td&gt;" + e._value.split("|")[3] + "&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/fieldset&gt;";

// Above alignement might disorder due to HTML rules of blogger, make sure in coding you handle it.

    window.document.getElementById('divAddressDetails').innerHTML = htmlString;
    var customers = source.get_completionList().childNodes;
                    
     //Following is used to put value in Textbox, as we are overriding it to display address.
     if (document.all) {
     window.document.getElementById(source.get_element().id).value = e._item.innerText;
        }
     else window.document.getElementById(source.get_element().id).value = e._item.textContent;

      }


&lt;/pre&gt;&lt;br /&gt;
We are done with development of Facebook Like Autosuggest in Asp.net. &lt;br /&gt;
Donwload demo code here --&amp;gt; &lt;a href="http://www.crocko.com/BF21124C1A0647EDB1072B903FD9771D/Facebook%20Like%20AutoSuggest%20in%20Asp.net.zip" target="_blank"&gt;Facebook Like AutoSuggest in Asp.net.zip&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-9214030153861544660?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/oTRpnL4wKhg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/9214030153861544660/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=9214030153861544660" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/9214030153861544660?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/9214030153861544660?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/oTRpnL4wKhg/facebook-like-autosuggest-in-aspnet.html" title="Facebook like Autosuggest in Asp.net" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-ILHEJ4so4RA/TjwaOD4FKBI/AAAAAAAAAw4/ihmkPFobnmM/s72-c/Facebook+like+Autosuggest+in+Asp.net.gif" height="72" width="72" /><thr:total>7</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/08/facebook-like-autosuggest-in-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYCR3Y6fip7ImA9WhRTE08.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-9166366200022533699</id><published>2011-07-19T15:31:00.001+05:30</published><updated>2011-11-03T18:12:46.816+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-03T18:12:46.816+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Send Email In Asp.net" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Browser" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Gmail" /><title>Send Email In Asp.net Using Gmail</title><content type="html">We can use Gmail smtp server to send email, using Asp.Net. Before we start developing Asp.net code, make sure POP is enabled in your Gmail's mail setting.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-oOXrr6CSiJ8/TiVPa-PdbUI/AAAAAAAAAwo/tmAMAHty_-g/s1600/Gmail+POP+Enabling.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="63" id=":current_picnik_image" src="http://3.bp.blogspot.com/-S5tpM-Hdmno/TiVTfOYvMxI/AAAAAAAAAww/HYL0y507O0E/s400/15335700905_npN42.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you done with this step SAVE your Gmail settings....&lt;br /&gt;
&lt;br /&gt;
To do Email sending in Asp.net we need "&lt;b&gt;System.Net.Mail&lt;/b&gt;" namespace. &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public static Boolean SendEmail()
{
  MailMessage mail = new MailMessage();

mail.From = new MailAddress("YOUR FROM EMAIL ADDRESS");
mail.To.Add(new MailAddress("YOUR TO EMAIL ADDRESS"));            
mail.Bcc.Add(new MailAddress("YOUR BCC EMAIL"));
            
  mail.Subject = "Email using Gmail";

  string Body = "Put your Email Body TEXT here";&amp;nbsp;
// Here you can put HTML string if you want email to be sent in HTML format.
  mail.Body = Body;

  mail.IsBodyHtml = true;
  SmtpClient smtp = new SmtpClient();
  smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
  smtp.Credentials = new System.Net.NetworkCredential
       ("Username@gmail.com","GmailPassword");
//Or your Smtp Email ID and Password
  smtp.EnableSsl = true;
  smtp.Send(mail);
}
&lt;/pre&gt;&lt;br /&gt;
This is simple function to send email in Asp.net using Gmail account. &lt;br /&gt;
You can also find Copy of this email in Your SENT items.&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-9166366200022533699?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/aOCxKVLoG58" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/9166366200022533699/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=9166366200022533699" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/9166366200022533699?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/9166366200022533699?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/aOCxKVLoG58/send-email-in-aspnet-using-gmail.html" title="Send Email In Asp.net Using Gmail" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-S5tpM-Hdmno/TiVTfOYvMxI/AAAAAAAAAww/HYL0y507O0E/s72-c/15335700905_npN42.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/07/send-email-in-aspnet-using-gmail.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08DSH84cSp7ImA9WhZXFUQ.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-7709171198840744903</id><published>2011-05-05T16:07:00.000+05:30</published><updated>2011-05-05T16:07:59.139+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-05T16:07:59.139+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript" /><category scheme="http://www.blogger.com/atom/ns#" term="Web page" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><title>Disable Text Selection using Javascript</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;In the web development cycle, at times we come to a requirement where we need to disable text selection for some HTML Tags i.e. "Do not allow to select text present in some particular Div tag, or span tag or text present in some table" in that case we can use following function. Actually this JavaScript function can be used to Disable Text selection for whole body of the HTML.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="JavaScript" cols="60" name="code" rows="25"&gt;function disableSelection(target) {
        if (typeof target.onselectstart != "undefined") //IE route
            target.onselectstart = function () { return false }
        else if (typeof target.style.MozUserSelect != "undefined") //Firefox route
            target.style.MozUserSelect = "none"
        else //All other route (ie: Opera)
            target.onmousedown = function () { return false }
        target.style.cursor = "default"
    }

&lt;/pre&gt;&lt;br /&gt;
Define above function in HEAD tag and call this function either on some form event or directly at the bottom of the HTML page.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="JavaScript" cols="60" name="code" rows="25"&gt;//disableSelection(document.body) //Disable text selection on entire body

disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
This is very small function but it was very useful for one of my project.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-7709171198840744903?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/THHsGyZCCZc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/7709171198840744903/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=7709171198840744903" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/7709171198840744903?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/7709171198840744903?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/THHsGyZCCZc/disable-text-selection-using-javascript.html" title="Disable Text Selection using Javascript" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/05/disable-text-selection-using-javascript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0IBQXg9cSp7ImA9WhZXEUs.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-1683972026230049122</id><published>2011-04-30T16:35:00.000+05:30</published><updated>2011-04-30T16:35:50.669+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-30T16:35:50.669+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web User Control" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Web page" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Grid View" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="GridView" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Ado.net" /><title>Add Update Delete in Gridview Asp.net</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: justify;"&gt;This article is about simple way to Add Update and Delete records using asp.net GridView using Dataset or Datatable. We shall update the database table naming &lt;a href="http://www.easy-share.com/1915047723/UserManagement.zip"&gt;(Download Demo&lt;/a&gt;)&lt;/div&gt;&lt;br /&gt;
"UserTable". &lt;br /&gt;
&lt;br /&gt;
Schema for UserTable is as follows&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-hoAhNsPpJOs/Tbe5NkXVmNI/AAAAAAAAAwU/B3NfedgKwH0/s1600/UserTableSchema.gif" imageanchor="1" style="bottom: 1em; clear: left; float: left; margin-right: 1em;"&gt;&lt;img border="0" height="180" src="http://4.bp.blogspot.com/-hoAhNsPpJOs/Tbe5NkXVmNI/AAAAAAAAAwU/B3NfedgKwH0/s400/UserTableSchema.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Note:I have used SqlServer 2008&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;For this article we are going to fill GridView by data from database.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;We are going to make perform following operations on data using GridView&lt;/div&gt;&lt;ol style="text-align: left;"&gt;&lt;li style="text-align: justify;"&gt;Add New record into database; here data will directly be added into database table&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;Update Records into database, using edit link.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;Delete Records using delete link&lt;/li&gt;
&lt;/ol&gt;&lt;blockquote&gt;To make Add Update Delete in Gridview more user friendly; make sure your website is Ajax Enabled  and Gridview is put under UpdatePanel. This will avoid unnecessary &lt;br /&gt;
&lt;br /&gt;
postback and Gridview control will look smart.&lt;/blockquote&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Before we develop GridView, lets work out main functions for database operations. Create a Class File naming "ManageUsers" and add following functions one by one&lt;/div&gt;&lt;br /&gt;
&lt;u&gt;Fetch Data from Database.&lt;/u&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public DataTable Fetch()
    {
        string sql = "Select * From UserTable";
        SqlDataAdapter da = new SqlDataAdapter(sql, cnstr);
        DataTable dt = new DataTable();
        da.Fill(dt);
        return dt;
        // Write your own Logic for fetching data, this method should return a DataTable
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Update Data into Database&lt;/u&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public void Update(int id, string FirstName, string LastName, string EmailAddress, string LoginId, string Password, string StartDate, string EndDate)
    {
        string sql = "UPDATE UserTable SET [First Name] = '"+ FirstName + "',[Last Name] = '" + LastName + "',[Login Id] = '" + LoginId +"' ,[Password] = '" + Password 

+ "'";
             sql += ",[Start Date] = '" + StartDate +"',[End Date] = '" + EndDate +"',[Email Address] = '" + EmailAddress + "' WHERE Id=" + id;

        SqlConnection conn = new SqlConnection(cnstr);
        conn.Open();
        SqlCommand cmd = new SqlCommand(sql, conn);
        cmd.ExecuteNonQuery();
        conn.Close();
        conn.Dispose();

    }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Insert new records into Database&lt;/u&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public void Insert(string FirstName, string LastName, string EmailAddress, string LoginId, string Password, string StartDate, string EndDate)
    {
       string sql = "INSERT INTO UserTable ([First Name],[Last Name],[Login Id],[Password],[Start Date],[End Date],[Email Address]) ";
       sql +=" VALUES ('"+ FirstName +"','" + LastName + "','" + LoginId +"','" + Password + "','" + StartDate + "','" + EndDate + "','" + EmailAddress + "')";
           
        SqlConnection conn = new SqlConnection(cnstr);
        conn.Open();
        SqlCommand cmd = new SqlCommand(sql, conn);
        cmd.ExecuteNonQuery();
        conn.Close();
        conn.Dispose();
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;u&gt;Delete records from Database&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public void Delete(int id)
    {
        string sql = "DELETE FROM UserTable WHERE Id=" + id;
        SqlConnection conn = new SqlConnection(cnstr);
        conn.Open();
        SqlCommand cmd = new SqlCommand(sql, conn);
        cmd.ExecuteNonQuery();
        conn.Close();
        conn.Dispose();
        // Write your own Delete statement blocks.
    }
&lt;/pre&gt;&lt;br /&gt;
In above code &lt;u style="color: orange;"&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: black;"&gt;cnstr&lt;/span&gt;&lt;/span&gt; &lt;/b&gt;&lt;/u&gt;is the connection string for our &lt;br /&gt;
&lt;br /&gt;
database.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;Now we shall make changes in GridView (Note: Make sure GridView is added on page and under updatepanel) (&lt;a href="http://www.easy-share.com/1915047723/UserManagement.zip"&gt;Download Demo&lt;/a&gt;)&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;Once we add gridview inside updatepanel, do following things&lt;/div&gt;&lt;ol style="text-align: left;"&gt;&lt;li style="text-align: justify;"&gt;set AutoGenerateColumns as False.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;Change the ShowFooter Flag to True&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;set the DataKeyNames your column name for Id. (This field can have multiple values depending on requirement, we are going to use Id, as it is primary key of our datatable. These values are available in GridView events. We can access them using. &lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;u&gt;GridView.DataKeys[e.RowIndex].Values[0]&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Smart Navigation Tag of the GridView                             control, choose Add New Column&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-v8cRrV1UJZU/TbunsZnaWeI/AAAAAAAAAwY/CXOBXNrY46c/s1600/AddNewColumn.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-v8cRrV1UJZU/TbunsZnaWeI/AAAAAAAAAwY/CXOBXNrY46c/s1600/AddNewColumn.png" /&gt;&lt;/a&gt;&lt;/div&gt;Now add 8 BoundField columns with DataField values as "Id","First Name","Last Name","Email Address", "Login Id", "Password", "Start Date", "End Date"; also add 2 CommandField columns with one for Edit/Update and another for Delete functions. Now we can see our Grid View control is ready. Above data fields are column names of the DataTable we are using. (To bind correct columns, our datatable column names and gridview bound column's "DataField" should match.&lt;/li&gt;
&lt;li&gt;We shall also give facility to add new records, for that we will put controls in Footer row. To do this we need to convert all above BoundField columns to template field columns. Click on the Smart Navigation                             Tag on the GridView choose Edit Columns, the Field’s property window will open.&amp;nbsp;                            Select column by column from Id, include also Edit column, and                             select ‘Convert this field into a TemplateField’&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-_FKvqwlHSvU/TbusEhRukPI/AAAAAAAAAwc/qIkV7dSqdDU/s1600/ConvertToTemplate.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="265" src="http://4.bp.blogspot.com/-_FKvqwlHSvU/TbusEhRukPI/AAAAAAAAAwc/qIkV7dSqdDU/s320/ConvertToTemplate.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;Except "delete" column all the BoundField columns are converted in to Template Field Column.&lt;/li&gt;
&lt;li&gt;Now one by one we will controls to Footer of the GridView. Right click on the GridView control, select Edit Template.&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Qn-VuljB9Nc/Tbuu92D9yxI/AAAAAAAAAwg/5h_J5W39iG8/s1600/EditTemplate.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="185" src="http://4.bp.blogspot.com/-Qn-VuljB9Nc/Tbuu92D9yxI/AAAAAAAAAwg/5h_J5W39iG8/s320/EditTemplate.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;u&gt;Column[0] – Id&lt;/u&gt;:  select Edit Template, choose column[0] – Id,                                         you can view a label placed in the ItemTemplate section and a TextBox placed in                                         the EditItemTemplate section (Id is our Primary key and it should not be editable). In edit Item Section template, put Label. Do not add anything in Footer Template.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Column[1] - First Name&lt;/u&gt; &lt;br /&gt;
Now again select Edit Template, choose column[1] - First Name, Add another TextBox in the FooterTemplate section and name it as NewFirstName.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Column[2] - Last Name&lt;/u&gt; &lt;br /&gt;
Choose column[2] - Last Name, Add another TextBox in the FooterTemplate section and name it as NewLastName.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Column[3] - Email Address&lt;/u&gt; &lt;br /&gt;
Choose column[3] - Email Address, Add another TextBox in the FooterTemplate section and name it as NewEmailAddress.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Column[4] - Login Id&lt;/u&gt; &lt;br /&gt;
Choose column[4] - Login Id, Add another TextBox in the FooterTemplate section and name it as NewLoginId.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Column[5] - Password&lt;/u&gt; &lt;br /&gt;
Choose column[5] - Password, Add another TextBox in the FooterTemplate section and name it as NewPassword.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Column[6] - Start Date&lt;/u&gt; &lt;br /&gt;
Choose column[6] - Start Date, Add another TextBox in the FooterTemplate section and name it as NewStartDate.&lt;span style="color: #0b5394;"&gt; (&lt;/span&gt;&lt;u style="color: #0b5394;"&gt;Check following source view, we have added, Calender Extender of Ajax Toolkit&lt;/u&gt;&lt;span style="color: #0b5394;"&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Column[7] - End Date&lt;/u&gt; &lt;br /&gt;
Choose column[7] - End Date, Add another TextBox in the FooterTemplate section and name it as NewEndDate.&amp;nbsp;&lt;span style="background-color: white; color: #0b5394;"&gt; (&lt;/span&gt;&lt;u style="background-color: white; color: #0b5394;"&gt;Check following source view, we have added, Calender Extender of Ajax Toolkit&lt;/u&gt;&lt;span style="background-color: white; color: #0b5394;"&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Column[8] - Edit&lt;/u&gt; &lt;br /&gt;
Just add a link button into the FooterTemplate section, specify its CommandName property as ‘AddNew’. &lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
Source of the Gridview control changes to following, check we have added Calender Extender for date selection. (&lt;a href="http://www.easy-share.com/1915047723/UserManagement.zip"&gt;Download Demo&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="HTML" cols="60" name="code" rows="25"&gt;&lt;asp:gridview autogeneratecolumns="False" datakeynames="Id" enablemodelvalidation="True" id="gridUserManagement" onrowcancelingedit="gridUserManagement_RowCancelingEdit" onrowcommand="gridUserManagement_RowCommand" onrowdeleting="gridUserManagement_RowDeleting" onrowediting="gridUserManagement_RowEditing" onrowupdating="gridUserManagement_RowUpdating" runat="server" showfooter="True"&gt;
        &lt;columns&gt;
            &lt;asp:templatefield headertext="Id" sortexpression="Id"&gt;
                &lt;edititemtemplate&gt;
                    &lt;asp:label id="TextBox1" runat="server" text="&amp;lt;%# Bind(&amp;quot;Id&amp;quot;) %&amp;gt;"&gt;&lt;/asp:label&gt;
                &lt;/edititemtemplate&gt;
                &lt;itemtemplate&gt;
                    &lt;asp:label id="Label1" runat="server" text="&amp;lt;%# Bind(&amp;quot;Id&amp;quot;) %&amp;gt;"&gt;&lt;/asp:label&gt;
                &lt;/itemtemplate&gt;
            &lt;/asp:templatefield&gt;
            &lt;asp:templatefield headertext="First Name"&gt;
                &lt;edititemtemplate&gt;
                    &lt;asp:textbox id="TextBox2" runat="server" text="&amp;lt;%# Bind(&amp;quot;[First Name]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:textbox&gt;
                &lt;/edititemtemplate&gt;
                &lt;footertemplate&gt;
                    &lt;asp:textbox id="NewFirstName" runat="server"&gt;&lt;/asp:textbox&gt;
                &lt;/footertemplate&gt;
                &lt;itemtemplate&gt;
                    &lt;asp:label id="Label2" runat="server" text="&amp;lt;%# Bind(&amp;quot;[First Name]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:label&gt;
                &lt;/itemtemplate&gt;
            &lt;/asp:templatefield&gt;
            &lt;asp:templatefield headertext="Last Name"&gt;
                &lt;edititemtemplate&gt;
                    &lt;asp:textbox id="TextBox3" runat="server" text="&amp;lt;%# Bind(&amp;quot;[Last Name]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:textbox&gt;
                &lt;/edititemtemplate&gt;
                &lt;footertemplate&gt;
                    &lt;asp:textbox id="NewLastName" runat="server"&gt;&lt;/asp:textbox&gt;
                &lt;/footertemplate&gt;
                &lt;itemtemplate&gt;
                    &lt;asp:label id="Label3" runat="server" text="&amp;lt;%# Bind(&amp;quot;[Last Name]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:label&gt;
                &lt;/itemtemplate&gt;
            &lt;/asp:templatefield&gt;
            &lt;asp:templatefield headertext="Email Address"&gt;
                &lt;edititemtemplate&gt;
                    &lt;asp:textbox id="TextBox4" runat="server" text="&amp;lt;%# Bind(&amp;quot;[Email Address]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:textbox&gt;
                &lt;/edititemtemplate&gt;
                &lt;footertemplate&gt;
                    &lt;asp:textbox id="NewEmailAddress" runat="server"&gt;&lt;/asp:textbox&gt;
                &lt;/footertemplate&gt;
                &lt;itemtemplate&gt;
                    &lt;asp:label id="Label4" runat="server" text="&amp;lt;%# Bind(&amp;quot;[Email Address]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:label&gt;
                &lt;/itemtemplate&gt;
            &lt;/asp:templatefield&gt;
            &lt;asp:templatefield headertext="Login Id"&gt;
                &lt;edititemtemplate&gt;
                    &lt;asp:textbox id="TextBox5" runat="server" text="&amp;lt;%# Bind(&amp;quot;[Login Id]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:textbox&gt;
                &lt;/edititemtemplate&gt;
                &lt;footertemplate&gt;
                    &lt;asp:textbox id="NewLoginId" runat="server"&gt;&lt;/asp:textbox&gt;
                &lt;/footertemplate&gt;
                &lt;itemtemplate&gt;
                    &lt;asp:label id="Label5" runat="server" text="&amp;lt;%# Bind(&amp;quot;[Login Id]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:label&gt;
                &lt;/itemtemplate&gt;
            &lt;/asp:templatefield&gt;
            &lt;asp:templatefield headertext="Password"&gt;
                &lt;edititemtemplate&gt;
                    &lt;asp:textbox id="TextBox6" runat="server" text="&amp;lt;%# Bind(&amp;quot;Password&amp;quot;) %&amp;gt;"&gt;&lt;/asp:textbox&gt;
                &lt;/edititemtemplate&gt;
                &lt;footertemplate&gt;
                    &lt;asp:textbox id="NewPassword" runat="server"&gt;&lt;/asp:textbox&gt;
                &lt;/footertemplate&gt;
                &lt;itemtemplate&gt;
                    &lt;asp:label id="Label6" runat="server" text="&amp;lt;%# Bind(&amp;quot;Password&amp;quot;) %&amp;gt;"&gt;&lt;/asp:label&gt;
                &lt;/itemtemplate&gt;
            &lt;/asp:templatefield&gt;
            &lt;asp:templatefield headertext="Start Date"&gt;
                &lt;edititemtemplate&gt;
                    &lt;asp:textbox id="TextBox8" runat="server" text="&amp;lt;%# Bind(&amp;quot;[Start Date]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:textbox&gt;
                    &lt;cc1:calendarextender format="dd-MMM-yyyy" id="CalendarExtender1" runat="server" targetcontrolid="TextBox8"&gt;&lt;/cc1:calendarextender&gt;
                &lt;/edititemtemplate&gt;
                &lt;footertemplate&gt;
                    &lt;asp:textbox id="NewStartDate" runat="server"&gt;&lt;/asp:textbox&gt;
                    &lt;cc1:calendarextender format="dd-MMM-yyyy" id="CalendarExtender4" runat="server" targetcontrolid="NewStartDate"&gt;&lt;/cc1:calendarextender&gt;
                &lt;/footertemplate&gt;
                &lt;itemtemplate&gt;
                    &lt;asp:label id="Label8" runat="server" text="&amp;lt;%# Bind(&amp;quot;[Start Date]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:label&gt;
                &lt;/itemtemplate&gt;
            &lt;/asp:templatefield&gt;
            &lt;asp:templatefield headertext="End Date"&gt;
                &lt;edititemtemplate&gt;
                    &lt;asp:textbox id="TextBox9" runat="server" text="&amp;lt;%# Bind(&amp;quot;[End Date]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:textbox&gt;
                    &lt;cc1:calendarextender format="dd-MMM-yyyy" id="CalendarExtender2" runat="server" targetcontrolid="TextBox9"&gt;&lt;/cc1:calendarextender&gt;
                &lt;/edititemtemplate&gt;
                &lt;footertemplate&gt;
                    &lt;asp:textbox id="NewEndDate" runat="server"&gt;&lt;/asp:textbox&gt;
                    &lt;cc1:calendarextender format="dd-MMM-yyyy" id="CalendarExtender3" runat="server" targetcontrolid="NewEndDate"&gt;&lt;/cc1:calendarextender&gt;
                &lt;/footertemplate&gt;
                &lt;itemtemplate&gt;
                    &lt;asp:label id="Label9" runat="server" text="&amp;lt;%# Bind(&amp;quot;[End Date]&amp;quot;) %&amp;gt;"&gt;&lt;/asp:label&gt;
                &lt;/itemtemplate&gt;
            &lt;/asp:templatefield&gt;
            &lt;asp:templatefield showheader="False"&gt;
                &lt;edititemtemplate&gt;
                    &lt;asp:linkbutton causesvalidation="True" commandname="Update" id="LinkButton1" runat="server" text="Update"&gt;&lt;/asp:linkbutton&gt;
                    &amp;nbsp;&lt;asp:linkbutton causesvalidation="False" commandname="Cancel" id="LinkButton2" runat="server" text="Cancel"&gt;&lt;/asp:linkbutton&gt;
                &lt;/edititemtemplate&gt;
                &lt;footertemplate&gt;
                    &lt;asp:linkbutton commandname="AddNew" id="AddNew" runat="server"&gt;Add New&lt;/asp:linkbutton&gt;
                &lt;/footertemplate&gt;
                &lt;itemtemplate&gt;
                    &lt;asp:linkbutton causesvalidation="False" commandname="Edit" id="LinkButton1" runat="server" text="Edit"&gt;&lt;/asp:linkbutton&gt;
                &lt;/itemtemplate&gt;
            &lt;/asp:templatefield&gt;
            &lt;asp:commandfield showdeletebutton="True"&gt;
        &lt;/asp:commandfield&gt;&lt;/columns&gt;
        &lt;/asp:gridview&gt;
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;div style="text-align: justify;"&gt;Now we shall develop code in code behind of web page i.e. in C#. We have already developed ManageUsers Class in start. We will develop code for handing Edit,Update and Insert operations of GridView. Add events as shown in following image.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-IfAGH3sBU1U/TbvcO5OS8eI/AAAAAAAAAwk/XdIOPAuW33E/s1600/GridViewEvents.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="290" src="http://1.bp.blogspot.com/-IfAGH3sBU1U/TbvcO5OS8eI/AAAAAAAAAwk/XdIOPAuW33E/s400/GridViewEvents.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;Now check out following code for each event we have added for GridView.&lt;br /&gt;
&lt;br /&gt;
Create object of the Class "&lt;u&gt;ManageUsers&lt;/u&gt;"; and write function to Bind Customer details to the GridView.&lt;/div&gt;&lt;pre class="c#" cols="60" name="code" rows="25"&gt;private void BindCustomers()
    {
        DataTable CustomerTable = customer.Fetch();

        if (CustomerTable.Rows.Count &amp;gt; 0)
        {
            gridUserManagement.DataSource = CustomerTable;
            gridUserManagement.DataBind();
        }
        else
        {
            CustomerTable.Rows.Add(CustomerTable.NewRow());
            gridUserManagement.DataSource = CustomerTable;
            gridUserManagement.DataBind();

            int TotalColumns = gridUserManagement.Rows[0].Cells.Count;
            gridUserManagement.Rows[0].Cells.Clear();
            gridUserManagement.Rows[0].Cells.Add(new TableCell());
            gridUserManagement.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            gridUserManagement.Rows[0].Cells[0].Text = "No Record Found";
        }
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;u&gt; Initializing the GridView control on Page load&lt;/u&gt;:&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindCustomers();
        }
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;u&gt; GridView RowEditing Event&lt;/u&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void gridUserManagement_RowEditing(object sender, GridViewEditEventArgs e)
    {
        gridUserManagement.EditIndex = e.NewEditIndex;
        BindCustomers(); 
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;u&gt; GridView RowCancelingEdit Event&lt;/u&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void gridUserManagement_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        gridUserManagement.EditIndex = -1;
        BindCustomers(); 
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;u&gt; Updating Records (GridView RowUpdating Event)&lt;/u&gt;: Update the data to the UserTable, by adding the following lines of code in the GridView’s RowUpdating event&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void gridUserManagement_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txtNewFirstName = (TextBox)gridUserManagement.Rows[e.RowIndex].FindControl("TextBox2");
        TextBox txtNewLastName = (TextBox)gridUserManagement.Rows[e.RowIndex].FindControl("TextBox3");
        TextBox txtNewEmailAddress = (TextBox)gridUserManagement.Rows[e.RowIndex].FindControl("TextBox4");
        TextBox txtNewLoginId = (TextBox)gridUserManagement.Rows[e.RowIndex].FindControl("TextBox5");
        TextBox txtNewPassword = (TextBox)gridUserManagement.Rows[e.RowIndex].FindControl("TextBox6");
        TextBox txtNewStartDate = (TextBox)gridUserManagement.Rows[e.RowIndex].FindControl("TextBox8");
        TextBox txtNewEndDate = (TextBox)gridUserManagement.Rows[e.RowIndex].FindControl("TextBox9");

        customer.Update(Convert.ToInt32(gridUserManagement.DataKeys[e.RowIndex].Values[0].ToString()), txtNewFirstName.Text, txtNewLastName.Text, txtNewEmailAddress.Text, txtNewLoginId.Text, txtNewPassword.Text, txtNewStartDate.Text, txtNewEndDate.Text);
        gridUserManagement.EditIndex = -1;
        BindCustomers(); 
    }
&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;The above block of codes in RowUpdating event, finds the control in the GridView, takes those values in pass it to the ManageUsers class Update method. The first parameter GridView1.DataKeys[e.RowIndex].Values[0].ToString() will return the Id of the Customer. That is the unique id for each customer to perform update function.&lt;/div&gt;&lt;br /&gt;
&lt;u&gt; Delete In GridView&lt;/u&gt;: &lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void gridUserManagement_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        customer.Delete(Convert.ToInt32(gridUserManagement.DataKeys[e.RowIndex].Values[0].ToString()));
        BindCustomers(); 
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;u&gt;Add New Records from GridView control&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void gridUserManagement_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("AddNew"))
        {
            TextBox txtNewFirstName = (TextBox)gridUserManagement.FooterRow.FindControl("NewFirstName");
            TextBox txtNewLastName = (TextBox)gridUserManagement.FooterRow.FindControl("NewLastName");
            TextBox txtNewEmailAddress = (TextBox)gridUserManagement.FooterRow.FindControl("NewEmailAddress");
            TextBox txtNewLoginId = (TextBox)gridUserManagement.FooterRow.FindControl("NewLoginId");
            TextBox txtNewPassword = (TextBox)gridUserManagement.FooterRow.FindControl("NewPassword");
            TextBox txtNewStartDate = (TextBox)gridUserManagement.FooterRow.FindControl("NewStartDate");
            TextBox txtNewEndDate = (TextBox)gridUserManagement.FooterRow.FindControl("NewEndDate");

            customer.Insert(txtNewFirstName.Text, txtNewLastName.Text, txtNewEmailAddress.Text, txtNewLoginId.Text, txtNewPassword.Text, txtNewStartDate.Text, txtNewEndDate.Text);
            BindCustomers();
        } 
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;
This is how we can develop a simple GridView control in Asp.Net with Add Update Delete functionality.&lt;br /&gt;
&lt;br /&gt;
Download Demo Code here --&amp;gt; &lt;a href="http://www.easy-share.com/1915047723/UserManagement.zip"&gt;Add Update Delete in Gridview Asp.net&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-1683972026230049122?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/hVAbQDv5v_s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/1683972026230049122/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=1683972026230049122" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/1683972026230049122?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/1683972026230049122?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/hVAbQDv5v_s/add-update-delete-in-gridview-aspnet.html" title="Add Update Delete in Gridview Asp.net" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-hoAhNsPpJOs/Tbe5NkXVmNI/AAAAAAAAAwU/B3NfedgKwH0/s72-c/UserTableSchema.gif" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/04/add-update-delete-in-gridview-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQAQXc-cSp7ImA9WhZXEEU.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-2031156691506969274</id><published>2011-04-29T18:52:00.000+05:30</published><updated>2011-04-29T18:52:20.959+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-29T18:52:20.959+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript" /><category scheme="http://www.blogger.com/atom/ns#" term="String Function in JavaScript" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Replace All" /><category scheme="http://www.blogger.com/atom/ns#" term="Java Script" /><title>Javascript String Replace All Function</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;JavaScript String Replace function only replaces the first occurrence in the string. Replace function takes two simple parameters, The first parameter is the pattern to find and the second parameter is the string to replace the pattern with when found. The javascript function does not Replace All...&lt;br /&gt;
&lt;br /&gt;
str = str.replace(”Pattern”,”ReplaceString”)&lt;br /&gt;
&lt;br /&gt;
To ReplaceAll you have to do it a little differently. To replace all occurrences in the string, use the g modifier like this:&lt;br /&gt;
str = str.replace(/Pattern/g,”ReplaceString”)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-2031156691506969274?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/3aBJM6vd0M8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/2031156691506969274/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=2031156691506969274" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/2031156691506969274?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/2031156691506969274?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/3aBJM6vd0M8/javascript-string-replace-all-function.html" title="Javascript String Replace All Function" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/04/javascript-string-replace-all-function.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4AQ3wyfSp7ImA9WhZTEks.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-3647908115305520314</id><published>2011-03-16T15:02:00.000+05:30</published><updated>2011-03-16T15:02:22.295+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-16T15:02:22.295+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web User Control" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Web page" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="ActiveDirectory" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Browser" /><title>Active Directory Authentication Asp.net</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Very offen in web development, we come across a requirement where we need to use Active Directory Authentication in Asp.net; i .e. we need to use Active Directory to Authenticate user. The flow for the same can be assumed as following point. In this case we shall not have User table in Database unless required, we can verify the Authenticity of user with Active Directory.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;User logs in with Active Directoyl Login and Password.&lt;/li&gt;
&lt;li&gt;System&amp;nbsp;verifies Login and Password with Active Directory&lt;/li&gt;
&lt;li&gt;If we get Success we will proceed the login else will display error.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;
We shall use following C# class naming AuthenticateUser to implement ActiveDirectory Authentication in Asp.net&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public class AuthenticateUser
{
    public AuthenticateUser()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    private string _path;
    private string _filterAttribute;

    public AuthenticateUser(string path)
    {
        _path = path;
    }

    public bool IsAuthenticated(string domain, string username, string pwd)
    {
        string domainAndUsername = domain + @"\" + username;
        DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, pwd);

        try
        {
            //Bind to the native AdsObject to force authentication.
            object obj = entry.NativeObject;

            DirectorySearcher search = new DirectorySearcher(entry);

            search.Filter = "(SAMAccountName=" + username + ")";
            search.PropertiesToLoad.Add("cn");
            SearchResult result = search.FindOne();

            if (null == result)
            {
                return false;
            }

            //Update the new path to the user in the directory.
            _path = result.Path;
            _filterAttribute = (string)result.Properties["cn"][0];
        }
        catch (Exception ex)
        {
            throw new Exception("Error authenticating user. " + ex.Message);
        }

        return true;
    }


}
&lt;/pre&gt;&lt;br /&gt;
Remeber we have added "&lt;strong&gt;&lt;em&gt;&lt;u&gt;System.DirectoryServices&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;" name space.&lt;br /&gt;
&lt;br /&gt;
We can simply use following code to Authenticate user using ActiveDirectory in asp.net&lt;br /&gt;
&lt;div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;u&gt;&lt;em&gt;Note: In following code we use Authentication on Page Load event, you can implement this on Login Page.&lt;/em&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void Page_Load(object sender, EventArgs e)
    {
        AuthenticateUser cls = new AuthenticateUser("LDAP://YourActiveDirectoryPath"); //Set Active Directory Path
        bool flag = cls.IsAuthenticated("ZESTORMTPL", "UserLoginID", "Password");
        //Put your UserLoginID and Password
    }&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;div&gt;&lt;/div&gt;Active Directory Authentication Asp.net is as simple as copy pasting above code and use it as it is.&lt;br /&gt;
&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-3647908115305520314?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/bfsAvpJqJM4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/3647908115305520314/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=3647908115305520314" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/3647908115305520314?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/3647908115305520314?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/bfsAvpJqJM4/active-directory-authentication-aspnet.html" title="Active Directory Authentication Asp.net" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/03/active-directory-authentication-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8GR308fSp7ImA9Wx9UFEw.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-458692956047325178</id><published>2011-02-11T14:30:00.000+05:30</published><updated>2011-02-11T14:30:26.375+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-11T14:30:26.375+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Yahoo Finance" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Stock Market" /><category scheme="http://www.blogger.com/atom/ns#" term="WebRequest" /><title>Stock Market Ticker For Website - Getting Historical Data</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;To get Historical Data from Yahoo Finance, we can use certain parameters in Query String. Check out following query string for NASDAQ (i.e. Symbol "^IXIC");&lt;br /&gt;
&lt;blockquote&gt;http://ichart.finance.yahoo.com/table.csv?s=^IXIC&amp;amp;a=01&amp;amp;b=5&amp;amp;c=1971&amp;amp;d=01&amp;amp;e=8&amp;amp;f=2011&amp;amp;g=m&amp;amp;ignore=.csv&lt;/blockquote&gt;&amp;nbsp;If we analyze above link we can see some parameters varying from a to g. We can use these parameters to filter HISTORICAL data as per our requirement. Each of above parameter (i.e. from a to g) indicates following things&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;s - Ticker symbol.(&lt;u&gt;This parameter is not optional; other parameters are optional&lt;/u&gt;) &lt;/li&gt;
&lt;li&gt;a - Month number, starting with 0 for January.&lt;/li&gt;
&lt;li&gt;b - Day number, eg, 1 for the first of the month.&lt;/li&gt;
&lt;li&gt;c - Year.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;End date for historical prices (default is the most current available closing price):&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;d - Month number, starting with 0 for January.&lt;/li&gt;
&lt;li&gt;e - Day number, eg, 1 for the first of the month.&lt;/li&gt;
&lt;li&gt;f - Year. &lt;/li&gt;
&lt;li&gt;g - Possible values are 'd' for daily (the default), 'w' for weekly, and 'm' for monthly.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;
We can download csv file and modify its URL run time as per our requirements. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-458692956047325178?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/JnulIiMzp3Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/458692956047325178/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=458692956047325178" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/458692956047325178?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/458692956047325178?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/JnulIiMzp3Y/stock-market-ticker-for-website-getting.html" title="Stock Market Ticker For Website - Getting Historical Data" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/02/stock-market-ticker-for-website-getting.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YERX0_eip7ImA9Wx9VFU4.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-5705002126419167434</id><published>2011-02-01T10:08:00.000+05:30</published><updated>2011-02-01T10:08:24.342+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-01T10:08:24.342+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Yahoo Finance" /><category scheme="http://www.blogger.com/atom/ns#" term="Web User Control" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Stock Market" /><category scheme="http://www.blogger.com/atom/ns#" term="WebRequest" /><title>Stock Market Ticker For Website - Yahoo Finance API</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;In My Previous article &lt;a href="http://aspdotnetmatters.blogspot.com/2011/01/stock-market-ticker-for-website.html"&gt;Stock Market Ticker For Website&lt;/a&gt;; we have seen how to USE YAHOO FINANCE URL, i.e. remote CSV file available for Download to use in Stock Market Ticker.&lt;br /&gt;
&lt;br /&gt;
Suppose we want to download and CSV file with Market Indices&lt;br /&gt;
But to display various details related to stock market YAHOO Finance has allowed us to take advantage of live data. Do check out my article about &lt;a href="http://aspdotnetmatters.blogspot.com/2011/01/stock-market-ticker-for-website.html"&gt;Stock Market Ticker For Website&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In previous article we use following link to get market data&lt;br /&gt;
&lt;blockquote&gt;http://download.finance.yahoo.com/d/quotes.csv?s=^DJI,^IXIC,^GSPC,^FTSE,^GDAXI,^FCHI,^N225,^HSI,^STI,^BSESN,^NSEI&amp;amp;f=sl1c1&amp;amp;e=.csv&lt;/blockquote&gt;&lt;/div&gt;Check out "&lt;i&gt;&lt;u&gt;&lt;b&gt;f=sl1c1&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;" this is where we need to apply following code for getting desired details. e.g. if we want to get "day-low,day-high, 52-week low &amp;amp; 52-week high" along with symbol(s), last trade(price)(l1) and change(c1) from YAHOO FINANCE, our "&lt;i&gt;&lt;u&gt;&lt;b&gt;f=sl1c1&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;" will change to &lt;i&gt;"&lt;u&gt;&lt;b&gt;f=sl1c1ghjk"&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;. This is very simple, use following table for getting desired data about Stock exchanges or for equities.&lt;u&gt; Yes we can also get Cross Currency rates from YAHOO FINANCE (e.g. Symbol "USDINR=X,USDEUR=X")&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table border="1"&gt;&lt;tbody&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;a &lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Ask &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;a2&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Average Daily Volume &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;a5&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Ask Size &lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;b &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Bid &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;b2&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Ask (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;b3&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Bid (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;b4&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Book Value &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;b6&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Bid Size &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;c &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Change &amp;amp; Percent Change &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;c1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Change &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;c3&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Commission &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;c6&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Change (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;c8&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; After Hours Change (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;d &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Dividend/Share &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;d1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Last Trade Date &lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;d2&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Trade Date &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;e &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Earnings/Share &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;e1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Error Indication (returned for symbol changed / invalid) &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;e7&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; EPS Estimate Current Year &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;e8&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; EPS Estimate Next Year &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;e9&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; EPS Estimate Next Quarter &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;f6&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Float Shares &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;g &lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Day’s Low &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;h &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Day’s High &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;j &lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; 52-week Low &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;k &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; 52-week High &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;g1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Holdings Gain Percent &lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;g3&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Annualized Gain &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;g4&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Holdings Gain &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;g5&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Holdings Gain Percent (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;g6&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Holdings Gain (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;i &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; More Info &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;i5&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Order Book (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;j1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Market Capitalization &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;j3&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Market Cap (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;j4&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; EBITDA &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;j5&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Change From 52-week Low &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;j6&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Percent Change From 52-week Low &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;k1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Last Trade (Real-time) With Time &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;k2&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Change Percent (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;k3&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Last Trade Size &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;k4&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Change From 52-week High &lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;k5&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Percebt Change From 52-week High &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;l &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Last Trade (With Time) &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;l1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Last Trade (Price Only) &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;l2&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; High Limit &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;l3&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Low Limit &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;m &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Day’s Range &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;m2&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Day’s Range (Real-time) &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;m3&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; 50-day Moving Average &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;m4&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; 200-day Moving Average &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;m5&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Change From 200-day Moving Average &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;m6&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Percent Change From 200-day Moving Average &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;m7&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Change From 50-day Moving Average &lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;m8&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Percent Change From 50-day Moving Average &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;n &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Name &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;n4&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Notes &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;o &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Open &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;p &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Previous Close &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;p1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Price Paid &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;p2&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Change in Percent &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;p5&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Price/Sales &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;p6&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Price/Book &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;q &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Ex-Dividend Date &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;r &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; P/E Ratio &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;r1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Dividend Pay Date &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;r2&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; P/E Ratio (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;r5&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; PEG Ratio &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;r6&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Price/EPS Estimate Current Year &lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;r7&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Price/EPS Estimate Next Year &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;s &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Symbol &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;s1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Shares Owned &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;s7&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Short Ratio &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;t1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Last Trade Time &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;t6&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Trade Links &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;t7&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Ticker Trend &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;t8&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; 1 yr Target Price &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;v &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Volume &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;v1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Holdings Value &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;v7&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Holdings Value (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;w &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; 52-week Range &lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;w1&lt;/b&gt; &lt;/span&gt;&lt;/td&gt;  &lt;td&gt;&lt;span style="font-family: times;"&gt; Day’s Value Change &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;w4&lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Day’s Value Change (Real-time) &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;x &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Stock Exchange &lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;b&gt;y &lt;/b&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; Dividend Yield &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: courier;"&gt; &lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-family: times;"&gt; &lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt; &lt;/table&gt;&lt;/div&gt;&lt;br /&gt;
Download Demo code here --&amp;gt; &lt;a href="http://www.easy-share.com/1913609695/MarketWatch.zip"&gt;Stock Market Ticker for Websites(MarketWatch.zip)&lt;/a&gt;&lt;br /&gt;
Above&amp;nbsp; demo code is associated with my &lt;a href="http://aspdotnetmatters.blogspot.com/2011/01/stock-market-ticker-for-website.html"&gt;previous &lt;/a&gt;article.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-5705002126419167434?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/z3yxVM1tYnQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/5705002126419167434/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=5705002126419167434" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5705002126419167434?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5705002126419167434?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/z3yxVM1tYnQ/stock-market-ticker-for-website-yahoo.html" title="Stock Market Ticker For Website - Yahoo Finance API" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/02/stock-market-ticker-for-website-yahoo.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkEDR3gycSp7ImA9Wx9WFE4.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-609775732944849887</id><published>2011-01-19T17:34:00.000+05:30</published><updated>2011-01-19T17:34:36.699+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-19T17:34:36.699+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Yahoo Finance" /><category scheme="http://www.blogger.com/atom/ns#" term="ICallback" /><category scheme="http://www.blogger.com/atom/ns#" term="Web User Control" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Callback" /><category scheme="http://www.blogger.com/atom/ns#" term="Stock Market" /><category scheme="http://www.blogger.com/atom/ns#" term="WebRequest" /><title>Stock Market Ticker For Website</title><content type="html">&lt;div style="text-align: justify;"&gt;In this article we shall work out on Live &lt;a href="http://www.easy-share.com/1913609695/MarketWatch.zip"&gt;stock market ticker for website&lt;/a&gt;. To develop live stock market ticker for website the basic requirement is to have live data. Free live data is available at some cost, but to display tickers on website we can always go for two to three minutes delayed data, which we can download from &lt;a href="http://finance.yahoo.com/"&gt;Yahoo Finance&lt;/a&gt;. &lt;a href="http://finance.yahoo.com/"&gt;Yahoo Finance&lt;/a&gt; is giving enable use to download CSV file in the manner we want. Once we get the CSV file logic which remains is to display data and Polling of data at certain interval&lt;/div&gt;&lt;br /&gt;
Check out folder structure of our &lt;a href="http://www.easy-share.com/1913609695/MarketWatch.zip"&gt;Demo Code&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QxZLuRPbgeM/TTbH5bIXqDI/AAAAAAAAAu8/-WKbkNA8U5Y/s1600/FolderStructure.bmp" imageanchor="1"&gt;&lt;img border="0" height="375" src="http://1.bp.blogspot.com/_QxZLuRPbgeM/TTbH5bIXqDI/AAAAAAAAAu8/-WKbkNA8U5Y/s1600/FolderStructure.bmp" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;(&lt;b&gt;Note:&lt;/b&gt; &lt;u&gt;&lt;i&gt;Demo contains Cross Currency Data as well; which will be same as Stock market data.&lt;/i&gt;&lt;/u&gt;)&lt;br /&gt;
&lt;br /&gt;
In this article we shall be considering major stock exchanges, and in &lt;a href="http://www.easy-share.com/1913609695/MarketWatch.zip"&gt;demo&lt;/a&gt; code we shall see updates related to stock exchanges.&lt;br /&gt;
&lt;blockquote&gt;&lt;ul&gt;&lt;li&gt;DOW (Symbol: ^DJI)&lt;/li&gt;
&lt;li&gt;Nasdaq (Symbol: ^IXIC)&lt;/li&gt;
&lt;li&gt;S&amp;amp;P 500 (Symbol: ^GSPC)&lt;/li&gt;
&lt;li&gt;FTSE 100 (Symbol: ^FTSE)&lt;/li&gt;
&lt;li&gt;DAX (Symbol: ^GDAXI)&lt;/li&gt;
&lt;li&gt;CAC 40 (Symbol: ^FCHI)&lt;/li&gt;
&lt;li&gt;Hang Seng (Symbol: ^HSI)&lt;/li&gt;
&lt;li&gt;NIKKEI 225 (Symbol: ^N225)&lt;/li&gt;
&lt;li&gt;Straits Times (Symbol: ^STI)&lt;/li&gt;
&lt;li&gt;BSE India (Symbol: ^BSESN)&lt;/li&gt;
&lt;li&gt;NSE India (Symbol: ^NSEI)&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;If you go to &lt;a href="http://finance.yahoo.com/"&gt;Yahoo Finance&lt;/a&gt; and put any of the Symbol you can check all related data. Also that data is allowed to download, we are going to use this downloaded data to display live (little delayed) data to develop Stock Market Ticker for Website. (Note: If you are not aware about ICALLBack Event handler, please refer this article ---&amp;gt; &lt;a href="http://aspdotnetmatters.blogspot.com/2010/08/icallback-event-handler.html"&gt;ICallback Event Handler Article&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;We are going to get data from &lt;a href="http://finance.yahoo.com/"&gt;Yahoo Finance&lt;/a&gt; in CSV format. So we shall write logic accordingly. Following is the function to convert CSV in to Data Table.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public static DataTable csvToDataTable(string strData, bool isRowOneHeader)
    {
        DataTable csvDataTable = new DataTable();
        //no try/catch - add these in yourselfs or let exception happen
        String[] csvData = strData.Replace("\r", "").Replace("=X", "").Split('\n');
        //if no data in file ‘manually’ throw an exception
        if (csvData.Length == 0)
        {
            throw new Exception("CSV File Appears to be Empty");
        }

        String[] headings = csvData[0].Split(',');
        int index = 0; //will be zero or one depending on isRowOneHeader
        if (isRowOneHeader) //if first record lists headers
        {
            index = 1; //so we won’t take headings as data
            //for each heading
            for (int i = 0; i &amp;lt; headings.Length; i++)
            {
                //replace spaces with underscores for column names
                headings[i] = headings[i].Replace("", "_");
                //add a column for each heading
                csvDataTable.Columns.Add(headings[i], typeof(string));
            }
        }
        else //if no headers just go for col1, col2 etc.
        {
            for (int i = 0; i &amp;lt; headings.Length; i++)
            {
                //create arbitary column names
                csvDataTable.Columns.Add("col" + (i + 1).ToString(), typeof(string));
            }
        }
        //populate the DataTable
        for (int i = index; i &amp;lt; csvData.Length - 1; i++)
        {
            //create new rows
            DataRow row = csvDataTable.NewRow();
            for (int j = 0; j &amp;lt; headings.Length; j++)
            {
                //fill them
                row[j] = csvData[i].Split(',')[j];
            }
            //add rows to over DataTable
            csvDataTable.Rows.Add(row);
        }

        //return the CSV DataTable
        return csvDataTable;
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;Another Important Function for our development of Stock Market Ticker for website is, the function which will call &lt;a href="http://finance.yahoo.com/"&gt;Yahoo Finance&lt;/a&gt; to fetch desired data.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;We shall user WebRequest Class to call remove CSV file i.e. Read a downloadable CSV file from remote server. Check out following function.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;&amp;nbsp;public DataTable CallYahooFinance()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebRequest req = WebRequest.Create(StaticVariables.Markets);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebResponse result = req.GetResponse();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Stream ReceiveStream = result.GetResponseStream();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StreamReader sr = new StreamReader(ReceiveStream, encode);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string output = string.Empty;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Char[] read = new Char[256];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int count = sr.Read(read, 0, read.Length);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (count &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String str = new String(read, 0, count);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output += str;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = sr.Read(read, 0, read.Length);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output = output.Replace("^DJI", "DOW").Replace("^IXIC", "NASDAQ").Replace("^GSPC", "S&amp;amp;P500");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output = output.Replace("^FTSE", "FTSE 100").Replace("^GDAXI", "DAX").Replace("^FCHI", "CAC 40");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output = output.Replace("^HSI", "HANG SENG").Replace("^N225", "NIKKEI 225").Replace("^STI", "STRAITS TIMES");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output = output.Replace("^BSESN", "SENSEX").Replace("^NSEI", "NIFTY");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataTable DT = csvToDataTable(output, false);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DT.Columns[0].ColumnName = "Market";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DT.Columns[1].ColumnName = "Last Trade";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DT.Columns[2].ColumnName = "Change (in %)";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return DT;
&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&lt;/pre&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;In above code "&lt;b&gt;&lt;i&gt;output&lt;/i&gt;&lt;/b&gt;" is the string i.e. CSV string and we have replaced &lt;a href="http://finance.yahoo.com/"&gt;Yahoo Finance&lt;/a&gt; Symbols with the Name of the Stock Index.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;If you check above function &lt;b&gt;&lt;i&gt;Webrequest.Create&lt;/i&gt;&lt;/b&gt; Method contains URL. To get CSV File we are using following URL, if you simple copy paste the URL you can download CSV file. URL for Stock Market Ticker is set into Static variable.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public static class StaticVariables
{
public static string Markets = "http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI,%5EIXIC,%5EGSPC,%5EFTSE,%5EGDAXI,%5EFCHI,%5EN225,%5EHSI,%5ESTI,%5EBSESN,%5ENSEI&amp;amp;f=sl1c1&amp;amp;e=.csv";
}
&lt;/pre&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;Thats it now we got the relevant data from &lt;a href="http://finance.yahoo.com/"&gt;yahoo finance&lt;/a&gt; which we can display the way we want. We are using ICallback Event handler to poll data from Yahoo Server. Now if you are aware about ICallback Simply check out following functions. Where we are not doing anything special.&lt;/div&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            String cbReference =
                Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "context");
            String callbackScript;
            callbackScript = "function CallServer(arg, context)" +
                "{ " + cbReference + ";}";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true);
        }
    }
&lt;/pre&gt;&lt;br /&gt;
Also check Region for ICallback Implementation&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public void RaiseCallbackEvent(String eventArgument)
    {
    
    }
    public String GetCallbackResult()
    {
        GridView GridView1 = new GridView();
        GridView1.DataSource = CallYahooFinance();
        GridView1.DataBind();

        return getHTML(GridView1);
    }


public string getHTML(GridView _grid)
    {
        string result = string.Empty;
        using (StringWriter sw = new StringWriter())
        {
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            _grid.RenderControl(htw);
            htw.Flush();
             result = sw.ToString();
        }
        return result;
    }
//getHTML returns HTMLString for GRIDView
&lt;/pre&gt;&lt;br /&gt;
Now in the HTML of our page we have only following tags.&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;&lt;div id="result"&gt;&lt;/div&gt;&lt;div id="_polling" style="background-color: #66ffff; color: #000066; display: none; width: 192px;"&gt;Polling from server...
        &lt;/div&gt;&lt;/pre&gt;&lt;br /&gt;
We use following JavaScript to Fetch live data from server side at the interval of 1000mili second.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;function call()
    {
    window.document.getElementById('_polling').style.display="";
    CallServer("", "");
    }
    
     function ReceiveServerData(retValue)
    {   
        document.getElementById("result").innerHTML = retValue;
        window.document.getElementById('_polling').style.display="none";
        setTimeout("call()",1000); //Set polling to 1000mili second
    }
&lt;/pre&gt;&lt;br /&gt;
Implementation of above code is very simple check out &lt;a href="http://www.easy-share.com/1913609695/MarketWatch.zip"&gt;Demo code&lt;/a&gt; for the same.&lt;br /&gt;
Download Demo Code here --&amp;gt; &lt;a href="http://www.easy-share.com/1913609695/MarketWatch.zip"&gt;Stock Market Ticker For Website.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-609775732944849887?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/wESNKB3VvTc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/609775732944849887/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=609775732944849887" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/609775732944849887?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/609775732944849887?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/wESNKB3VvTc/stock-market-ticker-for-website.html" title="Stock Market Ticker For Website" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_QxZLuRPbgeM/TTbH5bIXqDI/AAAAAAAAAu8/-WKbkNA8U5Y/s72-c/FolderStructure.bmp" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/01/stock-market-ticker-for-website.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cGQXY4cSp7ImA9Wx9WEE0.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-5127270211328117017</id><published>2011-01-14T16:00:00.000+05:30</published><updated>2011-01-14T16:00:20.839+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-14T16:00:20.839+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Browser" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML" /><category scheme="http://www.blogger.com/atom/ns#" term="Java Script" /><title>Display Loading Image in Asp.net</title><content type="html">To display loading image we shall use following JavaScript. There are many ways to display loading, but I feel this is the simple to use and implement. We just need one div tag with position set to absolute, and put loading image inside the div tag. Check out following code. &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;&lt;div id="loading" style="background-color: #66ffff; color: #000066; left: 1005px; position: absolute; top: 19px; vertical-align: top; width: 192px;"&gt;Loading...
&lt;/div&gt;&lt;/pre&gt;&lt;br /&gt;
(&lt;u&gt;&lt;b&gt;Make sure you set z-index if required.&lt;/b&gt;&lt;/u&gt;)&lt;br /&gt;
In above I have just used text "Loading...", instead of this you can put loading images.Put this div tag as first element of FORM tag. And after above div tag immediately put following JavaScript&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="html" cols="60" name="code" rows="25"&gt;&lt;script&gt;
    var ld = (document.all);

    var ns4 = document.layers;
    var ns6 = document.getElementById &amp;&amp; !document.all;
    var ie4 = document.all;

    if (ns4)
        ld = document.loading;
    else if (ns6)
        ld = document.getElementById("loading").style;
    else if (ie4)
        ld = document.all.loading.style;

    function init() {
        if (ns4) { ld.visibility = "hidden"; }
        else if (ns6 || ie4) ld.display = "none";
    }
&lt;/script&gt;
&lt;/pre&gt;&lt;br /&gt;
And call function "init()", on "onload" event of body tag.&lt;br /&gt;
&lt;br /&gt;
Done, now as your page loads you can see "Loading..."...&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-5127270211328117017?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/Eg01MDsJCvA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/5127270211328117017/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=5127270211328117017" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5127270211328117017?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5127270211328117017?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/Eg01MDsJCvA/display-loading-image-in-aspnet.html" title="Display Loading Image in Asp.net" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/01/display-loading-image-in-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0IDRH86eCp7ImA9Wx9XF0g.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-6941596989146539763</id><published>2011-01-11T18:42:00.000+05:30</published><updated>2011-01-11T18:42:55.110+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-11T18:42:55.110+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web page" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Client-server" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="WebRequest" /><title>Asp.Net Reading File From Url</title><content type="html">In this article is about Reading file from URL specially Text of CSV files, which we can directly read for the source and convert them into table. By doing this we generally avoid file handling, saving the file and then reading it again. WebRequest class of System.Net library is used to read remotely hosted text file or csv file.&lt;br /&gt;
&lt;br /&gt;
We simply need to use following function which will read remote file and put it in a string format. String is named as output string.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;WebRequest req = WebRequest.Create(YOURURL);
        WebResponse result = req.GetResponse();
        Stream ReceiveStream = result.GetResponseStream();
        Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
        StreamReader sr = new StreamReader(ReceiveStream, encode);
        string output = string.Empty;
        Char[] read = new Char[256];
        int count = sr.Read(read, 0, read.Length);
        while (count &amp;gt; 0)
        {
            String str = new String(read, 0, count);
            output += str;
            count = sr.Read(read, 0, read.Length);
        }
&lt;/pre&gt;&lt;br /&gt;
We are following simple steps in Asp.net for Reading file from URL.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Identify the URL and create WebRequest Object &lt;/li&gt;
&lt;li&gt;Get the Response Stream&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Encoding it in Appropriate Unicode format&lt;/li&gt;
&lt;li&gt;Reading the Data Stream.&lt;/li&gt;
&lt;li&gt;Finally getting the whole text string in one string variable i.e. "output" in this case.&lt;/li&gt;
&lt;/ol&gt;It is very easy to in Asp.net to Read file from Url, as we have seen in above code. We can write our logic to manipulate the string.&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-6941596989146539763?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/JYb4lz7hcLM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/6941596989146539763/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=6941596989146539763" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/6941596989146539763?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/6941596989146539763?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/JYb4lz7hcLM/aspnet-reading-file-from-url.html" title="Asp.Net Reading File From Url" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2011/01/aspnet-reading-file-from-url.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcNRHY5fSp7ImA9Wx9RGE8.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-688597225731532939</id><published>2010-12-20T12:08:00.000+05:30</published><updated>2010-12-20T12:08:15.825+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-20T12:08:15.825+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Excel Operations" /><category scheme="http://www.blogger.com/atom/ns#" term="Web page" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><title>Get Excel Sheet Names In Asp.net</title><content type="html">In Previous article named &lt;a href="http://aspdotnetmatters.blogspot.com/2010/12/reading-excel-file-in-aspnet.html"&gt;Reading Excel File in Asp.net &lt;/a&gt;, we discussed about Uploading excel file with One sheet, where we assumed that we know the name of the sheet i.e. Reading from "Sheet1" of uploaded excel file.(&lt;a href="http://www.easy-share.com/1913339572/GetExcelSheetNamesInAsp.zip"&gt;Demo Code&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
In this article we will discuss to read data from excel file where are not sure about the number of Sheets present in Excel file and name of those excel sheet. This is very common requirement for developers who are playing with Excel Data. We will keep logic of Uploading file similar to previous &lt;a href="http://aspdotnetmatters.blogspot.com/2010/12/reading-excel-file-in-aspnet.html"&gt;article&lt;/a&gt;. In this article we assume that we have uploaded the file and saved it at predefined location. Now we will only consider reading from excel file which contains number of excel sheets with names not known to us.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just check out following &lt;a href="http://www.easy-share.com/1913339572/GetExcelSheetNamesInAsp.zip"&gt;code&lt;/a&gt;, where we consume excel file and read all Sheet names as Table names in one Data Table, and then display all Excel sheets one by one.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public DataSet GetExcelData(string ExcelFilePath)
    {
        string OledbConnectionString = string.Empty;
        OleDbConnection objConn = null;
        OledbConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + ExcelFilePath + ";Extended Properties=Excel 8.0;";
        objConn = new OleDbConnection(OledbConnectionString);

        if (objConn.State == ConnectionState.Closed)
        {
            objConn.Open();
        }
        DataSet objDataset = new DataSet();

        DataTable dtName = objConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
        
        for (int _rowCount = 0; _rowCount &amp;lt; dtName.Rows.Count; _rowCount++)
        {
            Response.Write(dtName.Rows[_rowCount]["TABLE_NAME"].ToString() + "
");

            OleDbCommand objCmdSelect = new OleDbCommand("Select * from [" + dtName.Rows[_rowCount]["TABLE_NAME"].ToString() + "]", objConn);
            OleDbDataAdapter objAdapter = new OleDbDataAdapter();
            objAdapter.SelectCommand = objCmdSelect;
            objAdapter.Fill(objDataset, dtName.Rows[_rowCount]["TABLE_NAME"].ToString());
            objAdapter.Dispose();
            objCmdSelect.Dispose();
        }

        objConn.Close();
        return objDataset;

    }
&lt;/pre&gt;&lt;br /&gt;
We are simply reading all excel sheets present in the Excel file and adding them in Data Set. &lt;br /&gt;
Check out Demo code for the reference. Getting Excel sheet Names in Asp.net is an easy task. We can simply bind this data to grids and display it or push this data directly to database. &lt;br /&gt;
&lt;br /&gt;
We need to note one thing, that sheet names in Excel are read as "SheetName + $", where "$" does not belong to sheet name. &lt;br /&gt;
&lt;br /&gt;
If we need to do operations related to Range of Excel sheet Cells, refer my &lt;a href="http://aspdotnetmatters.blogspot.com/2010/12/reading-excel-file-in-aspnet.html"&gt;previous article&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Download Demo Code here --&amp;gt; &lt;a href="http://www.easy-share.com/1913339572/GetExcelSheetNamesInAsp.zip"&gt;GetExcelSheetNamesInAsp.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-688597225731532939?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/ouimzGMZHlg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/688597225731532939/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=688597225731532939" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/688597225731532939?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/688597225731532939?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/ouimzGMZHlg/get-excel-sheet-names-in-aspnet.html" title="Get Excel Sheet Names In Asp.net" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2010/12/get-excel-sheet-names-in-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QHSXs6cCp7ImA9Wx9SF0Q.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-2861904442288352411</id><published>2010-12-08T12:25:00.000+05:30</published><updated>2010-12-08T12:25:38.518+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-08T12:25:38.518+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Excel Operations" /><category scheme="http://www.blogger.com/atom/ns#" term="Grid View" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Ado.net" /><title>Reading Excel File in Asp.net</title><content type="html">&lt;div style="text-align: justify;"&gt;One of the very common requirement in asp.net is end user uploaded Excel file and in Code behind, we need to Read the uploaded Excel file and Make sense out of data, i.e. Reading Excel File in Asp.net (&lt;a href="http://www.easy-share.com/1913225393/ReadExcelFileinAspDotNet.zip"&gt;Demo Code&lt;/a&gt;).&amp;nbsp; &lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;Reading Excel File in Asp.net is Very simple task, but if there are standard operations need to be done, then we have to specify the Excel format and ask end user to upload file in certain format only.&lt;/div&gt;&lt;br /&gt;
Below we will discuss how to read and Excel File. (&lt;a href="http://www.easy-share.com/1913225393/ReadExcelFileinAspDotNet.zip"&gt;Demo Code&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
Before we go ahead check out folder structure of Read Excel File in Asp.net&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QxZLuRPbgeM/TP8kGupqsvI/AAAAAAAAAVw/3i67IEHLePc/s1600/FolderStucture.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="235" src="http://1.bp.blogspot.com/_QxZLuRPbgeM/TP8kGupqsvI/AAAAAAAAAVw/3i67IEHLePc/s400/FolderStucture.bmp" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;Also after we upload excel file it gets bind to a grid view, all these operations are done in Default.aspx&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_QxZLuRPbgeM/TP8kao6xpoI/AAAAAAAAAV0/uqSvbcyfVTY/s1600/PageStructure.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="281" src="http://2.bp.blogspot.com/_QxZLuRPbgeM/TP8kao6xpoI/AAAAAAAAAV0/uqSvbcyfVTY/s320/PageStructure.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Html of the Default.aspx page is as below&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="html" cols="60" name="code" rows="25"&gt;&lt;div&gt;&lt;table style="height: 70px; width: 404px;"&gt;&lt;tbody&gt;
&lt;tr&gt;         &lt;td class="style1"&gt;Select Date :&lt;/td&gt;         &lt;td class="style2"&gt;&lt;/td&gt;         &lt;/tr&gt;
&lt;tr&gt;         &lt;td class="style1"&gt;Upload Excel File :&lt;/td&gt;         &lt;td class="style2"&gt;&lt;br /&gt;
&lt;asp:fileupload id="FileUpload1" runat="server"&gt;&lt;/asp:fileupload&gt;&lt;/td&gt;         &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;asp:button id="btnUpload" onclick="btnUpload_Click" runat="server" text="Upload Excel File"&gt;
    &lt;/asp:button&gt;
&lt;asp:gridview id="ExcelGridView" runat="server"&gt;
    &lt;/asp:gridview&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;On Click of Upload Button we upload excel file and Save it in UploadedFiles folder. We then Read file from UploadedFiles folder. &lt;/div&gt;&lt;div style="text-align: justify;"&gt;C# code on Upload Button click is as below, code is very easy to understand, you can also download Demo Code for reference.&lt;/div&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void btnUpload_Click(object sender, EventArgs e)
    {
        
        if (FileUpload1.FileName.ToString() != "" &amp;amp;&amp;amp; FileUpload1.ToString().Contains("."))
        {
            String filepath = Server.MapPath("UploadedFiles");
            FileUpload1.SaveAs(filepath + "\\" + FileUpload1.FileName.Split('\\')[FileUpload1.FileName.Split('\\').Length - 1]);
            string excelPath = (filepath + "\\" + FileUpload1.FileName.Split('\\')[FileUpload1.FileName.Split('\\').Length - 1]);

            ExcelGridView.DataSource = GetExcelData(excelPath);
            ExcelGridView.DataBind();
        }
    }
&lt;/pre&gt;&lt;br /&gt;
In above code we pass Excel Path to "GetExcelData" function which returns DataTable which we in turn bind to GridView&lt;br /&gt;
GetExcelData function is as below&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public DataTable GetExcelData(string ExcelFilePath)
    {
        string OledbConnectionString = string.Empty;
        OleDbConnection objConn = null;
        OledbConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + ExcelFilePath + ";Extended Properties=Excel 8.0;";
        objConn = new OleDbConnection(OledbConnectionString);

        if (objConn.State == ConnectionState.Closed)
        {
            objConn.Open();
        }

        OleDbCommand objCmdSelect = new OleDbCommand("Select * from [Sheet1$]", objConn);
        OleDbDataAdapter objAdapter = new OleDbDataAdapter();
        objAdapter.SelectCommand = objCmdSelect;
        DataSet objDataset = new DataSet();
        objAdapter.Fill(objDataset, "ExcelDataTable");
        objConn.Close();
        return objDataset.Tables[0];

    }
&lt;/pre&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;In above Code check out OleDbCommand; we are just writing a select query which fetch data from Sheet1 of uploaded Excel, similarly if we can give Sheet Name instead of Sheet1. If your Excel Data starts from some other cell then change select query like "&lt;b&gt;Select * from [Sheet1$B7:F200]&lt;/b&gt;"; first row of this range will come as columns in Data Table&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Now we are done with Excel Upload and Reading the file, there are certain things which we needs to be take care before uploading Excel file which are as below&lt;/div&gt;&lt;ul&gt;&lt;li style="text-align: justify;"&gt;It certain column in Excel contains number do format that Column for number and make sure all the entries in that column are number, if some entries are in text format then, in Data Table we get those entries as blank entries (i.e. DataTable has empty cell for that respective excel cell.)&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;Define the Range of Operation if your data does not start from A1 cell.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;All cells in 1st row (i.e. First row of the range you specify) are considered as column name, and in C# Data Table they appear as exact.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;To Specify the Range modify select query as Select * from [Sheet2$B7:F200] ; you can use your own sheet name instead of Sheet1 or Sheet2&lt;/li&gt;
&lt;/ul&gt;Download Ready to Use Demo Code -- &amp;gt; &lt;a href="http://www.easy-share.com/1913225393/ReadExcelFileinAspDotNet.zip"&gt;ReadExcelFileInAsp.Net.zip&lt;/a&gt; &lt;br /&gt;
&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-2861904442288352411?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/8F6DC-O7bLQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/2861904442288352411/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=2861904442288352411" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/2861904442288352411?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/2861904442288352411?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/8F6DC-O7bLQ/reading-excel-file-in-aspnet.html" title="Reading Excel File in Asp.net" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_QxZLuRPbgeM/TP8kGupqsvI/AAAAAAAAAVw/3i67IEHLePc/s72-c/FolderStucture.bmp" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2010/12/reading-excel-file-in-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkACRH85eyp7ImA9Wx9TFEw.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-2722800325130163689</id><published>2010-11-22T12:44:00.000+05:30</published><updated>2010-11-22T12:56:05.123+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-22T12:56:05.123+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web page" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.net 3.5" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="Google API" /><category scheme="http://www.blogger.com/atom/ns#" term="Charts" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML" /><title>Google Charts API for ASP.NET</title><content type="html">Google Visualization has provided a powerful set of JavaScripts which  allows us to develop various graphs and charts. I think if we are  developing something like dashboard or something like Google Analytic  dashboard, then using Google Visualizations is amazing idea. In case of  Asp.net we can simply develop a logic to use DataTables as input and  Graph will be generated automatically. Again we can capture the click  events for the graph and display alerts or run some JavaScript as per  our logic (&lt;a href="http://www.easy-share.com/1913049162/GoogleVisualizationDemo.zip"&gt;DemoCode&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
In this article we will simply check out different graphs and its integration with asp.net. Check out following Screen shots.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QxZLuRPbgeM/TOlngMixU9I/AAAAAAAAAVA/rP1PUnx3Kro/s1600/areachart.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="179" src="http://1.bp.blogspot.com/_QxZLuRPbgeM/TOlngMixU9I/AAAAAAAAAVA/rP1PUnx3Kro/s320/areachart.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_QxZLuRPbgeM/TOlnlkzlVsI/AAAAAAAAAVE/2hQvh5PmbdQ/s1600/barchart.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="194" src="http://3.bp.blogspot.com/_QxZLuRPbgeM/TOlnlkzlVsI/AAAAAAAAAVE/2hQvh5PmbdQ/s320/barchart.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_QxZLuRPbgeM/TOlnp8nbRYI/AAAAAAAAAVI/LxD9xY53Ok8/s1600/columnchart.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://2.bp.blogspot.com/_QxZLuRPbgeM/TOlnp8nbRYI/AAAAAAAAAVI/LxD9xY53Ok8/s320/columnchart.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_QxZLuRPbgeM/TOlnu_rqrGI/AAAAAAAAAVM/_Ts-7CbQDOI/s1600/linechart.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="185" src="http://2.bp.blogspot.com/_QxZLuRPbgeM/TOlnu_rqrGI/AAAAAAAAAVM/_Ts-7CbQDOI/s320/linechart.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Google Charts API can be implemented effectively in Asp.net, this is just a small part of actual assignment I did for the development of a dashboard.&lt;br /&gt;
Step 1: Understanding Table structure of Google API.Google Charts API accepts table as input and generate graphs accordingly. It takes Table in Following format. (for more information check out&amp;nbsp; &lt;a href="http://code.google.com/apis/visualization/documentation/reference.html"&gt;Google References&lt;/a&gt; )&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QxZLuRPbgeM/TOkIelSBY7I/AAAAAAAAAU8/1n_v1--Cp3M/s1600/GoogleTable.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="236" src="http://1.bp.blogspot.com/_QxZLuRPbgeM/TOkIelSBY7I/AAAAAAAAAU8/1n_v1--Cp3M/s400/GoogleTable.bmp" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
We should be careful while generating Table in HTML, i.e. while adding Rows and Columns in Google DataTable. Google Data Table creation looks as follows&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;var data = new google.visualization.DataTable();
        data.addColumn('string', 'Name');
        data.addColumn('number', 'Salary');
        data.addRows(4);
&lt;/pre&gt;There are many things we can do with Google Table which I am not including in this article.&lt;br /&gt;
&lt;br /&gt;
Check out following JavaScript code for creating Google Table and Adding data in it &lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;var data = new google.visualization.DataTable();
   function setDataforGraph()
        {
         // Create and populate the data table.
       var raw_data =  [['INFOSYS', 3077.15, 3081.65, 3015.9, 3059.80, 3082.65, 3054.65, 2997.85, 3030.05, 2970.95, 3003.95]];
            var xAxis = ['05-Nov-10', '08-Nov-10', '09-Nov-10', '10-Nov-10', '11-Nov-10', '12-Nov-10', '15-Nov-10', '16-Nov-10', '18-Nov-10','19-Nov-10'];

            data.addColumn('string', 'Date');
            for (var i = 0; i &amp;lt; raw_data.length; ++i) {
                data.addColumn('number', raw_data[i][0]);
            }
            
            data.addRows(xAxis.length);
            for (var j = 0; j &amp;lt; xAxis.length; ++j) {
                data.setValue(j, 0, xAxis[j].toString());
            }
            for (var i = 0; i &amp;lt; raw_data.length; ++i) {
                for (var j = 1; j &amp;lt; raw_data[i].length; ++j) {
                    data.setValue(j - 1, i + 1, raw_data[i][j]);
                }
            }
          
        }
&lt;/pre&gt;&lt;br /&gt;
We also need to include JavaScript sources, there are some packages Google Provides, as we are going to use this for Charts we include coreCharts&lt;br /&gt;
Add script file&lt;b&gt; "http://www.google.com/jsapi"&lt;/b&gt;&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;&lt;script type="text/javascript"&gt;
        google.load('visualization', '1', { packages: ['corechart'] });
    
&lt;/script&gt;
&lt;/pre&gt;&lt;br /&gt;
Once we done with DataTable creation we go for the logic to display Charts. We need to call Google Function &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;function drawVisualization(Type) {

            // Create and draw the visualization.
            var targetDiv = document.getElementById('visualization');
            var chart;
            if(Type == "ColumnChart") chart = new google.visualization.ColumnChart(targetDiv);
            else if(Type == "PieChart") chart = new google.visualization.PieChart(targetDiv);
            else if (Type == "AreaChart") chart = new google.visualization.AreaChart(targetDiv);
            else if (Type == "BarChart") chart = new google.visualization.BarChart(targetDiv);
            else if(Type == "LineChart") chart = new google.visualization.LineChart(targetDiv);
            chart.draw(data);
            new google.visualization.events.addListener(chart, 'select', selectionHandler);

            function selectionHandler(e) {
                selection = chart.getSelection();
                for (var i = 0; i &amp;lt; selection.length; i++) {
                    var item = selection[i]; 
                    alert(data.getValue(item.row, 1));
                }
            }
        }
&lt;/pre&gt;&lt;br /&gt;
Above function can be called on any event. Which will generate Chart of Particular Type. Refer &lt;a href="http://www.easy-share.com/1913049162/GoogleVisualizationDemo.zip"&gt;Demo&lt;/a&gt; Code. We can add selectionHandler to capture events on click of chart. Above function will give us value of the Item i.e. Data. Check out following image.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QxZLuRPbgeM/TOoFLmQc-RI/AAAAAAAAAVQ/me8qFA6tCVE/s1600/chartwithalert.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="190" src="http://1.bp.blogspot.com/_QxZLuRPbgeM/TOoFLmQc-RI/AAAAAAAAAVQ/me8qFA6tCVE/s320/chartwithalert.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
HTML Structure of form is something like below, where we have Div tag for Google Visualization.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;&lt;div&gt;&lt;input onclick="javascript:drawVisualization('ColumnChart');" type="button" value="Draw ColumnChart" /&gt;
        &lt;input onclick="javascript:drawVisualization('AreaChart');" type="button" value="Draw AreaChart" /&gt;
        &lt;input onclick="javascript:drawVisualization('BarChart');" type="button" value="Draw BarChart" /&gt;
        &lt;input onclick="javascript:drawVisualization('LineChart');" type="button" value="Draw LineChart" /&gt;
        




&lt;div id="visualization" style="height: 500px; width: 900px;"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;At this point we are done with the Google Charts API usage in HTML. Now to make Google Charts work in asp.net we simply need to develop a logic in code behind which will enable us to Create GoogleDataTable. &lt;br /&gt;
&lt;br /&gt;
To generate data in code behind we use string elements which we can simple get in JavaScript on page render.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;public string x_Axis = string.Empty;
    public string graphTable = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            graphTable = getGoogleVisualizationStr(DemoDataTable);
            x_Axis = "'05-Nov-10', '08-Nov-10', '09-Nov-10', '10-Nov-10', '11-Nov-10', '12-Nov-10', '15-Nov-10', '16-Nov-10', '18-Nov-10','19-Nov-10'";
        }
    }
&lt;/pre&gt;&lt;br /&gt;
We keep &lt;a href="http://www.easy-share.com/1913049162/GoogleVisualizationDemo.zip"&gt;Demo&lt;/a&gt; Table in c# code, with same data values used in above table.&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;private DataTable DemoDataTable
    {
        get
        {
            DataTable DT = new DataTable();
            DT.TableName = "GENERAL";
            DT.Columns.Add(new DataColumn("Name", typeof(string)));
            DT.Columns.Add(new DataColumn("Data1", typeof(long)));
            DT.Columns.Add(new DataColumn("Data2", typeof(long)));
            DT.Columns.Add(new DataColumn("Data3", typeof(long)));
            DT.Columns.Add(new DataColumn("Data4", typeof(long)));
            DT.Columns.Add(new DataColumn("Data5", typeof(long)));
            DT.Columns.Add(new DataColumn("Data6", typeof(long)));
            DT.Columns.Add(new DataColumn("Data7", typeof(long)));
            DT.Columns.Add(new DataColumn("Data8", typeof(long)));
            DT.Columns.Add(new DataColumn("Data9", typeof(long)));
            DT.Columns.Add(new DataColumn("Data10", typeof(long)));
            DT.Rows.Add(new object[] { "INFOSYS", 3077.15, 3081.65, 3015.9, 3059.80, 3082.65, 3054.65, 2997.85, 3030.05, 2970.95, 3003.95 });
            return DT;
        }
    }
&lt;/pre&gt;&lt;br /&gt;
We write a simple code to generate rowData used in above lines of code. &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;private string getGoogleVisualizationStr(DataTable DT)
    {
        string googleVisualTable = string.Empty;
        googleVisualTable = "[";
        for (int i = 0; i &amp;lt; DT.Rows.Count; i++)
        {
            for (int j = 0; j &amp;lt; DT.Columns.Count; j++)
            {
                if (j == 0)
                {
                    googleVisualTable += "[ '" + DT.Rows[i][j] + "'";
                }
                else if (j == DT.Columns.Count - 1) googleVisualTable += "," + DT.Rows[i][j] + "]";
                else googleVisualTable += "," + DT.Rows[i][j];

            }
            if (i != DT.Rows.Count - 1) googleVisualTable += ",";
        }
        googleVisualTable += "]";
        return googleVisualTable;
    }
&lt;/pre&gt;We replace our JavaScript code with  &lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;var raw_data = &amp;lt;%= graphTable %&amp;gt;
var xAxis = [&amp;lt;%=x_Axis %&amp;gt;];
&lt;/pre&gt;&lt;br /&gt;
Thats it we are done with development of Google Charts API for ASP.NET. Above code used data of only one company to keep things simple. To add more companies simply add it in data table. So that our graphs will look like&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_QxZLuRPbgeM/TOoRM4UKRFI/AAAAAAAAAVU/51nI45z8OY8/s1600/multilinecharts.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="178" src="http://1.bp.blogspot.com/_QxZLuRPbgeM/TOoRM4UKRFI/AAAAAAAAAVU/51nI45z8OY8/s320/multilinecharts.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_QxZLuRPbgeM/TOoRQz_HT9I/AAAAAAAAAVY/NwisfTpx-uM/s1600/multiareachart.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="178" src="http://4.bp.blogspot.com/_QxZLuRPbgeM/TOoRQz_HT9I/AAAAAAAAAVY/NwisfTpx-uM/s320/multiareachart.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_QxZLuRPbgeM/TOoRWBG_efI/AAAAAAAAAVc/lrim4awdGZM/s1600/multibarchart.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="166" src="http://2.bp.blogspot.com/_QxZLuRPbgeM/TOoRWBG_efI/AAAAAAAAAVc/lrim4awdGZM/s320/multibarchart.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_QxZLuRPbgeM/TOoRZcMJOCI/AAAAAAAAAVg/PoJ0Hx2ze4E/s1600/multicolumnchart.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="181" src="http://3.bp.blogspot.com/_QxZLuRPbgeM/TOoRZcMJOCI/AAAAAAAAAVg/PoJ0Hx2ze4E/s320/multicolumnchart.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Download &lt;a href="http://www.easy-share.com/1913049162/GoogleVisualizationDemo.zip"&gt;Democode&lt;/a&gt; for reference --&amp;gt; &lt;a href="http://www.easy-share.com/1913049162/GoogleVisualizationDemo.zip"&gt;GoogleVisualizationDemo.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-2722800325130163689?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/mpiKQr39iHk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/2722800325130163689/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=2722800325130163689" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/2722800325130163689?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/2722800325130163689?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/mpiKQr39iHk/google-charts-api-for-aspnet.html" title="Google Charts API for ASP.NET" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_QxZLuRPbgeM/TOlngMixU9I/AAAAAAAAAVA/rP1PUnx3Kro/s72-c/areachart.bmp" height="72" width="72" /><thr:total>4</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2010/11/google-charts-api-for-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEEFSHkyeyp7ImA9Wx5aEUQ.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-2533481361718165670</id><published>2010-11-03T11:32:00.000+05:30</published><updated>2010-11-08T10:33:39.793+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-08T10:33:39.793+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web page" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Design and Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Image Handling" /><title>Generate captcha image in asp.net - simple way</title><content type="html">When it comes to captcha images simple question pops in i.e. how to generate captcha images? &lt;br /&gt;
This article is about generating Captcha image in asp.net, this is very simple logic which can be implemented immediately for any website. You can directly Download &lt;a href="http://www.easy-share.com/1912843853/CaptchaInAsp.zip"&gt;Demo&lt;/a&gt; and use it.&lt;br /&gt;
We have used following simple steps to Generate Captcha Image in asp.net &lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Create Captcha Image from random numbers and store that number in session variable, we have used Captcha.aspx page for the same.&lt;/li&gt;
&lt;li&gt;Use Captcha.aspx as source for the captcha image in Default.aspx page, i.e. for image tag give Captcha.aspx as SRC.&lt;/li&gt;
&lt;li&gt;On Submit click simply verify captcha entered by user and captcha in session.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;Our folder structure is very simple, check out following image &lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_QxZLuRPbgeM/TNDvV3W7eLI/AAAAAAAAAUg/z6M1NRk6oC4/s1600/FolderStructure.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="284" src="http://4.bp.blogspot.com/_QxZLuRPbgeM/TNDvV3W7eLI/AAAAAAAAAUg/z6M1NRk6oC4/s320/FolderStructure.bmp" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
To understand the way we have checked captcha, have look on HTML of Default.aspx page (Check out &lt;a href="http://www.easy-share.com/1912843853/CaptchaInAsp.zip"&gt;DemoCode&lt;/a&gt;, for better understanding.)&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;&lt;div&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;                 &lt;td&gt;&lt;br /&gt;
&lt;img alt="Catptcha Text" src="Captcha.aspx" /&gt;&lt;/td&gt;             &lt;/tr&gt;
&lt;tr&gt;                 &lt;td&gt;&lt;br /&gt;
&lt;asp:textbox id="txtCaptcha" runat="server"&gt;&lt;/asp:textbox&gt;&lt;/td&gt;             &lt;/tr&gt;
&lt;tr&gt;                 &lt;td&gt;&lt;br /&gt;
&lt;asp:button id="btnSubmit" onclick="btnSubmit_Click" runat="server" text="Submit"&gt;                  &lt;/asp:button&gt;&lt;/td&gt;             &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/pre&gt;&lt;br /&gt;
Check out the way we have used Captcha.aspx page in image source.&lt;br /&gt;
&lt;br /&gt;
On submit click we simply checks whether Captcha entered in "txtCaptcha" is valid or not, we have following code for submit button clicked.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Session["Captcha"] != null)
        {
            if (txtCaptcha.Text == Session["Captcha"].ToString())
            {
                Response.Redirect("RedirectPage.aspx");
            }
            else
            {
                Response.Write("Please Enter Valid Captcha code");
                txtCaptcha.Text = "";
            }
        }
        else
        {
            Response.Write("Session Expired, please re-enter Captcha.");
        }
    }
&lt;/pre&gt;&lt;br /&gt;
Now what remains is the logic for Generate captcha image, we don't have any HTML tags on captcha.aspx, we simply write following code for Binary Image Generation and write it. We have used Random number; but we can have our different logic for the same. &lt;br /&gt;
&lt;br /&gt;
&lt;pre class="c#" cols="60" name="code" rows="25"&gt;protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "text/plain";
        Random random = new Random(DateTime.Now.Millisecond);

        int number = random.Next(100000);

        Session.Add("Captcha",number.ToString());

        System.Drawing.Bitmap bmpOut = new Bitmap(100, 50);

        Graphics graphics = Graphics.FromImage(bmpOut);

        graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;

        graphics.FillRectangle(Brushes.Aquamarine, 0, 0, 100, 50);

        graphics.DrawString(number.ToString(), new Font("TimesNewRoman", 20), new SolidBrush(Color.Coral), 0, 0);

        MemoryStream memorystream = new MemoryStream();

        bmpOut.Save(memorystream, System.Drawing.Imaging.ImageFormat.Png);

        byte[] bmpBytes = memorystream.GetBuffer();

        bmpOut.Dispose();

        memorystream.Close();

        Response.BinaryWrite(bmpBytes);

        Response.End();

    }
&lt;/pre&gt;&lt;br /&gt;
Thats it we are done with our Generate captcha image in asp.net. Very simple code to use, download &lt;a href="http://www.easy-share.com/1912843853/CaptchaInAsp.zip"&gt;democode&lt;/a&gt; and use it directly in your web application.&lt;br /&gt;
&lt;br /&gt;
Download Democode here---&amp;gt; &lt;a href="http://www.easy-share.com/1912843853/CaptchaInAsp.zip"&gt;CaptchaInAsp.net.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-2533481361718165670?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/vb2ty6wKWOs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/2533481361718165670/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=2533481361718165670" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/2533481361718165670?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/2533481361718165670?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/vb2ty6wKWOs/generate-captcha-image-in-aspnet-simple.html" title="Generate captcha image in asp.net - simple way" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_QxZLuRPbgeM/TNDvV3W7eLI/AAAAAAAAAUg/z6M1NRk6oC4/s72-c/FolderStructure.bmp" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2010/11/generate-captcha-image-in-aspnet-simple.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUCRX4-cCp7ImA9Wx5bEkg.&quot;"><id>tag:blogger.com,1999:blog-4114598931624509864.post-5451140414417312605</id><published>2010-10-28T13:50:00.000+05:30</published><updated>2010-10-28T13:54:24.058+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-28T13:54:24.058+05:30</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Address bar" /><category scheme="http://www.blogger.com/atom/ns#" term="Web development" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Browser" /><category scheme="http://www.blogger.com/atom/ns#" term="HTML" /><category scheme="http://www.blogger.com/atom/ns#" term="Java Script" /><title>Display your logo on address bar</title><content type="html">Many times to make our site standout, we need to display our logo near address bar. There is very simple JavaScript which takes care of this. We need to put following code in tag HEAD tag.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_QxZLuRPbgeM/TMkzD79PSUI/AAAAAAAAAUc/bNWKFCzHce0/s1600/IconNearAddressBar.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_QxZLuRPbgeM/TMkzD79PSUI/AAAAAAAAAUc/bNWKFCzHce0/s1600/IconNearAddressBar.bmp" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For each page of the website we need to add above code. &lt;br /&gt;
demoico.ico is an icon file which we can use to display near address bar. &lt;br /&gt;
We can also manipulate Header Section Dynamically, and change the icon for different pages.&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;
ch_client = "ashishblogger";
ch_width = 550;
ch_height = 250;
ch_type = "mpu";
ch_sid = "Chitika Default";
ch_backfill = 1;
ch_color_site_link = "0000cc";
ch_color_title = "0000cc";
ch_color_border = "ffffff";
ch_color_text = "000000";
ch_color_bg = "ffffff";
&lt;/script&gt;
&lt;script src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4114598931624509864-5451140414417312605?l=aspdotnetmatters.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aspdotnetmatters/~4/ObLE7WOSmUM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://aspdotnetmatters.blogspot.com/feeds/5451140414417312605/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4114598931624509864&amp;postID=5451140414417312605" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5451140414417312605?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4114598931624509864/posts/default/5451140414417312605?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/aspdotnetmatters/~3/ObLE7WOSmUM/display-your-logo-on-address-bar.html" title="Display your logo on address bar" /><author><name>Ashish</name><uri>http://www.blogger.com/profile/14731610240152023396</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_QxZLuRPbgeM/TMkzD79PSUI/AAAAAAAAAUc/bNWKFCzHce0/s72-c/IconNearAddressBar.bmp" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://aspdotnetmatters.blogspot.com/2010/10/display-your-logo-on-address-bar.html</feedburner:origLink></entry></feed>

