<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.claritycon.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Satish Vemula</title><subtitle type="html" /><id>http://blogs.claritycon.com/blogs/satish_vemula/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.claritycon.com/blogs/satish_vemula/atom.aspx" /><generator uri="http://communityserver.org" version="3.1.20917.1142">Community Server</generator><updated>2006-02-14T14:27:00Z</updated><entry><title>Vista problems on MacBook Pro</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2007/06/30/3213.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2007/06/30/3213.aspx</id><published>2007-06-30T18:03:00Z</published><updated>2007-06-30T18:03:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial size=2&gt;Recently I installed Vista on MacBook Pro using the Bootcamp &lt;/FONT&gt;&lt;A href="http://www.apple.com/macosx/bootcamp/"&gt;&lt;FONT face=Arial size=2&gt;http://www.apple.com/macosx/bootcamp/&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Everything was working awesome and I love the Mac. Then I started running into "Vista" problems. Everytime I closed my laptop and left it unattended for a couple of hours and started up Vista from it's "Resuming Windows" mode, it would freeze up. I would have to do a hard start but even after that, after logging in, it would freeze again, causing me to do a hard-start again. Frustated with this, and having not found any solution, I suspected my Vista install could be the culprit (none of my colleagues were having this issue), and so tried to do an upgrade install of Windows Vista (popped in the Vista install CD and let it do it's job). After 6 agonizing hours of reinstalling Vista, I log into Windows and this is where my troubles begin:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I already had some software installed and since I opted for upgrade instead of clean install of Vista, it seemd to have corrupted some registry settings and it messed up the following applications:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Daemon Tools &lt;/FONT&gt;&lt;A href="http://www.daemon-tools.cc/dtcc/announcements.php"&gt;&lt;FONT face=Arial size=2&gt;http://www.daemon-tools.cc/dtcc/announcements.php&lt;/FONT&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Input Remapper &lt;/FONT&gt;&lt;A href="http://www.olofsson.info/"&gt;&lt;FONT face=Arial size=2&gt;http://www.olofsson.info/&lt;/FONT&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Kaspersky Antivirus &lt;/FONT&gt;&lt;A href="http://www.kaspersky.com/"&gt;&lt;FONT face=Arial size=2&gt;http://www.kaspersky.com/&lt;/FONT&gt;&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I tried to uninstall them but that wouldn't work either. So I did an install on top of them and then uninstalled and reinstalled again. Finally got them working.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Word of Advice&lt;/STRONG&gt;: If you plan to follow the route that I have taken, definitely uninstall the above apps and install them again, esp Input Remapper as it relies on the Mac Windows Drivers of Bootcamp.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Finally, I am good to go, my Vista seems stable and everything seems happy until I notice some nagging problems.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;My audio device doesn't work anymore. It says: "&lt;STRONG&gt;No audio output device is installed&lt;/STRONG&gt;". Installing/Reinstalling Bootcamp drivers didn't help. The only way I found to get this resolved is this:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Open&amp;nbsp;Device Manager&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Go to "Sound, video and game controllers"&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Uninstall Sigma Tel High Definition Audio CODEC. In the popup, choose the "Remove install software".&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Reinstall Bootcamp Window Drivers again&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;And lo! It works!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The other problem I ran into is "&lt;STRONG&gt;no battery is detected&lt;/STRONG&gt;".&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Even when I plugged out the power cord, it runs fine but I wasn't sure how long it would last. It would not give any metrics if I hovered over the Battery icon. The solution to this is:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Start your computer and go to OSX&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Reinstall Bootcamp in OSX.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Reboot your machine and login to Vista.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Your battery meter will now display properly.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Hope this helps other folks who run into the same issues I've had.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Have fun,&lt;BR&gt;Satish&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Clarity Consulting&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=3213" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="Non-Microsoft Products" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Non-Microsoft+Products/default.aspx" /><category term="Non-Microsoft Products" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Non-Microsoft+Products/default.aspx" /></entry><entry><title>Role of DockStyle property when adding controls</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/11/17/2480.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/11/17/2480.aspx</id><published>2006-11-17T21:24:00Z</published><updated>2006-11-17T21:24:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial size=2&gt;I recently ran into scenario where I had to rearrange some controls in an existing form. In a form, I&amp;nbsp;had a splitter, topGrid and bottomGrid. The DockStyle&amp;nbsp;for topGrid was set to Top, for splitter, it was set to top and for bottomGrid it was set to Fill. I had to change the dockstyle of topGrid to Fill and bottomGrid to bottom. As soon as I changed it, the topGrid would span the whole form and thus, I could not see a part of it. I had no idea why this was happening. I tried different things like updating the values in the code (and not in design mode). I even switched the grid positions to see if something was wrong with the&amp;nbsp;layout itself but the bottomGrid always worked fine and seemed to stick to it's position. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;I almost gave up and was on the verge of putting them in separate panels when&amp;nbsp;I realized that this weird behavior is being caused &lt;U&gt;&lt;STRONG&gt;by the order the controls were added to the form. The control that is added last takes the topmost priority.&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt; &lt;FONT face=Arial size=2&gt;And when I looked in the generated code, sure enough, the topGrid was the last one added and hence whenever I set it's DockStyle to Fill, it would occupy the whole grid and then the other controls would be added on top of it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;So I went into the generated code and manually rearranged the order in which controls are added and&amp;nbsp;it worked exactly as I wanted. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You can find more info at:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.bluevisionsoftware.com/WebSite/TipsAndTricksDetails.aspx?Name=DockStyle"&gt;&lt;FONT face=Arial size=2&gt;http://www.bluevisionsoftware.com/WebSite/TipsAndTricksDetails.aspx?Name=DockStyle&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.dockstyle.aspx"&gt;&lt;FONT face=Arial size=2&gt;http://msdn2.microsoft.com/en-us/library/system.windows.forms.dockstyle.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Happy Coding!&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=2480" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="Windows Forms" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Windows+Forms/default.aspx" /><category term="Windows Forms" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Windows+Forms/default.aspx" /></entry><entry><title>Sending Http Authentication Request from a Windows Form</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/11/14/2475.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/11/14/2475.aspx</id><published>2006-11-14T15:18:00Z</published><updated>2006-11-14T15:18:00Z</updated><content type="html">&lt;H1&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/H1&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;If you need to perform authentication using HttpWebRequest from a Windows application, you can do it the following way:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;// Prepare the data that needs to be sent&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt; postData = &lt;SPAN&gt;"userID="&lt;/SPAN&gt; + &lt;SPAN&gt;HttpUtility&lt;/SPAN&gt;.UrlEncode(userID);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;postData += "&amp;amp;password=" + HttpUtility.UrlEncode(_password);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;byte&lt;/SPAN&gt;&lt;SPAN&gt;[] data = &lt;SPAN&gt;ASCIIEncoding&lt;/SPAN&gt;.ASCII.GetBytes(postData);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;// Prepare web request&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;HttpWebRequest&lt;/SPAN&gt;&lt;SPAN&gt; webRequest = (&lt;SPAN&gt;HttpWebRequest&lt;/SPAN&gt;)&lt;SPAN&gt;WebRequest&lt;/SPAN&gt;.Create(myURL);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;// Add the required headers&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;webRequest.Method = &lt;SPAN&gt;"POST"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;webRequest.ContentType = &lt;SPAN&gt;"application/x-www-form-urlencoded"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;// Since we are sending data, specify the content and write to the stream&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;webRequest.ContentLength = data.Length;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;Stream&lt;/SPAN&gt;&lt;SPAN&gt; newStream = webRequest.GetRequestStream();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;// Send the data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;newStream.Write(data, 0, data.Length);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;newStream.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;// Retrieve the response&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;HttpWebResponse&lt;/SPAN&gt;&lt;SPAN&gt; webResponse = (&lt;SPAN&gt;HttpWebResponse&lt;/SPAN&gt;)webRequest.GetResponse();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;XmlTextReader&lt;/SPAN&gt;&lt;SPAN&gt; reader = &lt;SPAN&gt;new&lt;/SPAN&gt; X&lt;SPAN&gt;mlTextReader&lt;/SPAN&gt;(webResponse.GetResponseStream());&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;XmlDocument&lt;/SPAN&gt;&lt;SPAN&gt; doc = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;XmlDocument&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;doc.Load(reader);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;// And then read the XmlDocument&lt;/SPAN&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;The above immplementation is pretty straightforward. If you plan to send the credentials in the header, you can use Basic Authentication. This should only be used when sending the request over SSL as the information is still sent openly. Using SSL ensures that the contents of this request are encrypted. This can be done in the following way:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;//Prepare the Authentication parameters&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;String&lt;/SPAN&gt;&lt;SPAN&gt; auth = userID + &lt;SPAN&gt;":"&lt;/SPAN&gt; + password;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;byte&lt;/SPAN&gt;&lt;SPAN&gt;[] binaryData = &lt;SPAN&gt;Encoding&lt;/SPAN&gt;.UTF8.GetBytes(auth);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;auth = &lt;SPAN&gt;Convert&lt;/SPAN&gt;.ToBase64String(binaryData); // &lt;SPAN&gt;Using base64 encoding&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;auth = &lt;SPAN&gt;"Basic "&lt;/SPAN&gt; + auth; &lt;SPAN&gt;//This specifies it to use Basic Authentication&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;// Prepare web request&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;HttpWebRequest&lt;/SPAN&gt;&lt;SPAN&gt; webRequest = (&lt;SPAN&gt;HttpWebRequest&lt;/SPAN&gt;)&lt;SPAN&gt;WebRequest&lt;/SPAN&gt;.Create(myURL);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;// Add the standard headers&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;webRequest.Method = &lt;SPAN&gt;"POST"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;webRequest.ContentType = &lt;SPAN&gt;"application/x-www-form-urlencoded"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;webRequest.ContentLength = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;// Add this additional header&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;webRequest.Headers[“AUTHORIZATION”] = auth;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;HttpWebResponse&lt;/SPAN&gt;&lt;SPAN&gt; webResponse = (&lt;SPAN&gt;HttpWebResponse&lt;/SPAN&gt;)webRequest.GetResponse();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;XmlTextReader&lt;/SPAN&gt;&lt;SPAN&gt; reader = &lt;SPAN&gt;new&lt;/SPAN&gt; X&lt;SPAN&gt;mlTextReader&lt;/SPAN&gt;(webResponse.GetResponseStream());&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;XmlDocument&lt;/SPAN&gt;&lt;SPAN&gt; doc = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;XmlDocument&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;doc.Load(reader);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;This is a more secure call!&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;You can find more information about HttpWebRequest and Headers at:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.net.httpwebrequest.aspx"&gt;&lt;FONT face=Arial size=2&gt;http://msdn2.microsoft.com/en-us/library/system.net.httpwebrequest.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.net.httpwebrequest.headers.aspx"&gt;&lt;FONT face=Arial size=2&gt;http://msdn2.microsoft.com/en-us/library/system.net.httpwebrequest.headers.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=2475" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="Windows Forms" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Windows+Forms/default.aspx" /><category term="Windows Forms" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Windows+Forms/default.aspx" /></entry><entry><title>Suppressing Script Errors in a WebBrowser</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/10/20/2340.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/10/20/2340.aspx</id><published>2006-10-20T15:15:00Z</published><updated>2006-10-20T15:15:00Z</updated><content type="html">&lt;P class=MsoNormal&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;FONT face=Arial size=2&gt;I had a WebBrowser control embedded in my C# application which would bring up the URL page that I needed. Recently I came across a situation where I had to suppress any javascript errors that occurred in this web page.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;Previously in the .Net Framework 1.0, I was using the COM version of the WebBrowser and I used the AxWebBrowser. For users who are still using this reference, the suggested way for suppressing the script errors is documented here:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;A href="http://support.microsoft.com/?kbid=279535"&gt;&lt;FONT face=Arial size=2&gt;http://support.microsoft.com/?kbid=279535&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;However, I migrated recently to .Net Framework 2.0 and I now use the &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx"&gt;&lt;FONT face=Arial size=2&gt;System.Windows.Forms.WebBrowser&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt; which comes as a part of this framework. This control now has a property namely &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.scripterrorssuppressed.aspx"&gt;&lt;FONT face=Arial size=2&gt;ScriptErrorsSuppressed&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt; which will disable any error dialogs when set to true. A note of caution though: The above property will not only suppress script errors but any errors that originate from the underlying ActiveX control.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;If you need control of the error that has occurred and play around with the parameters/error, a better way to do is by using the DocumentCompleted Event. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;Here is a sample code of how I implemented:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;// Register the event&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;void&lt;/SPAN&gt; SetBrowserSettings()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_webBrowser.DocumentCompleted +=&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;WebBrowserDocumentCompletedEventHandler&lt;/SPAN&gt;(_webBrowser_DocumentCompleted);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;// Handle the event&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Invoked after the document has completed loading&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;void&lt;/SPAN&gt; _webBrowser_DocumentCompleted(&lt;SPAN&gt;object&lt;/SPAN&gt; sender, &lt;SPAN&gt;WebBrowserDocumentCompletedEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;((System.Windows.Forms.&lt;SPAN&gt;WebBrowser&lt;/SPAN&gt;)sender).Document.Window.Error += &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;HtmlElementErrorEventHandler&lt;/SPAN&gt;(Window_Error);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Handles any errors that occur after the document has loaded&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;private&lt;/SPAN&gt; &lt;SPAN&gt;void&lt;/SPAN&gt; Window_Error(&lt;SPAN&gt;object&lt;/SPAN&gt; sender, &lt;SPAN&gt;HtmlElementErrorEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;MyLog&lt;/SPAN&gt;(&lt;SPAN&gt;LogLevel&lt;/SPAN&gt;.Error, &lt;SPAN&gt;"Script error occurred at URL {0}, Line Number {1}. Description {2}"&lt;/SPAN&gt;, e.Url, e.LineNumber, e.Description);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Ignore the error and suppress the error dialog box. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal align=left&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.Handled = &lt;SPAN&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;FONT size=2&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;You may also use the Navigated event in a similar fashion. But be aware that if the user hits the refresh button, this event will not be invoked again. So depending on your requirement, you can implement it either way&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face=Arial size=2&gt;You can also find further enhancements to the WebBrowser control discussed here:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;A href="http://www.codeproject.com/csharp/ExtendedWebBrowser.asp?df=100&amp;amp;forumid=285594&amp;amp;exp=0&amp;amp;fr=26"&gt;&lt;FONT face=Arial size=2&gt;http://www.codeproject.com/csharp/ExtendedWebBrowser.asp?df=100&amp;amp;forumid=285594&amp;amp;exp=0&amp;amp;fr=26&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=2340" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="Windows Forms" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Windows+Forms/default.aspx" /><category term="Windows Forms" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Windows+Forms/default.aspx" /></entry><entry><title>ASP .NET Datagrid with scrollbars and fixed headers</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/23/235.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/23/235.aspx</id><published>2006-02-23T15:31:00Z</published><updated>2006-02-23T15:31:00Z</updated><content type="html">&lt;font face="Arial"&gt;&lt;font size="2"&gt;Hi,&lt;br&gt;&amp;nbsp;I recently needed to create a datagrid in ASP .NET pages whose data was not autogenerated (read my previous blogs about my adventures in it). I did not want to add paging to my datagrid but the records being returned were so many that one had to scroll a lot in the browser. So I thought, why not put a scrollbar for my datagrid. Ofcouse, there is no direct property that I could switch on in the Datagrid. And I realized I had to use the div tag which is actually pretty simple.&lt;br&gt;&lt;br&gt;&lt;u&gt;&lt;font size="4"&gt;&lt;b&gt;Adding a ScrollBar&lt;br&gt;&lt;br&gt;&lt;/b&gt;&lt;/font&gt;&lt;/u&gt;Enclose your datagrid in a &amp;lt;div&amp;gt; tag and set the overflow style to auto/scroll. For those of you who prefer to do it through the design mode, there is an excellent step-by-step instructions at this link:&lt;/font&gt;&lt;/font&gt;&lt;br&gt;&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;a href="http://www.dotnetjunkies.com/HowTo/E833AEAE-8D7E-4D1F-821B-D848D965F70A.dcik"&gt;http://www.dotnetjunkies.com/HowTo/E833AEAE-8D7E-4D1F-821B-D848D965F70A.dcik&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;font face="Arial"&gt;&lt;font size="2"&gt;Now my datagrid had a neat little scrollbar and I could fit it into the browser with losing sight of the input information I had entered above. But I had one more problem. The Column headers would not stay still and would scroll away. How do I fix this?&lt;br&gt;&lt;br&gt;&lt;font size="4"&gt;&lt;u&gt;&lt;b&gt;Fixed Headers&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;br&gt;&lt;br&gt;The best way to achieve this is by using style sheets (I have seen around suggestions like adding a table which has your column names as the columns for this table and you stick it on top of the datagrid, and you set the datagrid header visible property to false. Trust me, CSS is way cooler than that).&lt;br&gt;Add this style to the CSS class or to the HTML code itself.&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .DataGridFixedHeader { POSITION: relative; ; TOP: expression(this.offsetParent.scrollTop); BACKGROUND-COLOR: white }&lt;br&gt;&amp;lt;/style&amp;gt;&lt;br&gt;&lt;/font&gt;&lt;font face="Arial"&gt;&lt;font size="2"&gt;&lt;br&gt;And refer this style in your ASP datagrid, by setting this value to the CSSClass property of the HeaderStyle of the datagrid. For ex:&lt;br&gt;&lt;br&gt;&lt;font face="Courier New"&gt;&amp;lt;asp:datagrid id="resultGrid" tabIndex="-1" runat="server" Width="900px" Height="224px" BorderStyle="None"&amp;gt; &amp;nbsp;  &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;HeaderStyle Font-Names="Arial" Font-Bold="True" HorizontalAlign="Center" ForeColor="White" BorderStyle="Solid"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; BorderColor="Black" VerticalAlign="Bottom" BackColor="LightSlateGray" &lt;b&gt;CssClass="DataGridFixedHeader"&lt;/b&gt;&amp;gt;&amp;lt;/HeaderStyle&amp;gt;&lt;br&gt;..........&lt;br&gt;&amp;lt;/asp:datagrid&amp;gt;&lt;br&gt;&lt;/font&gt;&lt;br&gt;You can set this property from the design mode too by navigating to the HeaderStyle property.&lt;br&gt;&lt;br&gt;My colleague kmarshall has posted a very interesting article about using CSS gridviews here. Check it out, you may get some interesting ideas:&lt;br&gt;&lt;/font&gt;&lt;/font&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;a href="../../blogs/kevin_marshall/archive/2006/02/23/234.aspx"&gt;http://blogs.claritycon.com/blogs/kevin_marshall/archive/2006/02/23/234.aspx&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;font face="Arial"&gt;&lt;font size="2"&gt;BTW, I could have used Infragistics WebGrid and it has the options of setting a scrollbar and a fixed data header. But for the complex template columns I had to use for my grid, I was better off using the DataGrid than the WebGrid with these nice workarounds.&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=235" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>Dummy tables for SQL in Oracle, MS SQL and DB2</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/22/230.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/22/230.aspx</id><published>2006-02-22T16:31:00Z</published><updated>2006-02-22T16:31:00Z</updated><content type="html">&lt;font face="Arial"&gt;&lt;font size="2"&gt;Once in a while, you will come across scenarios where you would like to run a pre-defined function but not against a table. For example, you would like to know the date or perform some computations, but what if I don't want to use a user-defined table. Here are some ways to achieve this:&lt;br&gt;&lt;br&gt;&lt;font color="#d3d3d3"&gt;&lt;u&gt;&lt;b&gt;Oracle&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;br&gt;&lt;br&gt;You can use the dual table to achieve this. For ex:&lt;br&gt;&lt;font face="Courier New"&gt;SELECT sysdate from dual;&lt;/font&gt;&lt;br&gt;will return the current time.&lt;br&gt;&lt;br&gt;You can find more info about DUAL table from Oracle's best resource (IMO), AskTom:&lt;br&gt;&lt;/font&gt;&lt;/font&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;a href="http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1562813956388"&gt;http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1562813956388&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;font face="Arial"&gt;&lt;font size="2"&gt;&lt;font color="#d3d3d3"&gt;&lt;u&gt;&lt;b&gt;MS SQL&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;br&gt;&lt;br&gt;Just ignore the FROM clause ie:&lt;br&gt;&lt;font face="Courier New"&gt;SELECT getdate()&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;u&gt;&lt;b&gt;&lt;font color="#d3d3d3"&gt;DB2&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;/b&gt;&lt;/u&gt;Use the &lt;/font&gt;&lt;/font&gt;SYSIBM.SYSDUMMY1&lt;font face="Arial"&gt;&lt;font size="2"&gt; table. For ex:&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;span&gt;select user, current
timestamp from sysibm.sysdummy1&lt;br&gt;&lt;br&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Arial" size="2"&gt;For more info:&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;a href="http://www-1.ibm.com/support/docview.wss?uid=swg21009013"&gt;http://www-1.ibm.com/support/docview.wss?uid=swg21009013&lt;/a&gt;

&lt;br&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=230" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="Server Products" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Server+Products/default.aspx" /><category term="Server Products" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Server+Products/default.aspx" /></entry><entry><title>Unable to start debugging on the Web server</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/22/229.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/22/229.aspx</id><published>2006-02-22T14:18:00Z</published><updated>2006-02-22T14:18:00Z</updated><content type="html">&lt;font size="2"&gt;&lt;font face="Arial"&gt;I ran into a weird issue today. I reimaged my machine and had Visual Studio 2003 and 2005 installed on it. I had an ASP .Net web service application created using VS 2003. So I tried to debug this application and all I would get was &lt;/font&gt;&lt;/font&gt;&lt;br&gt;&lt;pre class="code"&gt;Unable to start debugging on the Web server&lt;/pre&gt;&lt;br&gt;I could run the webservice from the browser by typing in the URL. I could run it from IIS by right-clicking on the aspx page and click "Browse", but debug I could not!&lt;br&gt;&lt;br&gt;The IDE would not say anything and the help would ask me to perform the following steps:&lt;br&gt;&lt;p class="MsoNormal"&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtbshttpservererrors.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtbshttpservererrors.asp&lt;/a&gt;&lt;/p&gt;

&lt;font face="Arial" size="2"&gt;I performed all of these and some things in addition but not luck. I was totally vexed and was almost about to give up when I gave one last shot. I went to the IIS server, right clicked on my Web application and looked at the Properties and verfiied each tab, and when I clicked on the ASP .NET tab, this is where I found the cause of my error. The ASP .NET version had been defaulted to 2.0 and my application was written in version 1.1 (I hadn't converted my web app to the newer version as I needed it to run on VS 2003).&lt;br&gt;&lt;br&gt;I manually changed the version of this webservice application to 1.1 and now I'm back to debugging! So do not assume that opening a web service application in VS 2003 will have the IIS server set the right version for you. You may have to manually configure it esp if you plan to use both VS 2003 and VS 2005&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=229" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>Failure to start monitoring changes / Unable to start debugging on the web server</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/19/227.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/19/227.aspx</id><published>2006-02-20T05:00:00Z</published><updated>2006-02-20T05:00:00Z</updated><content type="html">&lt;font face="Verdana" size="4"&gt;&lt;i&gt;Access denied to 'c:\inetpub\wwwroot\MyApp\'. Failed to start monitoring file changes. &lt;br&gt;&lt;br&gt;&lt;/i&gt;&lt;/font&gt;
&lt;b&gt;&lt;font face="Verdana" size="2"&gt;Description: &lt;/font&gt;&lt;/b&gt;&lt;font face="Arial" size="2"&gt;An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. &lt;/font&gt;&lt;br&gt;&lt;font face="Verdana" size="2"&gt;&lt;b&gt;Exception Details: &lt;/b&gt;&lt;/font&gt;&lt;font face="Arial" size="2"&gt;System.Web.HttpException: Access denied to 'c:\inetpub\wwwrootMyApp\'. Failed to start monitoring file changes.&lt;/font&gt;&lt;br&gt;&lt;font face="Verdana" size="2"&gt;&lt;b&gt;Source Error: &lt;/b&gt;&lt;/font&gt;
&lt;font size="2"&gt;An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;b&gt;&lt;font face="Verdana" size="2"&gt;Stack Trace: &lt;br&gt;&lt;/font&gt;&lt;/b&gt;

&lt;font face="Lucida Console" size="2"&gt;[HttpException (0x80070005): Access denied to 'c:\inetpub\wwwroot\MyApp\'. Failed to start monitoring file changes.]
   System.Web.DirMonCompletion..ctor(DirectoryMonitor dirMon, String dir, Boolean watchSubtree, UInt32 notifyFilter) +140
   System.Web.DirectoryMonitor.StartMonitoring() +42
   System.Web.DirectoryMonitor.StartMonitoringFile(String file, FileChangeEventHandler callback, String alias) +154
   System.Web.FileChangesMonitor.StartMonitoringDirectoryRenamesAndBinDirectory(String dir, FileChangeEventHandler callback) +278
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +331

[HttpException (0x80004005): ASP.NET Initialization Error]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +983
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +128&lt;/font&gt;

&lt;br&gt;&lt;br&gt;&lt;b&gt;&lt;font face="Verdana" size="2"&gt;Version Information:&lt;/font&gt;&lt;/b&gt;&lt;font face="Arial" size="2"&gt;.NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032&lt;/font&gt;

&lt;br&gt;&lt;br&gt;&lt;font size="2"&gt;&lt;font face="Arial"&gt;Have you run across any of these issues when trying to run an asp application?&lt;/font&gt;&lt;/font&gt; &lt;font face="Arial" size="2"&gt;Chances are pretty high that this is because you have not given privileges to the ASPNET user on the virtual directory.

ASPNET user account is the account used for running the ASP.NET worker process (aspnet_wp.exe)

&lt;br&gt;&lt;br&gt;Here are certain steps to resolve this problem:&lt;/font&gt; &lt;font face="Arial" size="2"&gt;&lt;br&gt;&lt;/font&gt;&lt;ul&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;Check who is running the aspnet_wp.exe by looking at the processes in Task Manager. It is ASPNET by default. Lets verify if this user has been given permissions to access C:\Inetpub\wwwroot\MyApp&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;In Windows Explorer, right click on this directory, click Properties.&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;Select Security Tab and if the ASPNET user does not exists, click on Add and add the user. &lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;Leave the default permission and click OK to save these changes. &lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;If the problem persists, repeat these steps for each folder in the hierarchy of the path. &lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;Run your ASP .Net app&lt;/font&gt;&lt;font face="Arial" size="2"&gt;lication now and it should work.

&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;font face="Arial" size="2"&gt;&lt;br&gt;You can get detailed step-by-step information at the following link:&lt;br&gt;&lt;/font&gt;&amp;nbsp;&lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q317955"&gt;http://support.microsoft.com/default.aspx?scid=kb;en-us;Q317955&lt;/a&gt;

&lt;font face="Arial" size="2"&gt;&lt;br&gt;&lt;br&gt;If this still doesn't help, try these:&lt;/font&gt; &lt;font face="Arial" size="2"&gt;&lt;br&gt;&lt;/font&gt;&lt;ul&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;Verify that the debug property is set to true in the web.config file.&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;Give full read-write permissions to the respective folders&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;Verify that IIS server was installed prior to ASP .NET.&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Arial" size="2"&gt;Run aspnet_regiis.exe -i and reinstall the relevant ASP .NET version.

&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;font face="Arial" size="2"&gt;&lt;br&gt;Good Luck!
&lt;/font&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=227" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>The Active schema does not support the element DisplayLayout, AddNewBox, Bands etc..</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/17/226.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/17/226.aspx</id><published>2006-02-18T00:32:00Z</published><updated>2006-02-18T00:32:00Z</updated><content type="html">&lt;font face="Arial" size="2"&gt;I came across this issue when I tried to add an Infragistics UltraWebGrid to the ASP .Net page. Everything looks fine in the Design mode. When you switch to HTML mode, you will find a lot of squiggly linesunder DisplayLayout, BorderDetails etc saying the active schema does not support these elements

And when you try to run your asp pages, you may see the following error:&lt;/font&gt;

&lt;br&gt;&lt;br&gt;&lt;i&gt;&lt;font color="yellow" face="Verdana" size="4"&gt;Compilation Error &lt;br&gt;&lt;/font&gt;&lt;/i&gt;&lt;br&gt;&lt;br&gt;

&lt;b&gt;&lt;font face="Verdana" size="2"&gt;Description: &lt;/font&gt;&lt;/b&gt;&lt;font size="2"&gt;An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. &lt;/font&gt;
&lt;font face="Verdana" size="2"&gt;&lt;b&gt;&lt;br&gt;Compiler Error Message: &lt;/b&gt;&lt;/font&gt;&lt;font size="2"&gt;CS0234: The type or namespace name 'BorderDetails' does not exist in the class or namespace 'Infragistics.WebUI.Shared' (are you missing an assembly reference?)&lt;/font&gt;&lt;font face="Verdana" size="2"&gt;&lt;b&gt;&lt;br&gt;Source Error:&lt;/b&gt;&lt;/font&gt;

&lt;br&gt;&lt;br&gt;&amp;lt;&lt;font face="Lucida Console" size="2"&gt;igtbl:UltraWebGrid id="UltraWebGrid1" style="Z-INDEX: 103; LEFT: 768px; POSITION: absolute; TOP: 264px"
&lt;br&gt;Line 72:                 runat="server"
DisplayLayout RowHeightDefault="20px" Version="4.00" BorderCollapseDefault="Separate" Name="UltraWebGrid1"&amp;gt;&lt;br&gt;&lt;br&gt;&lt;/font&gt;&amp;nbsp;&lt;font face="Arial" size="2"&gt;It looks like Visual Studio does not recognizes the 3&lt;sup&gt;rd&lt;/sup&gt;party software and does not import the required assembly files ie &lt;font face="Verdana" size="2"&gt;Infragistics&lt;/font&gt;.WebUI.Shared Elements. In order to avoid this, make sure that this assembly has been added to the references and &lt;b&gt;SET the CopyLocal property to true.&lt;/b&gt;. Run your code and you should now be able to bring up your ASP .NET page. Note that thisdoes not remove the squiggly lines in the HTML mode but it does not stop you from designing and building your app!! &lt;/font&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=226" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>Select FIRST/TOP N rows in MS SQL, Oracle and DB2</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/15/220.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/15/220.aspx</id><published>2006-02-15T21:12:00Z</published><updated>2006-02-15T21:12:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial size=2&gt;How do you select the first N rows in various databases? &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A quick thing to remember is that rows are not stored in any particular sequence in a database. They can be placed in random data blocks in the database without any order whatsoever. If a query returns X rows, they definitely do not mean that these rows are stored in exactly this same order. It is just that these rows have satisfied your select query and are being displayed in the order they are found (unless you specify an ORDER BY clause). So how do I obtain only the first N rows from a query which actually returns more than N rows?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Here is a quick overview of how it can be done.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#ffa500 size=2&gt;&lt;STRONG&gt;MS SQL&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;SELECT&amp;nbsp;TOP&amp;nbsp;10&amp;nbsp;name, description&lt;BR&gt;FROM&amp;nbsp;TABLEA&lt;BR&gt;ORDER BY name&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The above query will return the first 10 rows sorted by name. How do I get the bottom 10 rows? Use the DESC keyword in the ORDER BY clause and it will sort it in reverse order.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#ffa500 size=2&gt;&lt;STRONG&gt;ORACLE&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;SELECT&amp;nbsp;name, description&lt;BR&gt;FROM&amp;nbsp;TABLEA&lt;BR&gt;WHERE rownum &amp;lt;=10&lt;BR&gt;ORDER BY NAME&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;One has to be careful when trying a similar thing in ORACLE. The above code will not work, simply because the query will return the first 10 rows and then order them, which is definitely not what you wanted. ROWNUM is a pseudo column that is assigned values based on the results returned. So the above code would have worked if there was no ORDER BY clause. The right way would be:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;SELECT * FROM&lt;BR&gt;(SELECT&amp;nbsp;name, description&lt;BR&gt;FROM&amp;nbsp;TABLEA&lt;BR&gt;ORDER BY NAME)&lt;BR&gt;WHERE rownum &amp;lt;=10&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A good resource for various questions on Oracle is:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.orafaq.com/"&gt;http://www.orafaq.com/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#ffa500 size=2&gt;&lt;STRONG&gt;DB2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=2&gt;SELECT&amp;nbsp;name, description&lt;BR&gt;FROM&amp;nbsp;TABLEA&lt;BR&gt;ORDER BY NAME&lt;BR&gt;FETCH FIRST 10 ROWS ONLY&lt;BR&gt;OPTIMIZE FOR 10 ROWS&lt;/FONT&gt;&lt;/DIV&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=220" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="Server Products" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Server+Products/default.aspx" /><category term="Server Products" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/Server+Products/default.aspx" /></entry><entry><title>Customizing columns in ASP.Net DataGrids</title><link rel="alternate" type="text/html" href="http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/14/217.aspx" /><id>http://blogs.claritycon.com/blogs/satish_vemula/archive/2006/02/14/217.aspx</id><published>2006-02-14T20:27:00Z</published><updated>2006-02-14T20:27:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Working with datagrids can be fun and interesting and sometimes challenging too. Everything is fine as long as you are using the basic features of Datagrid and generating the columns from the dataset itself. But they tend to get a little challenging when you need to customize columns and design it the way you want and provide more customization that is not available in the DataSet itself.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;This article discusses&amp;nbsp;some key scenarios when dealing with Datagrid.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#a52a2a size=4&gt;1. Custom Column formatting&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Now all columns need not be of the same datatype or you may want to format a certain numeric column to display commas etc. So how can we do it?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#808080&gt;&lt;STRONG&gt;&amp;nbsp;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT size=3&gt;i.&amp;nbsp;&amp;nbsp;&amp;nbsp;Specifying the DataStringFormat&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Before I delve into the different formats, here is how you can add/change the format. Right click on the Datagrid in design view and click on Property Builder (or in the Datagrid properties, click on the Columns Collection).&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Choose the Columns tab. You will see a list of Available Columns and Selected Columns. If you don’t have any selected columns, add a Bound Column. Now click on the selected Column and you will see the option for “Data Formatting expression”. This is how you enter the data format. &lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp; You can also directly add this attribute to the aspx code which you is discussed later in this article.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;The single-most important rule to understand is the way the format specification. The specification is:&lt;BR&gt;&amp;nbsp;&amp;nbsp; {0:myFormat}&amp;nbsp;&amp;nbsp; where myFormat is the format you want to specify, for example&lt;BR&gt;&amp;nbsp;&amp;nbsp; {0:C}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;People often forget the curly braces 0 i.e. {0}. &lt;FONT size=1&gt;&lt;STRONG&gt;YOU NEED THIS EVEN IF YOU ARE ENTERING IT THROUGH PROPERY BUILDER&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;The {0} specifies the current row and cell to which the format needs to be applied to.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;&amp;nbsp;&lt;FONT color=#808080 size=3&gt;&amp;nbsp;&amp;nbsp;ii.&amp;nbsp;&amp;nbsp;&amp;nbsp;Various formats&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a.&amp;nbsp;&amp;nbsp;&amp;nbsp;Currency format&lt;/STRONG&gt;&lt;BR&gt;&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;{0:C}&lt;BR&gt;&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;The currency format is according to the culture info set in the web config file&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b.&amp;nbsp;&amp;nbsp;&amp;nbsp;Numeric format&lt;/STRONG&gt;&lt;BR&gt;&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;{0:000}&lt;BR&gt;&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;This specifies zero padded numbers of length 3&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;c.&amp;nbsp;&amp;nbsp;&amp;nbsp;Decimal format&lt;BR&gt;&lt;/STRONG&gt;&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;{0:0.00}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&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;You can find more info about standard numeric&amp;nbsp;formats at:&lt;BR&gt;&lt;/FONT&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandardnumericformatstrings.asp"&gt;&lt;FONT face=Arial size=2&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandardnumericformatstrings.asp&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&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;and custom numeric&amp;nbsp;formats at:&lt;BR&gt;&lt;/FONT&gt;&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;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomnumericformatstrings.asp"&gt;&lt;FONT face=Arial size=2&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomnumericformatstrings.asp&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;d.&amp;nbsp;&amp;nbsp;&amp;nbsp;Date format&lt;BR&gt;&lt;/STRONG&gt;&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;{0:dd-MMM-yyyy HH:mm:ss}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&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;You can find more standard date formats at:&lt;BR&gt;&lt;/FONT&gt;&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;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandarddatetimeformatstrings.asp"&gt;&lt;FONT face=Arial size=2&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandarddatetimeformatstrings.asp&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&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;and custom date formats at:&lt;BR&gt;&lt;/FONT&gt;&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;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomdatetimeformatstrings.asp"&gt;&lt;FONT face=Arial size=2&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomdatetimeformatstrings.asp&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color=#808080 size=3&gt;&amp;nbsp;iii.&amp;nbsp;&amp;nbsp;&amp;nbsp;Modifying the format of the custom column in the ASPX page&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;You can add the DataFormatString&amp;nbsp;attribute directly in the aspx page as shown below:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&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;lt;asp:BoundColumn DataField="LOGDATE" HeaderText="Log Date" DataFormatString="{0:yyyy/MM/dd HH:mm:ss}"&amp;gt;&amp;lt;/asp:BoundColumn&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#a52a2a size=4&gt;2. Adding a&amp;nbsp;Row Number to your Datagrid&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;You are displaying a ton of rows in your custom datagrid and you wish you could have a row number to identify each row easily. How do we do that?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;It is very simple actually. By using a template column. (For info on how to create template columns, refer to the links below in this section).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;In the ItemTemplate element, you can define the content that will be rendered for each item in the column.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Below is the sample for this:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;asp:templatecolumn headertext="Row Number"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;itemtemplate&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%# Container.ItemIndex+1 %&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/itemtemplate&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/asp:templatecolumn&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ItemIndex is the row index indexed from 0. So add 1 to it and you get your row numbers!!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Now an interesting point to note is the Container object which basically refers to the current row in the DataGrid and is of type DataGridItem. So you can practically use any methods defined on the DataGridItem and utilize them in displaying values in your column, and this is how we have displayed the row number. You can invoke the Container.DataItem to get the row itself and you can choose whichever column you want from it by using DataBinder.Eval(). An example is discussed in the later section.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;There is a good article on creating templates at:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskaddingtemplatecolumntodatagridwebcontrol.asp"&gt;&lt;FONT face=Arial size=2&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskaddingtemplatecolumntodatagridwebcontrol.asp&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;BR&gt;A very good article on the usages of template columns can be found at:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://aspnet.4guysfromrolla.com/articles/061002-1.aspx"&gt;&lt;FONT face=Arial size=2&gt;http://aspnet.4guysfromrolla.com/articles/061002-1.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Arial color=#a52a2a size=4&gt;3. Adding a HyperLink column to your Datagrid&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;This is pretty simple thanks to the customizable columns. You can do it in 2 ways (that I know of):&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;FONT color=#808080 size=3&gt;&lt;STRONG&gt;i.&amp;nbsp;&amp;nbsp;&amp;nbsp;Using HyperLinkColumn&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Using the property builder, you can add a HyperLinkColumn and specify the URL that it needs to point to. You can add other attributes like target location, the Header Text etc. Here is a sample: &lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;lt;asp:HyperLinkColumn &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Target="_blank" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataNavigateUrlField="ID"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataNavigateUrlFormatString="Form2.aspx?MyID={0}"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataTextField="ID" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HeaderText="Details" &amp;gt;&lt;BR&gt;&amp;lt;/asp:HyperLinkColumn&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The DataTextField is the column to be displayed. (If you don’t want to display this value but put in a common value of let’s say “More Info” to each cell, you can do this by specifying it in DataFormatString, for example DataFormatString=”More Info”)&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The DataNavigateUrlField contains the column name that is to be passed into the URL field.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The DataNavigateUrlFormatString contains the URL link.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The HeaderText refers to the Column name to be displayed&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;FONT color=#808080 size=3&gt;&lt;STRONG&gt;ii.&amp;nbsp;&amp;nbsp;&amp;nbsp;Using TemplateColumn&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;You can achieve the same by adding a template column and putting in&amp;nbsp; &amp;lt;a&amp;gt; attribute. Consider this example:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;lt;asp:TemplateColumn HeaderText="Row #"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;ItemTemplate&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;a target=_blank href='&amp;lt;%# DataBinder.Eval(Container.DataItem, "ID", "Form2.aspx?MyID={0}") %&amp;gt;'&amp;gt;&amp;lt;%# Container.ItemIndex+1 %&amp;gt;&amp;lt;/a&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/ItemTemplate&amp;gt;&lt;BR&gt;&amp;lt;/asp:TemplateColumn&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;DataBinder.Eval takes in 3 parameters:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Container.DataItem is the current DataGridItem&amp;nbsp;the grid is referring to. &lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;ID is the column you want to choose from the DataGridItem row&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The third parameter is the format that you want to display the column value. By saying Form2.aspx?MyID={0}, I am actually sending the value of ID into the format string&amp;nbsp;and using that as my link URL.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Notice how neatly we have tricked it to display the row number and the hyperlink being the format string we want to use, which is a URL to another page&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You can use the same method to display images in a grid. For example:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;lt;itemtemplate&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;img width=60 align="top" src='&amp;lt;%# DataBinder.Eval ( Container.DataItem, "Book_Cover", "/etc/images/cover-{0}.gif" ) %&amp;gt;' &amp;gt;&lt;BR&gt;&amp;lt;/itemtemplate&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Do note that DataBinder.Eval performs late bound evaluation and may cause slow performance compared to standard ASP.NET pages. Refer to this link here for more details:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuidatabinderclassevaltopic2.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuidatabinderclassevaltopic2.asp&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Hope you had fun reading through this and found this article helpful.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;BR&gt;Happy Programming!!&lt;BR&gt;&amp;nbsp;&lt;BR&gt;Satish Vemula&lt;BR&gt;Clarity Consulting&lt;BR&gt;&lt;/FONT&gt;&lt;A href="mailto:svemula@claritycon.com"&gt;&lt;FONT face=Arial size=2&gt;svemula@claritycon.com&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;img src="http://blogs.claritycon.com/aggbug.aspx?PostID=217" width="1" height="1"&gt;</content><author><name>svemula</name><uri>http://blogs.claritycon.com/members/svemula.aspx</uri></author><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /><category term="ASP.NET" scheme="http://blogs.claritycon.com/blogs/satish_vemula/archive/tags/ASP.NET/default.aspx" /></entry></feed>