<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2790750329469603390</id><updated>2012-02-16T04:05:54.629-08:00</updated><category term='C#'/><category term='Console Application'/><category term='MVC 3'/><category term='WebClient'/><category term='JQuery'/><category term='LINQ'/><category term='Data Grid'/><category term='WCF'/><category term='XPath'/><category term='CSS'/><category term='SQL Query'/><category term='Thread'/><category term='Javascript'/><category term='Stored Procedure'/><category term='SilverLight'/><category term='Web User Control'/><category term='HTML'/><category term='XML'/><category term='VB.NET'/><category term='LINQ to SQL'/><category term='Visual Studio 2010 Express'/><title type='text'>Code Garage</title><subtitle type='html'>All about .NET Programming.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-614632420438986530</id><published>2011-03-30T21:24:00.000-07:00</published><updated>2011-04-05T19:51:25.513-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ to SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2010 Express'/><category scheme='http://www.blogger.com/atom/ns#' term='MVC 3'/><title type='text'>My First MVC 3 Project</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Run you Visual Studio 2010 (i used the Express Edition). Select the &lt;b&gt;File&lt;/b&gt; menu and then &lt;b&gt;New Project&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-GrXPvVruDnU/TZQBEwRL5mI/AAAAAAAAAYQ/OSFo0PVDi3Q/s1600/picture_0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-GrXPvVruDnU/TZQBEwRL5mI/AAAAAAAAAYQ/OSFo0PVDi3Q/s320/picture_0.jpg" width="223" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 1&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;On the window dialog, select which language you want to use. In this case i used C#. As you click on it, it will scroll down more menus. Select &lt;b&gt;Web&lt;/b&gt;. Now, look at middle section of the window. Select &lt;b&gt;ASP.NET MVC 3 Web Application&lt;/b&gt;. Name the project and solution as &lt;b&gt;StudentMVC&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-WvNhHMHpM-8/TZQBGT-KnOI/AAAAAAAAAYU/aqjHJSTGy9c/s1600/picture_1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="221" src="http://2.bp.blogspot.com/-WvNhHMHpM-8/TZQBGT-KnOI/AAAAAAAAAYU/aqjHJSTGy9c/s320/picture_1.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 2&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;br /&gt;Click &lt;b&gt;Ok&lt;/b&gt; and now another window dialog appears. I chose &lt;b&gt;Empty Project&lt;/b&gt; because i prefer to create this project from the scratch. If i chose &lt;b&gt;Internet Application&lt;/b&gt; the Visual Studio 2010 would provide predefine features on the new project such as &lt;b&gt;Home&lt;/b&gt; and &lt;b&gt;Accounts&lt;/b&gt; controllers.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-haX0fgtV2T0/TZQBHTY1fYI/AAAAAAAAAYY/RGHbuUKe_TM/s1600/picture_2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="292" src="http://3.bp.blogspot.com/-haX0fgtV2T0/TZQBHTY1fYI/AAAAAAAAAYY/RGHbuUKe_TM/s320/picture_2.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 3&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;By default the empty MVC 3 project comes with several important folders such as &lt;b&gt;Controlers&lt;/b&gt;,&lt;b&gt;Models&lt;/b&gt; and &lt;b&gt;Views&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-MrKIRK96qPM/TZQBIs5Gl0I/AAAAAAAAAYc/IiOfe8Rbr-c/s1600/picture_3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="246" src="http://1.bp.blogspot.com/-MrKIRK96qPM/TZQBIs5Gl0I/AAAAAAAAAYc/IiOfe8Rbr-c/s320/picture_3.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 4&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Before working further, you need to create a small database that will be used in this project. Select the &lt;b&gt;Solution Name&lt;/b&gt;, right click, select &lt;b&gt;Add&lt;/b&gt; then &lt;b&gt;New Item&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-ssCU9oDkVDU/TZQBJ0jeibI/AAAAAAAAAYg/J-k59AmSIB0/s1600/picture_4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="180" src="http://4.bp.blogspot.com/-ssCU9oDkVDU/TZQBJ0jeibI/AAAAAAAAAYg/J-k59AmSIB0/s320/picture_4.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 5&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;When the window dialog appears select &lt;b&gt;Data&lt;/b&gt; and &lt;b&gt;SQL Server Database&lt;/b&gt;. Name your database &lt;b&gt;Student.mdf&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-xSDflwjd86U/TZQBLZmoFfI/AAAAAAAAAYk/12IRae6uapE/s1600/picture_5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="222" src="http://1.bp.blogspot.com/-xSDflwjd86U/TZQBLZmoFfI/AAAAAAAAAYk/12IRae6uapE/s320/picture_5.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 6&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Click &lt;b&gt;Yes&lt;/b&gt; on confirming dialog.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-wHmGyt7rLM0/TZQBMynbrpI/AAAAAAAAAYo/oRSbWjNc09s/s1600/picture_6.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="127" src="http://3.bp.blogspot.com/-wHmGyt7rLM0/TZQBMynbrpI/AAAAAAAAAYo/oRSbWjNc09s/s320/picture_6.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 7&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;On &lt;b&gt;Solution Explorer&lt;/b&gt; you will see a new folder &lt;b&gt;App_Data&lt;/b&gt; with 2 files inside it. They are &lt;b&gt;Student.mdf&lt;/b&gt; and &lt;b&gt;Student.ldf&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-J5GInGrZxHQ/TZQBOU8IXnI/AAAAAAAAAYs/Hw9vS7fIH7w/s1600/picture_7.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="282" src="http://4.bp.blogspot.com/-J5GInGrZxHQ/TZQBOU8IXnI/AAAAAAAAAYs/Hw9vS7fIH7w/s320/picture_7.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 8&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Double click on &lt;b&gt;Student.mdf&lt;/b&gt; and the &lt;b&gt;Database Explorer&lt;/b&gt; will appear.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-wCExz4DkPeI/TZQBP1wQ1VI/AAAAAAAAAYw/Hu05-wSLutg/s1600/picture_8.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="229" src="http://3.bp.blogspot.com/-wCExz4DkPeI/TZQBP1wQ1VI/AAAAAAAAAYw/Hu05-wSLutg/s320/picture_8.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 9&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;The next step is to create &lt;b&gt;Student&lt;/b&gt; table which then will be used to keep the information when we test the program. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-icjW2Z9Y-hc/TZQBRwMjU_I/AAAAAAAAAY0/5XynE4koM9o/s1600/picture_9.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="176" src="http://4.bp.blogspot.com/-icjW2Z9Y-hc/TZQBRwMjU_I/AAAAAAAAAY0/5XynE4koM9o/s320/picture_9.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 10&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;The table consists of 4 fields. &lt;b&gt;ID&lt;/b&gt; which is an integer , auto incremented identity (Picture 11 - 15) and set as a primary key. Others are &lt;b&gt;Firstname&lt;/b&gt;,&lt;b&gt;Lastname&lt;/b&gt; and &lt;b&gt;Age&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-3M6lIOxVJ24/TZQBUJ1ZiYI/AAAAAAAAAY4/GDhdad1eDHk/s1600/picture_10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="85" src="http://3.bp.blogspot.com/-3M6lIOxVJ24/TZQBUJ1ZiYI/AAAAAAAAAY4/GDhdad1eDHk/s320/picture_10.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 11&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-5NvyukDMQ1I/TZQBXTJx4eI/AAAAAAAAAY8/5FXAhw2jX0I/s1600/picture_11.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="119" src="http://3.bp.blogspot.com/-5NvyukDMQ1I/TZQBXTJx4eI/AAAAAAAAAY8/5FXAhw2jX0I/s320/picture_11.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 12&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-sWRmXYTTeBc/TZRGofnh13I/AAAAAAAAAZA/1O-IPqR-eJI/s1600/picture_12.jpg" imageanchor="1"&gt;&lt;img border="0" height="100" src="http://1.bp.blogspot.com/-sWRmXYTTeBc/TZRGofnh13I/AAAAAAAAAZA/1O-IPqR-eJI/s200/picture_12.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 13&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-ZaN1-tjLKxI/TZRG0BnczxI/AAAAAAAAAZI/BAf1UiHucDs/s1600/picture_13.jpg" imageanchor="1"&gt;&lt;img border="0" height="52" src="http://3.bp.blogspot.com/-ZaN1-tjLKxI/TZRG0BnczxI/AAAAAAAAAZI/BAf1UiHucDs/s200/picture_13.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 14&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-creboDbHnbg/TZRG_VNFVPI/AAAAAAAAAZQ/uco1Qk7MAss/s1600/picture_14.jpg" imageanchor="1"&gt;&lt;img border="0" height="84" src="http://1.bp.blogspot.com/-creboDbHnbg/TZRG_VNFVPI/AAAAAAAAAZQ/uco1Qk7MAss/s200/picture_14.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 15&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-W5_L4uRZ680/TZRHRC-yCBI/AAAAAAAAAZY/IWNnJAz2WB4/s1600/picture_15.jpg" imageanchor="1"&gt;&lt;img border="0" height="77" src="http://1.bp.blogspot.com/-W5_L4uRZ680/TZRHRC-yCBI/AAAAAAAAAZY/IWNnJAz2WB4/s200/picture_15.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 16&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;After &lt;b&gt;Student&lt;/b&gt; is created, you need to create a data access to read and write the information into that table. Select &lt;b&gt;Models&lt;/b&gt; folder on &lt;b&gt;Solution Explorer&lt;/b&gt;, right click and select &lt;b&gt;Add&lt;/b&gt; then &lt;b&gt;New Item&lt;/b&gt;. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-KlkuGjgCRYA/TZRHpopm7SI/AAAAAAAAAZg/y7C1W4Ys2SA/s1600/picture_16.jpg" imageanchor="1"&gt;&lt;img border="0" height="104" src="http://3.bp.blogspot.com/-KlkuGjgCRYA/TZRHpopm7SI/AAAAAAAAAZg/y7C1W4Ys2SA/s200/picture_16.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 17&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-Crho2bL6nKI/TZRH2NIy_MI/AAAAAAAAAZo/WBCVJJnTGL4/s1600/picture_17.jpg" imageanchor="1"&gt;&lt;img border="0" height="138" src="http://1.bp.blogspot.com/-Crho2bL6nKI/TZRH2NIy_MI/AAAAAAAAAZo/WBCVJJnTGL4/s200/picture_17.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 18&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;When the window dialog appears, select &lt;b&gt;Data&lt;/b&gt; and &lt;b&gt;LINQ to SQL Classes&lt;/b&gt;. Name our datasource as &lt;b&gt;StudentDB.dbml&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-j1HqVVKqJfA/TZRICslva3I/AAAAAAAAAZw/1CqnLZE2Ie0/s1600/picture_18.jpg" imageanchor="1"&gt;&lt;img border="0" height="168" src="http://4.bp.blogspot.com/-j1HqVVKqJfA/TZRICslva3I/AAAAAAAAAZw/1CqnLZE2Ie0/s200/picture_18.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 19&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;After &lt;b&gt;StudentDB.dbml&lt;/b&gt; has been created, another window will appears. Select &lt;b&gt;Database Explorer&lt;/b&gt;. Drag the &lt;b&gt;Student&lt;/b&gt; table from &lt;b&gt;Database Explorer&lt;/b&gt; to this window. The &lt;b&gt;Student&lt;/b&gt; class diagram then is created.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-8IvCOBxy65o/TZRIOqd1fGI/AAAAAAAAAZ4/uIaToNt8GY0/s1600/picture_19.jpg" imageanchor="1"&gt;&lt;img border="0" height="169" src="http://2.bp.blogspot.com/-8IvCOBxy65o/TZRIOqd1fGI/AAAAAAAAAZ4/uIaToNt8GY0/s200/picture_19.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 20&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;On &lt;b&gt;Solution Explorer&lt;/b&gt; you can see new files have been created inside &lt;b&gt;Models&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-pq8hzFipJMo/TZRIZeldRvI/AAAAAAAAAaA/R4X23qinHMs/s1600/picture_20.jpg" imageanchor="1"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-pq8hzFipJMo/TZRIZeldRvI/AAAAAAAAAaA/R4X23qinHMs/s200/picture_20.jpg" width="186" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 21&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Now, click on &lt;b&gt;Controllers&lt;/b&gt; folder.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-kGaYpQ6a3E0/TZRIlRJiyjI/AAAAAAAAAaI/G5_8wcvO07Q/s1600/picture_21.jpg" imageanchor="1"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-kGaYpQ6a3E0/TZRIlRJiyjI/AAAAAAAAAaI/G5_8wcvO07Q/s200/picture_21.jpg" width="92" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 22&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Right click , select &lt;b&gt;Add&lt;/b&gt; and &lt;b&gt;Controller&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-gozq2hakZeU/TZRIxMKrZbI/AAAAAAAAAaQ/xQ_cdl-3nuA/s1600/picture_22.jpg" imageanchor="1"&gt;&lt;img border="0" height="184" src="http://2.bp.blogspot.com/-gozq2hakZeU/TZRIxMKrZbI/AAAAAAAAAaQ/xQ_cdl-3nuA/s200/picture_22.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 23&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Name our new &lt;b&gt;Controller&lt;/b&gt; as &lt;b&gt;StudentController&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-6SU_tM7ou90/TZRI6-0FU-I/AAAAAAAAAaY/Hw7xgEA_v2A/s1600/picture_23.jpg" imageanchor="1"&gt;&lt;img border="0" height="81" src="http://3.bp.blogspot.com/-6SU_tM7ou90/TZRI6-0FU-I/AAAAAAAAAaY/Hw7xgEA_v2A/s200/picture_23.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 24&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-3iUoLXMujwY/TZRKGoDGZQI/AAAAAAAAAao/1VJF-1A3l9E/s1600/picture_25.jpg" imageanchor="1"&gt;&lt;img border="0" height="161" src="http://3.bp.blogspot.com/-3iUoLXMujwY/TZRKGoDGZQI/AAAAAAAAAao/1VJF-1A3l9E/s200/picture_25.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 25&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;If you open &lt;b&gt;StudentController.cs&lt;/b&gt; you will see that by default &lt;b&gt;Index&lt;/b&gt; function is created by &lt;b&gt;Visual Studio&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-HY5iI468Qek/TZRKRpF2XoI/AAAAAAAAAaw/Gld1Hi3a270/s1600/picture_26.jpg" imageanchor="1"&gt;&lt;img border="0" height="139" src="http://3.bp.blogspot.com/-HY5iI468Qek/TZRKRpF2XoI/AAAAAAAAAaw/Gld1Hi3a270/s200/picture_26.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 26&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Then we need to create a &lt;b&gt;View&lt;/b&gt; to display the &lt;b&gt;Index&lt;/b&gt; page of the &lt;b&gt;StudenController&lt;/b&gt;. Focus your mouse on &lt;b&gt;Views&lt;/b&gt; folder, right click , select &lt;b&gt;Add&lt;/b&gt;, &lt;b&gt;New Folder&lt;/b&gt; and name that new folder as &lt;b&gt;Student&lt;/b&gt;. Actually the name &lt;b&gt;Student&lt;/b&gt; was taken from the &lt;b&gt;StudentController&lt;/b&gt; name. If later on you create &lt;b&gt;ExamResultController&lt;/b&gt;, you need to name the next new folder as &lt;b&gt;ExamResult&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-0UxlcxrFyZM/TZRKV6OCQxI/AAAAAAAAAa4/JMUAg3M6YEI/s1600/picture_27.jpg" imageanchor="1"&gt;&lt;img border="0" height="122" src="http://4.bp.blogspot.com/-0UxlcxrFyZM/TZRKV6OCQxI/AAAAAAAAAa4/JMUAg3M6YEI/s200/picture_27.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 27&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-jGMyO9xPPZU/TZRKZt76UQI/AAAAAAAAAbA/9JGk823zark/s1600/picture_28.jpg" imageanchor="1"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-jGMyO9xPPZU/TZRKZt76UQI/AAAAAAAAAbA/9JGk823zark/s200/picture_28.jpg" width="165" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 28&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Now we need to add a new view page in &lt;b&gt;Student&lt;/b&gt; folder.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-HmL3gzy9ce8/TZRKdi4XguI/AAAAAAAAAbI/Ys-96OmFdBc/s1600/picture_29.jpg" imageanchor="1"&gt;&lt;img border="0" height="130" src="http://4.bp.blogspot.com/-HmL3gzy9ce8/TZRKdi4XguI/AAAAAAAAAbI/Ys-96OmFdBc/s200/picture_29.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 29&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;At the time you add new view page, the window dialog will appear. Put &lt;b&gt;Index&lt;/b&gt; in &lt;b&gt;View Name&lt;/b&gt; text box. This given name is corresponded to the &lt;b&gt;Index&lt;/b&gt; function name we found on &lt;b&gt;StudentController.cs&lt;/b&gt; as seen on &lt;b&gt;Picture 26&lt;/b&gt;. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Visual Studio&lt;/b&gt; provides 2 view engine you can choose from. One is &lt;b&gt;Razor&lt;/b&gt; and the other one is &lt;b&gt;ASPX&lt;/b&gt;. Lets try the &lt;b&gt;Razor&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Because we are going to use this view to post a new student information to database, we should select the &lt;b&gt;Student&lt;/b&gt; data model.&lt;br /&gt;&lt;br /&gt;Next is to select &lt;b&gt;Create&lt;/b&gt; template then tick on &lt;b&gt;Create as a partial view&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-rTeCd2VXu5Y/TZRKh12TRZI/AAAAAAAAAbQ/qrhLaxMsFL0/s1600/picture_30.jpg" imageanchor="1"&gt;&lt;img border="0" height="196" src="http://1.bp.blogspot.com/-rTeCd2VXu5Y/TZRKh12TRZI/AAAAAAAAAbQ/qrhLaxMsFL0/s200/picture_30.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 30&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Index.cshtml&lt;/b&gt; has been created.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-INqssZsNZz8/TZRKmgvySXI/AAAAAAAAAbY/0ZWSpqgrhF8/s1600/picture_31.jpg" imageanchor="1"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-INqssZsNZz8/TZRKmgvySXI/AAAAAAAAAbY/0ZWSpqgrhF8/s200/picture_31.jpg" width="158" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 31&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Double click on our new view page and remove the bottom part of the code as seen in the red cicle on the picture below.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-PDI5P-ruEa8/TZRKqI4vp7I/AAAAAAAAAbg/ay_S9pNFS2E/s1600/picture_32.jpg" imageanchor="1"&gt;&lt;img border="0" height="176" src="http://2.bp.blogspot.com/-PDI5P-ruEa8/TZRKqI4vp7I/AAAAAAAAAbg/ay_S9pNFS2E/s200/picture_32.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 32&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Open your &lt;b&gt;Global.asa&lt;/b&gt;. &lt;b&gt;Picture 33&lt;/b&gt; shows by default the web site is routed to &lt;b&gt;Index&lt;/b&gt; view page in &lt;b&gt;Home&lt;/b&gt; controller.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-q5ZB1i7rxYw/TZRKvxd2n3I/AAAAAAAAAbo/Fwr2X28USxw/s1600/picture_33.jpg" imageanchor="1"&gt;&lt;img border="0" height="53" src="http://4.bp.blogspot.com/-q5ZB1i7rxYw/TZRKvxd2n3I/AAAAAAAAAbo/Fwr2X28USxw/s200/picture_33.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 33&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Rename &lt;b&gt;Home&lt;/b&gt; to &lt;b&gt;Student&lt;/b&gt; because in this project &lt;b&gt;StudentController&lt;/b&gt; is the only controller we have.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-kFXkNcEb5rA/TZRK3IC3OGI/AAAAAAAAAbw/kddTqSh-OMs/s1600/picture_34.jpg" imageanchor="1"&gt;&lt;img border="0" height="49" src="http://2.bp.blogspot.com/-kFXkNcEb5rA/TZRK3IC3OGI/AAAAAAAAAbw/kddTqSh-OMs/s200/picture_34.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 34&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Run the project. The &lt;b&gt;Index&lt;/b&gt; is working.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-eeXC3z7M4u8/TZRMQSA0sPI/AAAAAAAAAb4/DNwvN2L6uik/s1600/picture_35.jpg" imageanchor="1"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-eeXC3z7M4u8/TZRMQSA0sPI/AAAAAAAAAb4/DNwvN2L6uik/s200/picture_35.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 35&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Eventhough our &lt;b&gt;Index&lt;/b&gt; is working already, it doesn't means it is ready to be used to post a new student detail.&lt;br /&gt;&lt;br /&gt;Open &lt;b&gt;StudentController.cs&lt;/b&gt; which is located in &lt;b&gt;Controllers&lt;/b&gt; folder. We need to add an overloading method which receives &lt;b&gt;Student&lt;/b&gt; object. &lt;b&gt;Picture 36&lt;/b&gt; shows that we now have the second &lt;b&gt;Index&lt;/b&gt; method. The differences between the second and the first one are , the second starts with &lt;b&gt;HTTPPost&lt;/b&gt; attribute line which basically telling the compiler than anything that is posted from &lt;b&gt;Index&lt;/b&gt; view page will be processed by this method. The second one is the input parameter as i mentioned before.&lt;br /&gt;&lt;br /&gt;Inside the second &lt;b&gt;Index&lt;/b&gt; method, you can see how the new &lt;b&gt;Student&lt;/b&gt; object is saved into the database.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-bLDyeVQAofk/TZRMsVwD9UI/AAAAAAAAAcA/9z1STEHh-Tc/s1600/picture_36.jpg" imageanchor="1"&gt;&lt;img border="0" height="118" src="http://3.bp.blogspot.com/-bLDyeVQAofk/TZRMsVwD9UI/AAAAAAAAAcA/9z1STEHh-Tc/s200/picture_36.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 36&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Lets try to post a new student detail. I used &lt;b&gt;Joe Harding&lt;/b&gt; as dummy student detail.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-x0iWeSzDbYU/TZRM0XOhe9I/AAAAAAAAAcI/bLANZA8n4Y0/s1600/picture_37.jpg" imageanchor="1"&gt;&lt;img border="0" height="199" src="http://1.bp.blogspot.com/-x0iWeSzDbYU/TZRM0XOhe9I/AAAAAAAAAcI/bLANZA8n4Y0/s200/picture_37.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 37&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;After submitting the new student detail , now lets open your &lt;b&gt;Database Explorer&lt;/b&gt;. Open the &lt;b&gt;Student&lt;/b&gt; table and shows the data.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-x4_FMnVfino/TZRM48351LI/AAAAAAAAAcQ/gAave4iV_fs/s1600/picture_38.jpg" imageanchor="1"&gt;&lt;img border="0" height="172" src="http://3.bp.blogspot.com/-x4_FMnVfino/TZRM48351LI/AAAAAAAAAcQ/gAave4iV_fs/s200/picture_38.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 38&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;We just successfuly recorded a new &lt;b&gt;Student&lt;/b&gt; detail into our database by using &lt;b&gt;MVC 3&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-lfwYITXilvA/TZRM9n2kv6I/AAAAAAAAAcY/c6J_lGzyWho/s1600/picture_39.jpg" imageanchor="1"&gt;&lt;img border="0" height="48" src="http://1.bp.blogspot.com/-lfwYITXilvA/TZRM9n2kv6I/AAAAAAAAAcY/c6J_lGzyWho/s200/picture_39.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;Picture 39&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20110330/StudentMVC.rar"&gt;Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-614632420438986530?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/614632420438986530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/my-first-mvc-3-project.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/614632420438986530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/614632420438986530'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/my-first-mvc-3-project.html' title='My First MVC 3 Project'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-GrXPvVruDnU/TZQBEwRL5mI/AAAAAAAAAYQ/OSFo0PVDi3Q/s72-c/picture_0.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-5036234233424052322</id><published>2011-03-15T22:01:00.000-07:00</published><updated>2011-04-05T19:52:39.953-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='JQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Protect Your Password with Popped Up Keyboard</title><content type='html'>&lt;table&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Have ever heard trojan virus that could steal your password while you are logging in to your online internet banking  ? Basically that virus contains a routine that detecting any keystroke you type on login page and send it to the hackers computer. The hacker would use that password to break in into your online account and rip you off.&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-zp1G6G8oXms/TYBDwSkz8PI/AAAAAAAAAXQ/N2kxoJf0gV0/s1600/picture_0.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="124" width="200" src="http://3.bp.blogspot.com/-zp1G6G8oXms/TYBDwSkz8PI/AAAAAAAAAXQ/N2kxoJf0gV0/s200/picture_0.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 1&lt;/b&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;So, i have an idea to create a JQuery plug in to anticipate this issue. I copied this idea from Westpac Internet Banking. It is a popped up keyboard which would appear at the time the user focus their mouse on the password text box.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-bkCce1oK8jI/TYBD0BoeeXI/AAAAAAAAAXY/6AGttWJVmAo/s1600/picture_1.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="200" width="180" src="http://1.bp.blogspot.com/-bkCce1oK8jI/TYBD0BoeeXI/AAAAAAAAAXY/6AGttWJVmAo/s200/picture_1.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 2&lt;/b&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Instead of typing ,this popped up keyboard only allows the user to use their mouse to click. By this way we have deceived the trojan virus that may be running on user computer. That virus won't get anything.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-_feDJHYrJd0/TYBFrLDMseI/AAAAAAAAAXg/IDESTTeYEes/s1600/picture_2.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="34" width="200" src="http://3.bp.blogspot.com/-_feDJHYrJd0/TYBFrLDMseI/AAAAAAAAAXg/IDESTTeYEes/s200/picture_2.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 3&lt;/b&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-KbxHs25Padk/TYBF7Znc6qI/AAAAAAAAAXo/3QBrpftjEgI/s1600/picture_3.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="108" width="200" src="http://4.bp.blogspot.com/-KbxHs25Padk/TYBF7Znc6qI/AAAAAAAAAXo/3QBrpftjEgI/s200/picture_3.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 4&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20110317/keyboard.rar"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-5036234233424052322?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/5036234233424052322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/protect-your-password-with-popped-up.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/5036234233424052322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/5036234233424052322'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/protect-your-password-with-popped-up.html' title='Protect Your Password with Popped Up Keyboard'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-zp1G6G8oXms/TYBDwSkz8PI/AAAAAAAAAXQ/N2kxoJf0gV0/s72-c/picture_0.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-3764598929186185691</id><published>2011-03-08T20:37:00.000-08:00</published><updated>2011-03-15T02:44:59.087-07:00</updated><title type='text'>Singleton Pattern, The Example</title><content type='html'>&lt;table&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Singleton&lt;/b&gt; pattern is used when we want to create the only instant of the a class that can be accessed globally within the application. The implementation of &lt;b&gt;Singleton&lt;/b&gt; pattern can be found on Menu. Menu is shared and accessed from any part of the program. &lt;b&gt;Singleton&lt;/b&gt; guarantees that all part of the application is refering to the same and the only menu.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-b-K8exscByc/TX1ufQbQA-I/AAAAAAAAAW4/jFfc17kvN-k/s1600/picture_0.jpg" imageanchor="1"&gt;&lt;img border="0" height="200" width="154" src="http://1.bp.blogspot.com/-b-K8exscByc/TX1ufQbQA-I/AAAAAAAAAW4/jFfc17kvN-k/s200/picture_0.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 1&lt;/b&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;In this example, i created the scenario where the company information needs to be shared across the application, such as for drop down list etc. So, rather than letting the application to repeatedly read the database to get the company information, i used &lt;b&gt;Singleton&lt;/b&gt; to read it once and share it other parts of the programs when they need it.&lt;br /&gt;&lt;br /&gt;To create a singleton class, i set the constructor to be private (see &lt;b&gt;Picture 1&lt;/b&gt;). That means i prevented the &lt;b&gt;LookUp&lt;/b&gt; class to be instantiated directly. Then the second i did was to create a public method that return a static private instant of the class. Everytime this method is called, it will check if there is any instant of the class has been created before. If not, it would create a new instant. Otherwise, it would return the existing one.&lt;br /&gt;&lt;br /&gt;To make sure this singleton stays working as it is supposed to be even in multithreaded scenario,i used &lt;b&gt;lock&lt;/b&gt;.&lt;b&gt;lock&lt;/b&gt; is a function to syncronize the call from different threads. It behaves like a traffic light that allows every single thread to have its own turn, one after another.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-cusFuupfxJw/TX1ujPrJccI/AAAAAAAAAXA/osQDJFuMoeI/s1600/picture_1.jpg" imageanchor="1"&gt;&lt;img border="0" height="82" width="200" src="http://1.bp.blogspot.com/-cusFuupfxJw/TX1ujPrJccI/AAAAAAAAAXA/osQDJFuMoeI/s200/picture_1.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 2&lt;/b&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;To test my singleton class, i created two instant variable. One is &lt;b&gt;m_first&lt;/b&gt; and the other one is &lt;b&gt;m_second&lt;/b&gt; (see &lt;b&gt;picture 2&lt;/b&gt;).Both will get a &lt;b&gt;LookUp&lt;/b&gt; instant after the &lt;b&gt;getInstance&lt;/b&gt; method is called. An this method requires one input parameter that is used for indicator only. It will indicate which call that actually creates the instant. &lt;br /&gt;&lt;br /&gt;Another method is &lt;b&gt;Print&lt;/b&gt;. When it is executed it will show the caller and all company information read from the database.&lt;br /&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-6NRbgJ0kD6A/TX1umZ2MebI/AAAAAAAAAXI/RSdZ3E52xwA/s1600/picture_2.jpg" imageanchor="1"&gt;&lt;img border="0" height="200" width="117" src="http://1.bp.blogspot.com/-6NRbgJ0kD6A/TX1umZ2MebI/AAAAAAAAAXI/RSdZ3E52xwA/s200/picture_2.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 3&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;As you can see on above picture, the second call didn't create a new instant but return the already existing one.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20110308/Singleton.rar"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-3764598929186185691?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/3764598929186185691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/singleton-pattern-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3764598929186185691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3764598929186185691'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/singleton-pattern-example.html' title='Singleton Pattern, The Example'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-b-K8exscByc/TX1ufQbQA-I/AAAAAAAAAW4/jFfc17kvN-k/s72-c/picture_0.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-7210080280137831959</id><published>2011-03-06T18:58:00.001-08:00</published><updated>2011-03-07T18:44:18.506-08:00</updated><title type='text'>Prototype Pattern,The Example</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Prototype&lt;/b&gt; pattern is about creating one instant of object and then use that object to create a clone of that object. So, if &lt;b&gt;Banana&lt;/b&gt; is a class, you just need to create one instant of &lt;b&gt;Banana&lt;/b&gt;, and clone that instant to create the second one and so forth. Some said it would reduce the object initialization time, compared when we create an instant using &lt;b&gt;new&lt;/b&gt; statement.&lt;br /&gt;&lt;br /&gt;There are two type &lt;b&gt;Prototype&lt;/b&gt; pattern. One is &lt;b&gt;shallow&lt;/b&gt; prototyping and the other one is &lt;b&gt;deep&lt;/b&gt; prototyping. On &lt;b&gt;Shallow&lt;/b&gt; prototyping it only clones the parent object but not any aggregated object inside it. So, it there is an object called &lt;b&gt;FarmDetail&lt;/b&gt; inside &lt;b&gt;Banana&lt;/b&gt;,that object will not be cloned.&lt;br /&gt;&lt;br /&gt;In the other hand, on &lt;b&gt;Deep&lt;/b&gt; prototyping, it will clone everything, including all aggregated objects inside that instant. On our scenario as seen on &lt;b&gt;Picture 1&lt;/b&gt; below, the aggregated object is &lt;b&gt;Result&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh4.googleusercontent.com/-NG6W0iRD3qg/TXROSNmHBKI/AAAAAAAAAWY/2rPL7yIs9SM/s1600/picture_1.jpg" imageanchor="1"&gt;&lt;img border="0" height="320" src="https://lh4.googleusercontent.com/-NG6W0iRD3qg/TXROSNmHBKI/AAAAAAAAAWY/2rPL7yIs9SM/s320/picture_1.jpg" width="234" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 1&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;In .NET we use &lt;b&gt;MemberwiseClone&lt;/b&gt; to create a clone of the current instant as seen on &lt;b&gt;Picture 2&lt;/b&gt;. But to clone complex object, it is a good way to use &lt;b&gt;BinaryFormatter&lt;/b&gt; as seen on &lt;b&gt;Picture 4&lt;/b&gt;.&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh3.googleusercontent.com/-WZNj1GpW-9I/TXROWb2lzmI/AAAAAAAAAWc/dynawnf9dXU/s1600/picture_2.jpg" imageanchor="1"&gt;&lt;img border="0" height="92" src="https://lh3.googleusercontent.com/-WZNj1GpW-9I/TXROWb2lzmI/AAAAAAAAAWc/dynawnf9dXU/s320/picture_2.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 2&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh6.googleusercontent.com/-mauRSsp7OxA/TXROQQSMb-I/AAAAAAAAAWU/WNYF64HLVtc/s1600/picture_0.jpg" imageanchor="1"&gt;&lt;img border="0" height="320" src="https://lh6.googleusercontent.com/-mauRSsp7OxA/TXROQQSMb-I/AAAAAAAAAWU/WNYF64HLVtc/s320/picture_0.jpg" width="235" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 3&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh3.googleusercontent.com/-VZtLupWrMgE/TXROXfWFK8I/AAAAAAAAAWg/cgAVc9P2czM/s1600/picture_3.jpg" imageanchor="1"&gt;&lt;img border="0" height="132" src="https://lh3.googleusercontent.com/-VZtLupWrMgE/TXROXfWFK8I/AAAAAAAAAWg/cgAVc9P2czM/s320/picture_3.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 4&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;The implementation of this pattern can be seen on &lt;b&gt;Picture 5&lt;/b&gt; below. Instead of creating a new instant by using &lt;b&gt;new&lt;/b&gt; statement repeatedly, we only need to do it once. The instant we have created then is used as a master copy to create another instant by cloning.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-baJCEW0PVas/TXWTH17aD6I/AAAAAAAAAWo/iwL3IVnWmVQ/s1600/cats-crop.jpg" imageanchor="1"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/-baJCEW0PVas/TXWTH17aD6I/AAAAAAAAAWo/iwL3IVnWmVQ/s200/cats-crop.jpg" width="169" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 5&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-G9g9AeowQcU/TXWTYLCAVII/AAAAAAAAAWw/FGkEltcSqIM/s1600/ohi.jpg" imageanchor="1"&gt;&lt;img border="0" height="84" src="http://4.bp.blogspot.com/-G9g9AeowQcU/TXWTYLCAVII/AAAAAAAAAWw/FGkEltcSqIM/s200/ohi.jpg" width="200" /&gt;&lt;/a&gt;  &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Picture 6&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20110307/PrototypePattern.rar"&gt;Source&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-7210080280137831959?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/7210080280137831959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/prototype-patternthe-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/7210080280137831959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/7210080280137831959'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/prototype-patternthe-example.html' title='Prototype Pattern,The Example'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh4.googleusercontent.com/-NG6W0iRD3qg/TXROSNmHBKI/AAAAAAAAAWY/2rPL7yIs9SM/s72-c/picture_1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-3320970457168991081</id><published>2011-03-05T03:26:00.001-08:00</published><updated>2011-03-06T02:57:57.713-08:00</updated><title type='text'>Factory Pattern , The Example</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;From my understanding &lt;b&gt;Design Pattern&lt;/b&gt; is a technique in programming to reduce recreation of duplicated methods or functionalities. Sometimes when we develop a huge program we unintentionally create a duplicated methods in our codes.When the program get bigger,it is like a jungle.It makes us hard to see the specific objects we are looking for. If it keeps going like this,on and on,we would face a risk of loosing productivity. It would make us difficult to fix bugs as it happens.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Design Pattern&lt;/b&gt; also brings a significant quality for the code we write. It makes the program more efficiently compiled and debugged.It also possibly improve the performance of program as a whole when it runs.&lt;br /&gt;&lt;br /&gt;This article is about &lt;b&gt;Factory&lt;/b&gt; pattern. It is named &lt;b&gt;Factory&lt;/b&gt; because the way it operates is like a factory in real world. Factory produces things based on the incoming orders. And that orders could be repeatedly the same one, or could be not.&lt;br /&gt;&lt;br /&gt;Just like in our community.Just assume every family eat bread. They could or couldn't eat the same type of bread. But rather than letting every family makes their own bread which is time consuming, why don't we just create a factory to serve their needs. The factory that provides any type of breads those family needs. &lt;br /&gt;&lt;br /&gt;The same way happens in programming. &lt;b&gt;Picture 4&lt;/b&gt; shows how the &lt;b&gt;GetStudent&lt;/b&gt; function behaves like a factory.  When other part of the program wants an instant of &lt;b&gt;LocalStudent&lt;/b&gt;, it would give that instant. When the other part of the program wants an instant of &lt;b&gt;OverseasStudent&lt;/b&gt;,it would get it. It could happen repeatedly on rest of the program.&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh6.googleusercontent.com/-iSvFsW8upuY/TXIfzUq6SlI/AAAAAAAAAVc/t3oTSRB-5E8/s1600/picture_0.jpg" imageanchor="1"&gt;&lt;img border="0" src="https://lh6.googleusercontent.com/-iSvFsW8upuY/TXIfzUq6SlI/AAAAAAAAAVc/t3oTSRB-5E8/s1600/picture_0.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Picture 1&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;In this example, i used student scenario. Just assume we are developing an application for a school to record and process students registration. And the students are devided into 2 groups, local and overseas. Both share some similar properties such as student id and fullname. But both also have their own unique properties as you can see on picture 3 and 4.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh6.googleusercontent.com/-7oEccvBYgio/TXIf0YA-UFI/AAAAAAAAAVg/JTyYBH_f6A4/s1600/picture_1.jpg" imageanchor="1"&gt;&lt;img border="0" height="320" src="https://lh6.googleusercontent.com/-7oEccvBYgio/TXIf0YA-UFI/AAAAAAAAAVg/JTyYBH_f6A4/s320/picture_1.jpg" width="184" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Picture 2&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Student&lt;/b&gt; is our based class. It implements &lt;b&gt;Print&lt;/b&gt; method from &lt;b&gt;IPrint&lt;/b&gt; interface. It also holds common properties that are derived by &lt;b&gt;LocalStudent&lt;/b&gt; and &lt;b&gt;OverseasStudent&lt;/b&gt;.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh5.googleusercontent.com/-7HcpGychiRg/TXIgG1wLKtI/AAAAAAAAAVk/pAzJ3xaddD0/s1600/picture_2.jpg" imageanchor="1"&gt;&lt;img border="0" height="271" src="https://lh5.googleusercontent.com/-7HcpGychiRg/TXIgG1wLKtI/AAAAAAAAAVk/pAzJ3xaddD0/s320/picture_2.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Picture 3&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;b&gt;LocalStudent&lt;/b&gt; class its own unique property, &lt;b&gt;BirthCertificateNo&lt;/b&gt;. In this scenario, when the school staff registers the new student,he/she must get the birthcertificate number from the candidate student if that person claims to be a local.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh5.googleusercontent.com/-zYkCrcw0CJ4/TXMBmebMz3I/AAAAAAAAAWQ/xKQCOHt_IsU/s1600/asdf.jpg" imageanchor="1"&gt;&lt;img border="0" height="320" src="https://lh5.googleusercontent.com/-zYkCrcw0CJ4/TXMBmebMz3I/AAAAAAAAAWQ/xKQCOHt_IsU/s320/asdf.jpg" width="313" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Picture 4&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;If the candidate student is not from local, he/she must provides two informations : his/her country of origin and his/her passport number.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh5.googleusercontent.com/-_AN7etPSPF4/TXMA9f4YhhI/AAAAAAAAAWM/smXLti0b840/s1600/cats-crop.jpg" imageanchor="1"&gt;&lt;img border="0" height="86" src="https://lh5.googleusercontent.com/-_AN7etPSPF4/TXMA9f4YhhI/AAAAAAAAAWM/smXLti0b840/s320/cats-crop.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Picture 5&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 5&lt;/b&gt; shows &lt;b&gt;Factory&lt;/b&gt; pattern from implementation perspective. Anytime we want to get any instant from both &lt;b&gt;LocalStudent&lt;/b&gt; or &lt;b&gt;OverseasStudent&lt;/b&gt;,we just need to pass in the corresponding parameter. Even, in the future if another group of student is created this pattern would serve well.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-_8i2FNKUid0/TXIjE5lA7HI/AAAAAAAAAV0/LDfF9jbyPjM/s1600/picture_5.jpg" imageanchor="1"&gt;&lt;img border="0" height="112" src="http://4.bp.blogspot.com/-_8i2FNKUid0/TXIjE5lA7HI/AAAAAAAAAV0/LDfF9jbyPjM/s200/picture_5.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Picture 6&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-95Hxxo1A3Wk/TXIjJdI2TVI/AAAAAAAAAV8/FUwmubfnVT4/s1600/picture_6.jpg" imageanchor="1"&gt;&lt;img border="0" height="101" src="http://4.bp.blogspot.com/-95Hxxo1A3Wk/TXIjJdI2TVI/AAAAAAAAAV8/FUwmubfnVT4/s200/picture_6.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Picture 7&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20110305/FactoryPattern.rar"&gt;Source&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-3320970457168991081?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/3320970457168991081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/factory-pattern-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3320970457168991081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3320970457168991081'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/factory-pattern-example.html' title='Factory Pattern , The Example'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh6.googleusercontent.com/-iSvFsW8upuY/TXIfzUq6SlI/AAAAAAAAAVc/t3oTSRB-5E8/s72-c/picture_0.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-3283460262185322261</id><published>2011-03-04T02:25:00.001-08:00</published><updated>2011-03-04T22:50:24.734-08:00</updated><title type='text'>Creating Derived Class From LIST Generic Collection To Suit Your Need</title><content type='html'>&lt;table cellpadding="0" cellspacing="0"&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;I like &lt;b&gt;List&lt;/b&gt; so much because it is easy to be used. It has several very useful method such as &lt;b&gt;Find&lt;/b&gt; method. This method allows us to find a specific item in the collection without the need to create a loop.&lt;br /&gt;&lt;br /&gt;In this opportunity i want to create a derived class from &lt;b&gt;List&lt;/b&gt; and gives some additional methods on it. To start ,we need to create a scenario. This example is about &lt;b&gt;T Shirt&lt;/b&gt;. On picture 1 i have created a &lt;b&gt;TShirt&lt;/b&gt; which contains several properties.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh3.googleusercontent.com/-qDv3OckInuM/TXDCLEsa2qI/AAAAAAAAAVE/EThAyGiUaOI/s1600/picture_0.jpg" imageanchor="1"&gt;&lt;img border="0" height="113" src="https://lh3.googleusercontent.com/-qDv3OckInuM/TXDCLEsa2qI/AAAAAAAAAVE/EThAyGiUaOI/s320/picture_0.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="display:block;font-weight:bold;"&gt;Picture 1&lt;/span&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Then i created a derived class. I named it &lt;b&gt;MyList&lt;/b&gt;. As you can see on &lt;b&gt;Picture 2&lt;/b&gt;, because &lt;b&gt;List&lt;/b&gt; is a covariant class,so i declared &lt;b&gt;MyList&lt;/b&gt; the same way, which is with suffix &lt;b&gt;&amp;lt;T&amp;gt;&lt;/b&gt;. And because we are going to use this new collection class for &lt;b&gt;TShirt&lt;/b&gt; objects only so we need additional information &lt;b&gt;where &amp;lt;T&amp;gt;:TShirt&lt;/b&gt; at the end of the class declaration.This additional information will tell the compiler that our derived class only accept &lt;b&gt;TShirt&lt;/b&gt; object on its operation.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh4.googleusercontent.com/-hf7GRaeM6sg/TXDCMhEZ_XI/AAAAAAAAAVI/XUj_UBZiTog/s1600/picture_1.jpg" imageanchor="1"&gt;&lt;img border="0" height="24" src="https://lh4.googleusercontent.com/-hf7GRaeM6sg/TXDCMhEZ_XI/AAAAAAAAAVI/XUj_UBZiTog/s320/picture_1.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="display:block;font-weight:bold;"&gt;Picture 2&lt;/span&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;The next step, i added several new methods to suit my need which has not been provided by &lt;b&gt;List&lt;/b&gt;,our base class. &lt;b&gt;Picture 3&lt;/b&gt; below,shows you my first method &lt;b&gt;CountByColor&lt;/b&gt;. &lt;b&gt;CountByColor&lt;/b&gt; is the method that will show the number of items in the collection that has a matching color with the given parameter. And there are other three new methods have been added. You can see them directly on my source code which you can download from the link i have provided at the bottom of this article.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh3.googleusercontent.com/-5x7PTckpg9o/TXDCNjIQ8DI/AAAAAAAAAVM/6hRxrOVMk8s/s1600/picture_2.jpg" imageanchor="1"&gt;&lt;img border="0" height="163" src="https://lh3.googleusercontent.com/-5x7PTckpg9o/TXDCNjIQ8DI/AAAAAAAAAVM/6hRxrOVMk8s/s320/picture_2.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="display:block;font-weight:bold;"&gt;Picture 3&lt;/span&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 4&lt;/b&gt; shows how to declare and use our new class. The same way when we use &lt;b&gt;List&lt;/b&gt;.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh6.googleusercontent.com/-sqOAp39vl_A/TXDCQaCQYfI/AAAAAAAAAVQ/Epexxh4-uJ4/s1600/picture_3.jpg" imageanchor="1"&gt;&lt;img border="0" height="70" src="https://lh6.googleusercontent.com/-sqOAp39vl_A/TXDCQaCQYfI/AAAAAAAAAVQ/Epexxh4-uJ4/s320/picture_3.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="display:block;font-weight:bold;"&gt;Picture 4&lt;/span&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 5&lt;/b&gt; only shows part of &lt;b&gt;Core.GetData&lt;/b&gt; function which is used to run my example here. &lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh4.googleusercontent.com/-CWgeVYKPvDg/TXDDDN7foZI/AAAAAAAAAVY/giO_ic1Czkw/s1600/picture_5.jpg" imageanchor="1"&gt;&lt;img border="0" height="243" src="https://lh4.googleusercontent.com/-CWgeVYKPvDg/TXDDDN7foZI/AAAAAAAAAVY/giO_ic1Czkw/s320/picture_5.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="display:block;font-weight:bold;"&gt;Picture 5&lt;/span&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 6&lt;/b&gt; is showing the output when the program was run.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="https://lh4.googleusercontent.com/-8MK5fxB2I7A/TXDCRRHGPJI/AAAAAAAAAVU/gRLet3HFJz0/s1600/picture_4.jpg" imageanchor="1"&gt;&lt;img border="0" height="163" src="https://lh4.googleusercontent.com/-8MK5fxB2I7A/TXDCRRHGPJI/AAAAAAAAAVU/gRLet3HFJz0/s320/picture_4.jpg" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="display:block;font-weight:bold;"&gt;Picture 6&lt;/span&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;a href="http://download.livingsuburb.com.au/20110304/NewList.rar"&gt;Source Code&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-3283460262185322261?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/3283460262185322261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/creating-derived-class-from-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3283460262185322261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3283460262185322261'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/03/creating-derived-class-from-list.html' title='Creating Derived Class From LIST Generic Collection To Suit Your Need'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh3.googleusercontent.com/-qDv3OckInuM/TXDCLEsa2qI/AAAAAAAAAVE/EThAyGiUaOI/s72-c/picture_0.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-1656006263811042854</id><published>2011-02-25T23:34:00.000-08:00</published><updated>2011-02-26T04:15:43.234-08:00</updated><title type='text'>Background Thread and Cross Control Invocation</title><content type='html'>&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;The biggest challenge when to develop windows form application is how to make the application stay responsive to user action and at the sametime it keeps processing the information. Just imagine you want to processing hundred thousands of record but at the same time you want other features on your application stays looks running such as the current time. Normally,the application will freeze all the controls on the windows form until it has completed the process. Event ,i don't think you would be able to stop the application in the middle of the process because the button on the form would not be clickable during that time. What you could do is going to the Task Manager and kill the program. That's not a professional way.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td align="left"&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-MUr_MQafRmY/TWisAMZ5hKI/AAAAAAAAATs/WIK0JI07XDY/s1600/picture%2B1.jpg" imageanchor="1"&gt;&lt;img border="0" height="169" src="http://4.bp.blogspot.com/-MUr_MQafRmY/TWisAMZ5hKI/AAAAAAAAATs/WIK0JI07XDY/s200/picture%2B1.jpg" width="200" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b style="display: block;"&gt;Picture 1&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;In this opportunity i am going to show you how to use background thread to make my windows application stay responsive towards user action while it is still processing a huge amount of information. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Picture 1 shows you the look of the application before it is started. You can see the textbox down there showing current time and always changing. The start button is enabled and the stop button is disabled. I made those button interchangably enabled and disabled. If you click the start button, the start button would be set disabled and the stop button would be set enabled, vice versa.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-OSdYjrPx1Hg/TWisER7OMzI/AAAAAAAAAT0/_mx94yCC4ag/s1600/picture%2B2.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="169" src="http://2.bp.blogspot.com/-OSdYjrPx1Hg/TWisER7OMzI/AAAAAAAAAT0/_mx94yCC4ag/s200/picture%2B2.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Now i click the Start button. The application starts displaying a sequential numbers from 0 to 1 millions on the box on the left. As you can see on Picture 2, the application doesn't lose its responsiveness towards user action. If i click the Stop button the process will be stopped straight away,but the clock on the textbox is not interrupted at all.It keeps running as usual. Then if start again, the process will be resumed.&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 2&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-ac5kbYLgcyg/TWisN2KajOI/AAAAAAAAAT8/TcmoL6DrxYo/s1600/picture%2B3.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/-ac5kbYLgcyg/TWisN2KajOI/AAAAAAAAAT8/TcmoL6DrxYo/s200/picture%2B3.jpg" width="100" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;In this application i am using BackgroundWorker from System.ComponentModel to create a new thread (Picture 3). But there is a problem. The thread that is created by BackgroundWorker class can not be stopped until it completes the whole working process. &lt;br /&gt;&lt;br /&gt;So, i had an idea to create an inherited class to solve this problem. I named this class as Worker. There are 2 properties i added. One is IsStop and the other one is LastNumber. Property IsStop will be used to keep the state of the working process. And property LastNumber is to keep the next sequential number to run when the user click the start button again after the process being stopped.&lt;br /&gt;&lt;br /&gt;I also added 2 public method,Start and Stop. Both method will be used by the calling application to stop or resume of the working process. As you can see on Picture 2, both methods simply just change the value of IsStop property from false to true,vice versa.&lt;br /&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 3&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-weQY3Vk2RGs/TWisWZpN73I/AAAAAAAAAUE/njV9jexDbOc/s1600/picture%2B4.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="80" src="http://1.bp.blogspot.com/-weQY3Vk2RGs/TWisWZpN73I/AAAAAAAAAUE/njV9jexDbOc/s200/picture%2B4.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 4&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-Jp63iRtT5Jo/TWisei6CnOI/AAAAAAAAAUM/fGJoCCOz-jI/s1600/picture%2B5.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="44" src="http://3.bp.blogspot.com/-Jp63iRtT5Jo/TWisei6CnOI/AAAAAAAAAUM/fGJoCCOz-jI/s200/picture%2B5.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Back to the application. The application initializes the inherited Worker object class on Page Load event (see Picture 6 and Picture 4).And also, there are 2 important events that will be set up. &lt;br /&gt;&lt;br /&gt;First is DoWork event, which will be triggered by RunWorkerAsync() method. As you can see on Picture 2, this method will be run by Start public method. And Start method will be called as soon as the user click on Start button. When DoWork event is raised, it will make m_worker_DoWork method executed.&lt;br /&gt;&lt;br /&gt;The second event is RunWorkerCompleted. This event is going to be triggered when the working process is finished doing its work.&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 5&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-wtk1aE-Gu2Q/TWisr0mCxBI/AAAAAAAAAUU/rBVCd7PlO-E/s1600/picture%2B6.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="14" src="http://4.bp.blogspot.com/-wtk1aE-Gu2Q/TWisr0mCxBI/AAAAAAAAAUU/rBVCd7PlO-E/s200/picture%2B6.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 6&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-d3uia2HhLvY/TWiswJgNSJI/AAAAAAAAAUc/_JV_dmePqyY/s1600/picture%2B7.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="17" src="http://4.bp.blogspot.com/-d3uia2HhLvY/TWiswJgNSJI/AAAAAAAAAUc/_JV_dmePqyY/s200/picture%2B7.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 7&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-_52d2NoI0XQ/TWis0Hs-rhI/AAAAAAAAAUk/npwmk837rOw/s1600/picture%2B8.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="118" src="http://1.bp.blogspot.com/-_52d2NoI0XQ/TWis0Hs-rhI/AAAAAAAAAUk/npwmk837rOw/s200/picture%2B8.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;Because we create a new thread we have to be sure that when we access the controls on the form they are on the same thread, otherwise it would pop up an error. Fortunately, the controls have InvokeRequired property that will tell us if they are on the same thread or not with the method that is trying to access them. If that those controls are not on the same thread, we have to invoke the delegated functions and their values as seen on Picture 7. &lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 8&lt;/b&gt;&lt;a class="cssButton" href="javascript:void(0)" id="publishButton" onclick="if (this.className.indexOf(&amp;quot;ubtn-disabled&amp;quot;) == -1) {var e = document['postingForm'].publish;(e.length) ? e[0].click() : e.click(); if (window.event) window.event.cancelBubble = true; return false;}" target=""&gt;&lt;div class="cssButtonOuter"&gt;&lt;div class="cssButtonMiddle"&gt;&lt;div class="cssButtonInner"&gt;Publish Post&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-FnDyyo47sCw/TWis4_Qu0XI/AAAAAAAAAUs/czr6KD-eWa4/s1600/picture%2B9.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="32" src="http://4.bp.blogspot.com/-FnDyyo47sCw/TWis4_Qu0XI/AAAAAAAAAUs/czr6KD-eWa4/s200/picture%2B9.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 9&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-MwzZmlUHvfs/TWis9GDhcDI/AAAAAAAAAU0/oHB-HUU-ECg/s1600/picture%2B10.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="56" src="http://4.bp.blogspot.com/-MwzZmlUHvfs/TWis9GDhcDI/AAAAAAAAAU0/oHB-HUU-ECg/s200/picture%2B10.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;b&gt;Picture 10&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-x3nmhj2qLS0/TWitBz0oxCI/AAAAAAAAAU8/W1k9n1cU0kY/s1600/picture%2B11.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="58" src="http://2.bp.blogspot.com/-x3nmhj2qLS0/TWitBz0oxCI/AAAAAAAAAU8/W1k9n1cU0kY/s200/picture%2B11.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20110226/BackgroundThread.rar"&gt;Source&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-1656006263811042854?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/1656006263811042854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/02/background-thread-and-cross-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/1656006263811042854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/1656006263811042854'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2011/02/background-thread-and-cross-control.html' title='Background Thread and Cross Control Invocation'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-MUr_MQafRmY/TWisAMZ5hKI/AAAAAAAAATs/WIK0JI07XDY/s72-c/picture%2B1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-7831577466110615783</id><published>2010-06-23T03:28:00.000-07:00</published><updated>2010-06-23T20:37:51.912-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='JQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><title type='text'>Drag and Drop With JQuery UI</title><content type='html'>The more i use JQuery the more i love it. It makes my job easier to do some front end tricks. The following is about a simple game that let the user to drag the soccer balls on the left side into the bin on the right. Everytime the ball is successfully dropped into the bin, the number on the right will be increased by 1.&lt;br /&gt;&lt;br /&gt;picture .1.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/TCHiXiQ0xII/AAAAAAAAARI/Z6VABQMvVqQ/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/TCHiXiQ0xII/AAAAAAAAARI/Z6VABQMvVqQ/s320/1.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;picture .2.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TCHifKy_cwI/AAAAAAAAARQ/f80VkXV5KqY/s1600/2.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TCHifKy_cwI/AAAAAAAAARQ/f80VkXV5KqY/s320/2.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The most important elements on the web form for this project relies on JQuery and JQuery-UI frameworks. Here we imports those frameworks on the fly from GOOGLE CDN website. So, make sure your computer is connected to the internet when the run this example.&lt;br /&gt;&lt;br /&gt;picture .3.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/TCHjZJn5A8I/AAAAAAAAARY/Pp6LxZ_LdX8/s1600/3.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="35" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/TCHjZJn5A8I/AAAAAAAAARY/Pp6LxZ_LdX8/s640/3.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Between the BODY tag&amp;nbsp; we declare images and labels.&lt;br /&gt;&lt;br /&gt;picture .4.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/TCHkaxQHV-I/AAAAAAAAARo/PtaRpVyEmzs/s1600/5.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="71" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/TCHkaxQHV-I/AAAAAAAAARo/PtaRpVyEmzs/s400/5.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;On &lt;b&gt;SCRIPT&lt;/b&gt; section we attach the four soccer balls images to draggable function. And we also attach bin image to droppable function. When the &lt;b&gt;drop&lt;/b&gt; event is triggered a function is executed. That function will change the visibility property of the dropped object to none. At the same time it will increase the counting and update the label.&lt;br /&gt;&lt;br /&gt;picture .5.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TCHj1RFa3vI/AAAAAAAAARg/OiOHAq4HS_o/s1600/4.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="182" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TCHj1RFa3vI/AAAAAAAAARg/OiOHAq4HS_o/s400/4.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100623/drag-and-drop-with-jquery-ui/DragDrop.rar"&gt;&lt;b&gt;Source&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Professional-JavaScript-Developers-Wrox-Programmer/dp/047022780X?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Professional JavaScript for Web Developers (Wrox Programmer to Programmer)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=047022780X&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/jQuery-Action-Second-Bear-Bibeault/dp/1935182323?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" style="margin-left: 20px; margin-right: 20px;" target="_blank"&gt;&lt;img alt="jQuery in Action, Second Edition" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=1935182323&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/jQuery-Novice-Ninja-Earle-Castledine/dp/0980576857?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="jQuery: Novice to Ninja" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0980576857&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-7831577466110615783?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/7831577466110615783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/drag-and-drop-with-jquery-ui.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/7831577466110615783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/7831577466110615783'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/drag-and-drop-with-jquery-ui.html' title='Drag and Drop With JQuery UI'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_vPSWlMYlhHg/TCHiXiQ0xII/AAAAAAAAARI/Z6VABQMvVqQ/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-3313286139844842117</id><published>2010-06-19T03:23:00.001-07:00</published><updated>2010-06-21T01:58:37.700-07:00</updated><title type='text'>Style Sheet On Silver Light</title><content type='html'>On SilverLight, the style sheet is placed on an App.xaml file between &lt;b style="color: #b45f06;"&gt;Application.Resources&lt;/b&gt; tag.&lt;br /&gt;&lt;br /&gt;picture 1&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBybNTKIXyI/AAAAAAAAAQo/1psdYRXGe98/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBybNTKIXyI/AAAAAAAAAQo/1psdYRXGe98/s400/1.gif" width="263" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;As you can see on picture 2, the way the style sheet is laid out is different compared with what we used to do on style sheet for a web form. There is an evolution.The style sheet syntax has been transformed into XML format. But some are still recognisable such as &lt;b style="color: #b45f06;"&gt;FontSize&lt;/b&gt; referring to &lt;b&gt;&lt;span style="color: #b45f06;"&gt;font-size&lt;/span&gt;&lt;/b&gt; on style sheet on the web form.&lt;br /&gt;&lt;br /&gt;picture 2&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBybYW2oWRI/AAAAAAAAAQw/3Sd76RlpPC8/s1600/2.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="338" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBybYW2oWRI/AAAAAAAAAQw/3Sd76RlpPC8/s400/2.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;picture 3&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TByeC2TtckI/AAAAAAAAARA/UchwPgMUyb8/s1600/3.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="24" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TByeC2TtckI/AAAAAAAAARA/UchwPgMUyb8/s640/3.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;On the control,&amp;nbsp; &lt;b&gt;&lt;span style="color: #b45f06;"&gt;StaticResource&lt;/span&gt;&lt;/b&gt; keyword has to be called along side with the style name (picture 3).&lt;br /&gt;&lt;b&gt;&amp;nbsp; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100619/style-sheet-on-silver-light/BlockBusterVideoCS.rar"&gt;&lt;b&gt;Source C#&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.blogger.com/download.livingsuburb.com.au/20100619/style-sheet-on-silver-light/BlockBusterVideoVB.rar"&gt;&lt;b&gt;Source VB.NET&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Microsoft-Silverlight-Data-Services-Cookbook/dp/1847199844?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Microsoft Silverlight 4 Data and Services Cookbook" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=1847199844&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Next-Generation-Business-Intelligence-Software-Silverlight/dp/1430224878?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" style="margin-left: 20px; margin-right: 20px;" target="_blank"&gt;&lt;img alt="Next-Generation Business Intelligence Software with Silverlight 3 (Expert's Voice in Silverlight)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=1430224878&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Stylin-CSS-Designers-Guide-2nd/dp/0321525566?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Stylin' with CSS: A Designer's Guide (2nd Edition)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0321525566&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-3313286139844842117?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/3313286139844842117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/style-sheet-on-silver-light.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3313286139844842117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3313286139844842117'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/style-sheet-on-silver-light.html' title='Style Sheet On Silver Light'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_vPSWlMYlhHg/TBybNTKIXyI/AAAAAAAAAQo/1psdYRXGe98/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-98697818977865123</id><published>2010-06-18T19:42:00.000-07:00</published><updated>2010-06-23T21:15:23.221-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='SilverLight'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>To Call WCF Service From Silver Light</title><content type='html'>On your Visual Studio, click the &lt;b&gt;File&lt;/b&gt; menu and select &lt;b&gt;New Project&lt;/b&gt;. &lt;br /&gt;picture .1.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TBw4X7Ahw_I/AAAAAAAAANY/F3cmBpB1vok/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TBw4X7Ahw_I/AAAAAAAAANY/F3cmBpB1vok/s320/1.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The window will show up.Select the programming language you want to use, select &lt;b&gt;SilverLight&lt;/b&gt; and on the right window seelct &lt;b&gt;SilverLight Application&lt;/b&gt;. Name your application &lt;b&gt;MySilverLightApp&lt;/b&gt;. Click Ok.&lt;br /&gt;&lt;br /&gt;picture .2.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBw4iqVPKqI/AAAAAAAAANg/c_mv3HQycmg/s1600/2.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBw4iqVPKqI/AAAAAAAAANg/c_mv3HQycmg/s320/2.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Another window appears, just click &lt;b&gt;Ok&lt;/b&gt;.&lt;br /&gt;picture .3.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/TBw4qdiyN7I/AAAAAAAAANo/bP6aN7vtgZI/s1600/3.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/TBw4qdiyN7I/AAAAAAAAANo/bP6aN7vtgZI/s320/3.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now, on Solution Explorer double click on Page.xaml. Change the xaml code as seen on picture 4 below.&lt;br /&gt;&lt;br /&gt;picture .4.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/TBxwLYd6FHI/AAAAAAAAAPw/7qWoNmEvpbg/s1600/4.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="121" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/TBxwLYd6FHI/AAAAAAAAAPw/7qWoNmEvpbg/s640/4.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;After the changes have been done, you will see the new look.&lt;br /&gt;&lt;br /&gt;picture .5.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TByYEkvjZEI/AAAAAAAAAQg/Xs08Y6lOUFQ/s1600/5.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TByYEkvjZEI/AAAAAAAAAQg/Xs08Y6lOUFQ/s320/5.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Select &lt;b&gt;MySilverLightApp.Web&lt;/b&gt; project on your Solution Explorer. Right click and select &lt;b&gt;Add&lt;/b&gt; then &lt;b&gt;New Item.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;picture .6.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBw69YngkoI/AAAAAAAAAOA/8scHmy1iMP4/s1600/6.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBw69YngkoI/AAAAAAAAAOA/8scHmy1iMP4/s320/6.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Select &lt;b&gt;SilverLight enabled WCF Service&lt;/b&gt;, change the name of the new item to &lt;b&gt;svcWCF.svc&lt;/b&gt; and click &lt;b&gt;Add&lt;/b&gt; button.&lt;br /&gt;&lt;br /&gt;picture .7.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBw8EFPtk1I/AAAAAAAAAOI/63_5uJyAQh8/s1600/7.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBw8EFPtk1I/AAAAAAAAAOI/63_5uJyAQh8/s320/7.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now you see a new file under &lt;b&gt;MySilverLightApp.Web&lt;/b&gt; (svcWCF.svc). Double click on it. &lt;br /&gt;&lt;br /&gt;picture .8.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/TBw-Ts5VOfI/AAAAAAAAAOY/CZxG8m3XWpQ/s1600/9.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/TBw-Ts5VOfI/AAAAAAAAAOY/CZxG8m3XWpQ/s320/9.gif" /&gt;&lt;/a&gt;&lt;/div&gt;Remove &lt;b&gt;DoWork()&lt;/b&gt; method that was created automatically when you added that SilverLight enabled WCF service. And replace with the codes on picture 9.&lt;br /&gt;&lt;br /&gt;picture .9.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/TBw_mJOHo7I/AAAAAAAAAOo/v5JWzXGozVs/s1600/10.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/TBw_mJOHo7I/AAAAAAAAAOo/v5JWzXGozVs/s320/10.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Select &lt;b&gt;MySilverLightApp.Web&lt;/b&gt; project again, right click and select &lt;b&gt;Set as StartUp&lt;/b&gt; project.&lt;br /&gt;&lt;br /&gt;picture .10.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBxJphWT1YI/AAAAAAAAAPY/M-fL7x2aqLw/s1600/16.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBxJphWT1YI/AAAAAAAAAPY/M-fL7x2aqLw/s320/16.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Select &lt;b&gt;svcWCF.svc&lt;/b&gt; file and set it up as Start up Page. &lt;br /&gt;&lt;br /&gt;picture .11.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBxAXwKKXPI/AAAAAAAAAOw/9q9I0vDPLH0/s1600/11.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBxAXwKKXPI/AAAAAAAAAOw/9q9I0vDPLH0/s320/11.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Start Debugging,either by pressing F5 button or the green arrow button on the IDE. Soon, a window message will show up, just click Ok.&lt;br /&gt;&lt;br /&gt;picture .12.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/TBxBAbCZgRI/AAAAAAAAAO4/piMG9reO3HY/s1600/12.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/TBxBAbCZgRI/AAAAAAAAAO4/piMG9reO3HY/s320/12.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The WCF service is running, ready to be consumed.&lt;br /&gt;&lt;br /&gt;picture .13.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TBxGmYGrVFI/AAAAAAAAAPA/bm8bTrkLEWw/s1600/13.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TBxGmYGrVFI/AAAAAAAAAPA/bm8bTrkLEWw/s320/13.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Stop Debugging. As you can see on the right down corner of your task bar, there is a small icon remain stay there. The service is actually still running from the previous action.&lt;br /&gt;&lt;br /&gt;Next, select your silverlight project, right click and select &lt;b&gt;Add Service Reference&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;picture .14.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBxH3PalM6I/AAAAAAAAAPI/4YOcpFbvxes/s1600/14.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBxH3PalM6I/AAAAAAAAAPI/4YOcpFbvxes/s320/14.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;On popping up window, click &lt;b&gt;Discover&lt;/b&gt; button. Because you just run one service on previous action, so there is only one url address on that combo box &lt;b&gt;Address&lt;/b&gt; on the left. Change the &lt;b&gt;NameSpace&lt;/b&gt; to &lt;b&gt;clientWCFProxy&lt;/b&gt;. Click &lt;b&gt;Ok&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;picture .15.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TBxIBoA-f7I/AAAAAAAAAPQ/RrFY2AbZsOU/s1600/15.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TBxIBoA-f7I/AAAAAAAAAPQ/RrFY2AbZsOU/s320/15.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;There are new files that have been added into your SilverLight project. They are clientWCFProxy and ServiceReferences.ClientConfig.&lt;br /&gt;&lt;br /&gt;picture .16.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/TBxKwPDOOgI/AAAAAAAAAPo/HsKaN69gc28/s1600/17.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/TBxKwPDOOgI/AAAAAAAAAPo/HsKaN69gc28/s320/17.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;picture .17.&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TByP5dMgMpI/AAAAAAAAAQY/fjVW2v0aJ_g/s1600/18B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TByP5dMgMpI/AAAAAAAAAQY/fjVW2v0aJ_g/s640/18B.gif" width="595" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBxxkQWkCXI/AAAAAAAAAQI/VHFIsKEo6zo/s1600/18A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="232" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TBxxkQWkCXI/AAAAAAAAAQI/VHFIsKEo6zo/s640/18A.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;picture .18.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TBxyKujiy_I/AAAAAAAAAQQ/7GDp4z6dfHI/s1600/19.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TBxyKujiy_I/AAAAAAAAAQQ/7GDp4z6dfHI/s320/19.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100618/to-call-wcf-service-from-silver-light/MySilverLightAppCS.rar"&gt;&lt;b&gt;Source C#&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100618/to-call-wcf-service-from-silver-light/MySilverLightAppVB.rar"&gt;&lt;b&gt;Source VB.NET&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="2" cellspacing="2"&gt;&lt;tbody&gt;&lt;tr&gt;  &lt;td valign="bottom"&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Pro-Silverlight-4-Matthew-MacDonald/dp/1430229799?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Pro Silverlight 4 in C#" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=1430229799&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt;    &lt;td valign="bottom"&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Professional-WCF-Windows-Communication-Foundation/dp/0470563141?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Professional WCF 4: Windows Communication Foundation with .NET 4" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0470563141&amp;amp;tag=codeg06-20" style="margin-left: 20px; margin-right: 20px;" /&gt;&lt;/a&gt;&lt;/td&gt;   &lt;td valign="bottom"&gt;&lt;a href="http://www.amazon.com/Microsoft-Silverlight-Business-Application-Development/dp/1847199763?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Microsoft Silverlight 4 Business Application Development: Beginners Guide" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=1847199763&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-98697818977865123?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/98697818977865123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/to-call-wcf-service-from-silver-light.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/98697818977865123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/98697818977865123'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/to-call-wcf-service-from-silver-light.html' title='To Call WCF Service From Silver Light'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_vPSWlMYlhHg/TBw4X7Ahw_I/AAAAAAAAANY/F3cmBpB1vok/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-3388119399054331554</id><published>2010-06-06T21:56:00.000-07:00</published><updated>2010-06-19T03:15:50.176-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Web User Control'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Web User Control</title><content type='html'>There are several reason why we need to create web user controls. Some people said,it will improve the development time in the long run. In this scenario,if we are working on several project that require similar feature such as registration form, web user control would help us from redoing the same job again and again .&lt;br /&gt;&lt;br /&gt;But others said this is just a matter of task delegation among programmers in the group.&amp;nbsp; If&amp;nbsp; we have several programmers in our team and we want devide the jobs more specific to them, ones probably would be suited for focusing their job in web user control development and the rest do other part of programming job.&lt;br /&gt;&lt;br /&gt;In this opportunity i take an example of MJ Concert Registration Form. It requires the users to provide four basic information. There are three textboxes,one dropdown list.And there is a button to submit those information back to the server.&lt;br /&gt;&lt;br /&gt;picture .1.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAx76hOPOPI/AAAAAAAAAL4/ZKamuva9Tbc/s1600/7A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAx76hOPOPI/AAAAAAAAAL4/ZKamuva9Tbc/s320/7A.gif" /&gt;&lt;/a&gt;&lt;/div&gt;After adding a web user control template into my project and designing the outlook, the next thing to do is to create a class that derives from &lt;b&gt;System.EventArgs&lt;/b&gt;. This class is going to be used to contain the values entered by the user on my web user control and pass them on to page during the post back. In our case i have four properties on the class that are matched with the number of inputs appeared on my web user control.&lt;br /&gt;&lt;br /&gt;picture .2. (click to enlarge)&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzHXb7YQMI/AAAAAAAAAMA/bVk9uzBaJEk/s1600/2A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzHXb7YQMI/AAAAAAAAAMA/bVk9uzBaJEk/s320/2A.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TAzIrlgKlGI/AAAAAAAAAMQ/rQD93BNBNVs/s1600/2B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TAzIrlgKlGI/AAAAAAAAAMQ/rQD93BNBNVs/s320/2B.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Then i need to declare a delegate function on my web user control . Basically a delegate function is almost similar to &lt;b&gt;pointer&lt;/b&gt; in C++. Its duty is to encapsulate other function. In this scenario mine will encapsulate the external function, the function that is created on the web page.&lt;br /&gt;&lt;br /&gt;Next one to declare is an event. Event is most likely a signal that is prepared to yield the system when certain condition has been reached. In my case the event has been wired to my delegate function. That means if that event is raised,automatically my delegate will be called. That call will make my delegate function executes the external function on the web page.&lt;br /&gt;&lt;br /&gt;picture .3.&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TAzKiNcIhGI/AAAAAAAAAMY/t7GcubAcshU/s1600/3A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="31" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TAzKiNcIhGI/AAAAAAAAAMY/t7GcubAcshU/s400/3A.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/TAzKrdUFfBI/AAAAAAAAAMg/FrZipKf6CTw/s1600/3B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="25" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/TAzKrdUFfBI/AAAAAAAAAMg/FrZipKf6CTw/s400/3B.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;After the users complete the necessary information, they have to press the submit button. When that happens the click event is triggered,all the information are kept in the object properties and passed on to the external function through delegate function.&lt;br /&gt;&lt;br /&gt;picture .4. (click to enlarge)&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzLa0wKNhI/AAAAAAAAAMo/hGuSckB0i0E/s1600/4A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="89" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzLa0wKNhI/AAAAAAAAAMo/hGuSckB0i0E/s320/4A.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzLsYFYyrI/AAAAAAAAAMw/zlpjLZn53NE/s1600/4B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="115" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzLsYFYyrI/AAAAAAAAAMw/zlpjLZn53NE/s400/4B.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Picture 5 shows how web user control makes web page code looks simpler. Some complexity has been taken off into seperate module.&lt;br /&gt;&lt;br /&gt;picture .5.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAze3fpw6AI/AAAAAAAAAM4/E59kVZQd0_U/s1600/5.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="91" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAze3fpw6AI/AAAAAAAAAM4/E59kVZQd0_U/s400/5.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;When i was using C#, i couldn't find the way to create a function to be wired to my web user control automatically. On VB.NET it was easy. I just clicked the dropdown list on the IDE,select my web user control, select the desired event the second dropdown list and all the sudden the IDE created the function as required.&lt;br /&gt;&lt;br /&gt;On C#, i wrote extra code on my source code. First step, i created the function by hand. That function has similar paramter that the delegate function has. Second step,on page load event i wired the submit event of my web user control to that function.&lt;br /&gt;&lt;br /&gt;picture .6.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzfSQcY7WI/AAAAAAAAANA/ZTFUNKsELOY/s1600/6.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="59" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzfSQcY7WI/AAAAAAAAANA/ZTFUNKsELOY/s640/6.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now i can do i like to do with the data that has been passed in to my function on my page.&lt;br /&gt;&lt;br /&gt;picture .7.&lt;br /&gt;C#&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzf60NisjI/AAAAAAAAANI/aaeNROROc0M/s1600/8A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="63" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAzf60NisjI/AAAAAAAAANI/aaeNROROc0M/s400/8A.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/TAzgEEN_2eI/AAAAAAAAANQ/PK1ilzWGv84/s1600/8B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="40" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/TAzgEEN_2eI/AAAAAAAAANQ/PK1ilzWGv84/s400/8B.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100606/Web-User-Control/WebUserControlCS.rar"&gt;&lt;b&gt;Source C#&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100606/Web-User-Control/WebUserControlVB.rar"&gt;&lt;b&gt;Source VB.NET&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/ASP-NET-Data-Controls-Kick-Start/dp/0672325012?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="ASP.NET Data Web Controls Kick Start" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0672325012&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Developing-Microsoft-Controls-Components-Pro-Developer/dp/0735615829?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" style="margin-left: 20px; margin-right: 20px;" target="_blank"&gt;&lt;img alt="Developing Microsoft ASP.NET Server Controls and Components (Pro-Developer)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0735615829&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/C-Bible-Jeff-Ferguson/dp/0764548344?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="C# Bible" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0764548344&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-3388119399054331554?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/3388119399054331554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/asdf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3388119399054331554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3388119399054331554'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/asdf.html' title='Web User Control'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_vPSWlMYlhHg/TAx76hOPOPI/AAAAAAAAAL4/ZKamuva9Tbc/s72-c/7A.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-253656315758005529</id><published>2010-06-03T14:09:00.000-07:00</published><updated>2010-06-19T03:16:33.727-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='JQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>Using JQuery to Access WCF Services</title><content type='html'>This article is about how to use JQuery to access WCF Services. Picture 1 shows on what it looks like. Everytime the user select different item on drop down list, the table will be refreshed with new information that correspond to that selected item.&lt;br /&gt;&lt;br /&gt;picture .1. (click to enlarge)&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/TAi2Ru04tZI/AAAAAAAAALA/WUxJgMnZn78/s1600/1A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="71" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/TAi2Ru04tZI/AAAAAAAAALA/WUxJgMnZn78/s400/1A.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;How does it do ? Simple. Everytime user select different item on the drop down list, that html control will raise &lt;b&gt;change&lt;/b&gt; event. That event has been wired to a javascript function (picture 3). That function then calls JQuery AJAX function which post the selected item value to the WCF service.&amp;nbsp; We can see the location of the WCF service on&amp;nbsp; &lt;b&gt;url&lt;/b&gt; property value.&lt;br /&gt;&lt;br /&gt;Another important aspect to be remember is, if you send the parameter to WCF service through &lt;b&gt;POST&lt;/b&gt; method, you need to put extra attribute on service contract as seen on picture 2. And because we choose &lt;b&gt;JSON&lt;/b&gt; data format for communication between client javascript to WCF service, we need to declare &lt;b&gt;JSON&lt;/b&gt; message format attribute as well.&lt;br /&gt;&lt;br /&gt;picture .2.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAjlMg5_xZI/AAAAAAAAALY/gmSnGDsIqZw/s1600/4A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="204" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAjlMg5_xZI/AAAAAAAAALY/gmSnGDsIqZw/s640/4A.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/TAjliAA2GbI/AAAAAAAAALg/WJeY6LdVDB8/s1600/4B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="136" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/TAjliAA2GbI/AAAAAAAAALg/WJeY6LdVDB8/s640/4B.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Picture 3 shows all property JQuery AJAX has. I compare this JQuery AJAX with the XMLHTTPRequest object, this is much better.&lt;br /&gt;&lt;br /&gt;picture .3.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAjj0Is9ndI/AAAAAAAAALI/jY79n-1xU2Q/s1600/2.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="331" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAjj0Is9ndI/AAAAAAAAALI/jY79n-1xU2Q/s640/2.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The javascript function that does rendering receives the data in JSON format. Because most recent version of the browsers are able to detect JSON data type automatically, that data is transformed into objects. These objects will have the same structures with the objects returned by the WCF service. But if you are using older version of browser, you need to include JSON2.js into your web page and use it to convert JSON format data into compatible objects. You can get JSON2.js from &lt;a href="http://www.json.org/json2.js"&gt;www.json.org&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;picture .4. &lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/TAjkO7lViuI/AAAAAAAAALQ/61EPgv88Sa8/s1600/3.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="366" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/TAjkO7lViuI/AAAAAAAAALQ/61EPgv88Sa8/s640/3.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;When you download the source code and debug it, you can see that i used enumerator &lt;b&gt;BookType&lt;/b&gt;. I&lt;b&gt; &lt;/b&gt;wanted&lt;b&gt;&amp;nbsp; &lt;/b&gt;that &lt;b&gt;BookType&lt;/b&gt; to be represented on the table in more readable form instead of numeric. So, i created an javascript variable array to hold every label of each enumerator item of &lt;b&gt;BookType&lt;/b&gt;. The javascript function that renders the table (picture 4) pick one of the array by associating the array index to the book type value from the object . This process is done repeately from one row to the next.&lt;br /&gt;&lt;br /&gt;picture .5. (click to enlarge)&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAnNV2QVbRI/AAAAAAAAALo/fbPQq1e2lzw/s1600/7A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="161" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/TAnNV2QVbRI/AAAAAAAAALo/fbPQq1e2lzw/s400/7A.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/TAnNhN3tS-I/AAAAAAAAALw/2U1C5d0r-70/s1600/7B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="111" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/TAnNhN3tS-I/AAAAAAAAALw/2U1C5d0r-70/s400/7B.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100603/using-jquery-to-access-wcf-services/WCFJSONCS.rar"&gt;&lt;b&gt;Source C#&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100603/using-jquery-to-access-wcf-services/WCFJSONVB.rar"&gt;&lt;b&gt;Source VB.NET&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Programming-WCF-Services-Juval-Lowy/dp/0596521308?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Programming WCF Services" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0596521308&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a style="margin-left:20px;margin-right:20px;" href="http://www.amazon.com/jQuery-Cookbook-Solutions-Examples-Developers/dp/0596159773?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="jQuery Cookbook: Solutions &amp;amp; Examples for jQuery Developers (Animal Guide)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0596159773&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Pro-2008-NET-Platform-Windows-Net/dp/1590598229?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Pro VB 2008 and the .NET 3.5 Platform (Windows.Net)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=1590598229&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-253656315758005529?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/253656315758005529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/using-jquery-to-access-wcf-services.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/253656315758005529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/253656315758005529'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/06/using-jquery-to-access-wcf-services.html' title='Using JQuery to Access WCF Services'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_vPSWlMYlhHg/TAi2Ru04tZI/AAAAAAAAALA/WUxJgMnZn78/s72-c/1A.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-536730158909867508</id><published>2010-05-25T16:57:00.001-07:00</published><updated>2010-06-19T03:17:01.385-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='JQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Grid'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>DataGrid Customization Part II</title><content type='html'>In this opportunity i am about to customize my datagrid pager as seen on picture 1 below. Instead of using numerical links or back next button i prefer to use drop down list.It makes me feel easier to navigate through all the pages. &lt;br /&gt;&lt;br /&gt;picture .1.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_z-3UeoAWI/AAAAAAAAAJA/zHlTFtaJ3RU/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_z-3UeoAWI/AAAAAAAAAJA/zHlTFtaJ3RU/s320/1.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Actually this pager customization is an enhancement of my previous article&amp;nbsp; &lt;a href="http://johnhadikusumo.blogspot.com/2010/05/datagrid-customization.html"&gt;DataGrid Customization Part I&lt;/a&gt;&lt;br /&gt;so i used the previous project with couple modifications. First modification is on &lt;b&gt;Page PreRender&lt;/b&gt; event.&lt;br /&gt;Here i declared a javascript variable to hold our datagrid id for later use.&lt;br /&gt;&lt;br /&gt;picture .2. (click to enlarge)&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_41W09MAaI/AAAAAAAAAJI/v_35RQU52_Y/s1600/4A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_41W09MAaI/AAAAAAAAAJI/v_35RQU52_Y/s320/4A.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/S_5KJkK-X7I/AAAAAAAAAJY/L3nqc1fNvdo/s1600/5B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/S_5KJkK-X7I/AAAAAAAAAJY/L3nqc1fNvdo/s320/5B.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;On DataGrid &lt;b&gt;ItemCreated&lt;/b&gt; event , there is a condition if the item type is &lt;b&gt;Pager&lt;/b&gt; then do the customization.&lt;br /&gt;&lt;br /&gt;picture .3.&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_5S8Du565I/AAAAAAAAAJg/UABOI6zHepE/s1600/4A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_5S8Du565I/AAAAAAAAAJg/UABOI6zHepE/s320/4A.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_5TIKuiTdI/AAAAAAAAAJo/7P4GPLmMq54/s1600/4A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_5TIKuiTdI/AAAAAAAAAJo/7P4GPLmMq54/s320/4A.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Before the customization is started ,the existing default pager elements must be removed. Picture 4 shows how those elements are removed through loop process.&lt;br /&gt;&lt;br /&gt;picture .4.&lt;br /&gt;&lt;br /&gt;C# &lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_5WTe7GHaI/AAAAAAAAAJw/Sixwcz6vRBw/s1600/6A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_5WTe7GHaI/AAAAAAAAAJw/Sixwcz6vRBw/s320/6A.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_5WepUUQbI/AAAAAAAAAJ4/SwFbGs0dGWo/s1600/6B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_5WepUUQbI/AAAAAAAAAJ4/SwFbGs0dGWo/s320/6B.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Next step is to calculate number of pages based on various information gathered from datagrid and data feed.&lt;br /&gt;&lt;br /&gt;picture .5.&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/S_5XdNXs88I/AAAAAAAAAKA/PiaJ5P2NbOs/s1600/7A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/S_5XdNXs88I/AAAAAAAAAKA/PiaJ5P2NbOs/s320/7A.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_5XnvwQDhI/AAAAAAAAAKI/0uh3gSbVcI4/s1600/7B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_5XnvwQDhI/AAAAAAAAAKI/0uh3gSbVcI4/s320/7B.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;If there is only one page, the grid doesn't need to display any pager and its label. Otherwise the label and the dropdown list will be created on the fly.&lt;br /&gt;&lt;br /&gt;picture .6.&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_5YY2N2cfI/AAAAAAAAAKQ/Tn68LQSx7vY/s1600/8A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="196" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_5YY2N2cfI/AAAAAAAAAKQ/Tn68LQSx7vY/s400/8A.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_5Ypc2p3zI/AAAAAAAAAKY/o5lihZ5JNaY/s1600/8B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="233" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_5Ypc2p3zI/AAAAAAAAAKY/o5lihZ5JNaY/s400/8B.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Other modification also need to be done on page Load event. It processes the parameter representing the selected page.&lt;br /&gt;&lt;br /&gt;picture .7.&lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/S_7eJIAARDI/AAAAAAAAAKo/S0rX8_uSRvU/s1600/9A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="136" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/S_7eJIAARDI/AAAAAAAAAKo/S0rX8_uSRvU/s640/9A.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;VB.NET&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_7eUU6RIbI/AAAAAAAAAKw/46d_PKH2Qpo/s1600/9B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="98" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_7eUU6RIbI/AAAAAAAAAKw/46d_PKH2Qpo/s640/9B.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The last thing to do is to attach the change event for the dropdown list. Here i used JQuery to find the dropdown list element on datagrid (remember the javascript variable i mentioned before) and do that attachment. Further information on how to use JQuery framework you can find it on &lt;a href="http://www.jquery.com/"&gt;www.jquery.com&lt;/a&gt;.&lt;br /&gt;picture .8.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_7fQ2PotkI/AAAAAAAAAK4/KhlKF6UJEy0/s1600/10.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="162" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_7fQ2PotkI/AAAAAAAAAK4/KhlKF6UJEy0/s400/10.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100520/DataGrid%20Customization%20Part%20II/DataGridCSharp.rar"&gt;&lt;b&gt;Source C#&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100520/DataGrid%20Customization%20Part%20II/DataGridVB.rar"&gt;&lt;b&gt;Source VB.NET&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="2" cellspacing="2"&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/jQuery-Cookbook-Solutions-Examples-Developers/dp/0596159773?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="jQuery Cookbook: Solutions &amp;amp; Examples for jQuery Developers (Animal Guide)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0596159773&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a style="margin-left:20px;margin-right:20px;" href="http://www.amazon.com/Head-First-JavaScript-Michael-Morrison/dp/0596527748?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Head First JavaScript" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0596527748&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Creating-DataGrid-Updating-Its-Records/dp/B0006I0W04?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Creating a DataGrid and Updating Its Records on the Fly" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=B0006I0W04&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-536730158909867508?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/536730158909867508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/datagrid-customization-part-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/536730158909867508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/536730158909867508'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/datagrid-customization-part-ii.html' title='DataGrid Customization Part II'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_vPSWlMYlhHg/S_z-3UeoAWI/AAAAAAAAAJA/zHlTFtaJ3RU/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-7893318686189511873</id><published>2010-05-20T04:18:00.001-07:00</published><updated>2010-05-25T17:42:07.028-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Grid'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>DataGrid  Customization Part I</title><content type='html'>Most people use Data Grid web control to show the information in table format as seen on picture 1. It allows the users to navigate the data from one page to the next easily.&amp;nbsp; But what happen if you want different format but still taking the advantages of the data grid ?&lt;br /&gt;&lt;br /&gt;picture .1.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_Ued4kNQ_I/AAAAAAAAAHA/a5s_zf6D7Io/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S_Ued4kNQ_I/AAAAAAAAAHA/a5s_zf6D7Io/s320/1.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Just imagine that i want my video data to be displayed as shown on picture 2. Instead of placing my data in 5 different column, i just want to use two column. The first column is for the image and the second one holds the rest of the information. &lt;br /&gt;&lt;br /&gt;picture .2.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_Uepd16UHI/AAAAAAAAAHI/3wCYX9ncnP8/s1600/2.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_Uepd16UHI/AAAAAAAAAHI/3wCYX9ncnP8/s320/2.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;What i am doing here is just one way. You can try other way better than this when you have time. I created a new web project. I dragged datagrid web control from ToolBox on the default.aspx. Modify the HTML source code as you can see on picture 3 below. To customise the grid we need to use TemplateColumn. I added PlaceHolder web control that later would hold other web controls to be created on the fly.&lt;br /&gt;&lt;br /&gt;picture .3.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_UfkQFWhKI/AAAAAAAAAHY/dlLtxB7yI-8/s1600/3.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S_UfkQFWhKI/AAAAAAAAAHY/dlLtxB7yI-8/s320/3.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now we need to create a class that is called Video as seen on picture 4.&lt;br /&gt;&lt;br /&gt;picture 4 (click to enlarge)&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #b45f06;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;C#&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_X6Q3u33dI/AAAAAAAAAIg/JgXLCJ4PIHI/s1600/7A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_X6Q3u33dI/AAAAAAAAAIg/JgXLCJ4PIHI/s1600/7A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_X6Q3u33dI/AAAAAAAAAIg/JgXLCJ4PIHI/s400/7A.gif" width="210" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="color: #b45f06;"&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;VB.NET&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_YEub-E8XI/AAAAAAAAAIo/6_MR4PwgPeI/s1600/7B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_YEub-E8XI/AAAAAAAAAIo/6_MR4PwgPeI/s320/7B.gif" /&gt;&lt;/a&gt;&lt;/div&gt;The next step is to create a function that return a collections of the available video. This is the function to feed our data grid data source.&lt;br /&gt;&lt;br /&gt;picture 5 (click to enlarge)&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #b45f06;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;C#&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_Uhhl5APoI/AAAAAAAAAHg/TTArdf5wGxA/s1600/4A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="81" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_Uhhl5APoI/AAAAAAAAAHg/TTArdf5wGxA/s320/4A.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="color: #b45f06;"&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;VB.NET&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_UiMIKuciI/AAAAAAAAAHw/V_ad3ez-QRU/s1600/4B.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_UiMIKuciI/AAAAAAAAAHw/V_ad3ez-QRU/s320/4B.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Data Grid can display the information in differrent pages. Everytime you select on of the element page, the Data Grid will raise the PageIndexChanged event. Feed you DataGrid source on this event as seen on picture 6. I used try and catch to anticipate the condition while you are clicking to the page which not longer exist because the data for that page has been deleted by other users. &lt;br /&gt;&lt;br /&gt;picture 6 (click to enlarge)&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #b45f06;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;C#&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_UjegLA8jI/AAAAAAAAAH4/42yq9BcRoRw/s1600/5A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_UjegLA8jI/AAAAAAAAAH4/42yq9BcRoRw/s320/5A.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="color: #b45f06;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;VB.NET&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/S_Uj4i2vEFI/AAAAAAAAAII/3gt-ak3Zry4/s1600/5B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/S_Uj4i2vEFI/AAAAAAAAAII/3gt-ak3Zry4/s320/5B.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The real work is actually done on Data Grid event &lt;b&gt;ItemDataBound&lt;/b&gt;. That is when the Data Grid trying to pass on each data chunk to the associated data fields on row by row basis. &lt;br /&gt;&lt;br /&gt;picture 7 (click to enlarge)&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #b45f06;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;C#&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_UnP1szTvI/AAAAAAAAAIQ/VCba1g86T24/s1600/6A.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_UnP1szTvI/AAAAAAAAAIQ/VCba1g86T24/s320/6A.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="color: #b45f06;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;VB.NET&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_ZYtIxVFjI/AAAAAAAAAI4/ECaovr49T5A/s1600/6B.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_ZYtIxVFjI/AAAAAAAAAI4/ECaovr49T5A/s1600/6B.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="21" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_ZYtIxVFjI/AAAAAAAAAI4/ECaovr49T5A/s400/6B.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="color: black;"&gt;In my example i inserted &lt;b&gt;Panel&lt;/b&gt; web control first as a canvas so i would be able to place the next web controls on precise positions to give a nice look. I just tried to avoid using &lt;b&gt;Table&lt;/b&gt;. You can download the source codes from the link below and debug it by your self.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100520/DataGrid%20Customization%20Part%20I/DataGridCSharp.rar"&gt;&lt;b&gt;Source C#&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100520/DataGrid%20Customization%20Part%20I/DataGridVB.rar"&gt;&lt;b&gt;Source VB.NET&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Creating-DataGrid-Updating-Its-Records/dp/B0006I0W04?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Creating a DataGrid and Updating Its Records on the Fly" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=B0006I0W04&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Drilldowns-DataGrid-Jesudas-Chinnathampi/dp/B0007MHFCM?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" style="margin-left: 20px; margin-right: 20px;" target="_blank"&gt;&lt;img alt="Drilldowns In DataGrid" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=B0007MHFCM&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Creating-DataGrid-Updating-Its-Records/dp/B0006I0W04?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="Creating a DataGrid and Updating Its Records on the Fly" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=B0006I0W04&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-7893318686189511873?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/7893318686189511873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/datagrid-customization.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/7893318686189511873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/7893318686189511873'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/datagrid-customization.html' title='DataGrid  Customization Part I'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_vPSWlMYlhHg/S_Ued4kNQ_I/AAAAAAAAAHA/a5s_zf6D7Io/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-178072400261036684</id><published>2010-05-16T22:15:00.001-07:00</published><updated>2010-05-20T04:16:30.477-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XPath'/><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>XPath - Filtering Part II</title><content type='html'>Quering in XPATH is as easy as in MS SQL. You can try "&lt;b style="color: #0b5394;"&gt;Select * from Books Where Publisher like '%Pelican%' and id &amp;gt; 500 &lt;/b&gt;" on SQL Statement turns to be "&lt;b&gt;&lt;span style="color: #b45f06;"&gt;books/book[contains(publisher,'Pelican') and id &amp;gt; 500]&lt;/span&gt;&lt;/b&gt;" on XPath Expression.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_DSpe9uPRI/AAAAAAAAAGo/DlpStDFNCp0/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="197" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S_DSpe9uPRI/AAAAAAAAAGo/DlpStDFNCp0/s400/1.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The following below is the list of XPath string function you can try by your self :&lt;br /&gt;&lt;br /&gt;&lt;table style="display:block;" cellpadding="2" cellspacing="2"&gt;&lt;tr&gt; &lt;td style="width:140px;"&gt;&lt;br /&gt;concat()&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;concentrates two string values&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;contains()&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;Returns a Boolean value indicating whether the first value contains the second (true), or not (false)&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;normalize-space()&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;Leading and trailing spaces are removed from the value&lt;br /&gt;&lt;/td&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;starts-with()&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;Returns a Boolean value indicating whether the first value begins with the second value passed in&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;td&gt;&lt;br /&gt;string()&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;Converts a value to a string&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;string-length()&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;Returns the length of a string value&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;substring()&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;Returns a portion of a string. The first parameter is the string, the second is the starting point of the substring, and the third parameter is the ending point of the substring returned.&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div style="display: block;"&gt;&lt;table border="0" cellpadding="2" cellspacing="2"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;td align="left" colspan="3"&gt;&lt;br /&gt;Recommended Books:&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/XSLT-XPath-Programmers-Reference-Programmer/dp/0470192747?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0470192747&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt;  &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Xpath-Xpointer-Locating-Content-Documents/dp/0596002912?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" style="margin-left: 20px; margin-right: 20px;" target="_blank"&gt;&lt;img alt="Xpath and Xpointer: Locating Content in XML Documents" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0596002912&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt;  &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/XPath-2-0-Programmers-Reference-Programmer/dp/0764569104?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="XPath 2.0 Programmer's Reference (Programmer to Programmer)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0764569104&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-178072400261036684?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/178072400261036684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/xpath-filtering-part-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/178072400261036684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/178072400261036684'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/xpath-filtering-part-ii.html' title='XPath - Filtering Part II'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_vPSWlMYlhHg/S_DSpe9uPRI/AAAAAAAAAGo/DlpStDFNCp0/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-3503142667556505320</id><published>2010-05-14T01:56:00.000-07:00</published><updated>2010-05-20T04:17:09.706-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XPath'/><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>XPath - Filtering Part I</title><content type='html'>&lt;div style="display: block;"&gt;We can use XPath to filter the nodes that contain certain criterias. Just assume you a XML document as shown on picture .1. below. Then you only want to get the &lt;b&gt;Book&lt;/b&gt; nodes which their &lt;b&gt;id&lt;/b&gt; is greater than 300 and lower than 500. Picture .2. is showing the expression to do so.&lt;br /&gt;&lt;br /&gt;Picture .1. (click to enlarge)&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; display: block;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/S-0RgYt0eDI/AAAAAAAAAFY/ym1J9h20LPs/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/S-0RgYt0eDI/AAAAAAAAAFY/ym1J9h20LPs/s200/1.gif" width="106" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="display: block;"&gt;Picture .2.&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; display: block;"&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/S-0SgcY4lDI/AAAAAAAAAFg/TM1w_AgN8mE/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/S-0SgcY4lDI/AAAAAAAAAFg/TM1w_AgN8mE/s320/1.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="display: block;"&gt;Picture .3. (click to enlarge)&lt;/div&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; display: block;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S-0S8Ojc8PI/AAAAAAAAAFo/u6l6KTD9Phs/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="206" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S-0S8Ojc8PI/AAAAAAAAAFo/u6l6KTD9Phs/s400/1.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="display: block;"&gt;VB.Net&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; display: block;"&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S-0T3PUy3mI/AAAAAAAAAFw/G5KrTv9o-68/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="207" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S-0T3PUy3mI/AAAAAAAAAFw/G5KrTv9o-68/s400/1.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; display: block;"&gt;Picture .4.&lt;/div&gt;&lt;div class="separator" style="clear: both; display: block;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; display: block;"&gt;&amp;nbsp;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S-0jcY0uo-I/AAAAAAAAAGA/if39poFmVhc/s1600/1.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S-0jcY0uo-I/AAAAAAAAAGA/if39poFmVhc/s320/1.gif" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100514/xpath-filtering/XPathCSharp.rar"&gt;Source C#&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100514/xpath-filtering/XPathVBNET.rar"&gt;Source VB.NET&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="display: block;"&gt;&lt;table border="0" cellpadding="2" cellspacing="2"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;td align="left" colspan="3"&gt;&lt;br /&gt;Recommended Books:&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/XSLT-XPath-Programmers-Reference-Programmer/dp/0470192747?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0470192747&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt;  &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Xpath-Xpointer-Locating-Content-Documents/dp/0596002912?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" style="margin-left: 20px; margin-right: 20px;" target="_blank"&gt;&lt;img alt="Xpath and Xpointer: Locating Content in XML Documents" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0596002912&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt;  &lt;td&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/XPath-2-0-Programmers-Reference-Programmer/dp/0764569104?ie=UTF8&amp;amp;tag=codeg06-20&amp;amp;link_code=bil&amp;amp;camp=213689&amp;amp;creative=392969" imageanchor="1" target="_blank"&gt;&lt;img alt="XPath 2.0 Programmer's Reference (Programmer to Programmer)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;ASIN=0764569104&amp;amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-3503142667556505320?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/3503142667556505320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/xpath-filtering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3503142667556505320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/3503142667556505320'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/xpath-filtering.html' title='XPath - Filtering Part I'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_vPSWlMYlhHg/S-0RgYt0eDI/AAAAAAAAAFY/ym1J9h20LPs/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-5072910204809328955</id><published>2010-05-12T21:59:00.000-07:00</published><updated>2010-05-15T20:52:50.644-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XPath'/><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Navigating XML Nodes With XPATH</title><content type='html'>XPath is an expression that is used to find parts in XML documents. Those parts are mostly nodes or node attributes. You can find more XPath definition on &lt;b&gt;&lt;a href="http://www.w3schools.com/xpath" style="text-decoration: none;"&gt;http://www.w3schools.com/xpath&lt;/a&gt;&lt;/b&gt; .&lt;br /&gt;&lt;br /&gt;Just imagine  someone give you a complex XML documents and you want to extract specific information from it. It would be easier for you to search specific information by using XPath instead of scanning all the nodes from the root down to next child nodes one by one. XPath will help to do that for you. What you need to do is giving it an expression parameter that shows hirarchy of the selected node you want to observe.&lt;br /&gt;&lt;br /&gt;In this experiment i  am going to use data from RSS Feed&amp;nbsp;&lt;a href="http://www.onenews.co.nz/" style="text-decoration: none;"&gt;&lt;b style="background-color: white;"&gt;www.onenews.co.nz&lt;/b&gt;&lt;/a&gt; and save it as XML document in my project. Now i want to get all the title for each item, as you can see on below picture (within the red box).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;picture .1. (click to enlarge)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_vPSWlMYlhHg/S-vCvCqr7HI/AAAAAAAAAFI/RpHsxqeWJ08/s1600/1.gif" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/S-vCvCqr7HI/AAAAAAAAAFI/RpHsxqeWJ08/s320/1.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We need to tell XPath the position of title on the XML document in hirarchical order. Picture .1. tell us that the &lt;b&gt;title&lt;/b&gt; is under the &lt;b&gt;item&lt;/b&gt;,&lt;b&gt;item&lt;/b&gt; is under &lt;b&gt;channel&lt;/b&gt; and &lt;b&gt;channel&lt;/b&gt; is right under the &lt;b&gt;rss&lt;/b&gt; (the root). Picture .2. shows how that information is passed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;picture .2.&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S-vMZW1x21I/AAAAAAAAAFQ/iCoEMHbblS0/s1600/1.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S-vMZW1x21I/AAAAAAAAAFQ/iCoEMHbblS0/s1600/1.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="20" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S-vMZW1x21I/AAAAAAAAAFQ/iCoEMHbblS0/s640/1.gif" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can download the provided source code. When you run it,the result would be seen on picture .3.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;picture .3.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S-uHyda_s9I/AAAAAAAAAE4/52oBOo1cCqc/s1600/1.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5470615473332663250" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S-uHyda_s9I/AAAAAAAAAE4/52oBOo1cCqc/s400/1.gif" style="height: 204px; margin: 0pt 10px 10px 0pt; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100512/navigating-xml-nodes-with-xpath/XPathExampleCSharp.rar"&gt;Source C#&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100512/navigating-xml-nodes-with-xpath/XPathExampleVB.rar"&gt;Source VB.NET&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="2" cellspacing="2"&gt;&lt;tr&gt;&lt;td colspan="3" align="left"&gt;&lt;br /&gt;Recommended Book :&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;&lt;br /&gt;&lt;a imageanchor="1" target="_blank"  href="http://www.amazon.com/XPath-Kick-Start-Navigating-XML/dp/0672324113?ie=UTF8&amp;tag=codeg06-20&amp;link_code=bil&amp;camp=213689&amp;creative=392969"&gt;&lt;img alt="XPath Kick Start: Navigating XML with XPath 1.0 and 2.0" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL160_&amp;ASIN=0672324113&amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;l=bil&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0672324113" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;&lt;br /&gt;&lt;/td&gt;     &lt;td&gt;&lt;br /&gt;&lt;a style="margin-left:20px;margin-right:20px;" imageanchor="1" target="_blank"  href="http://www.amazon.com/XSLT-XPath-Edge-Professional-Mindware/dp/0764547763?ie=UTF8&amp;tag=codeg06-20&amp;link_code=bil&amp;camp=213689&amp;creative=392969"&gt;&lt;img alt="XSLT and XPath On The Edge (Professional Mindware)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL160_&amp;ASIN=0764547763&amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;l=bil&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0764547763" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;&lt;br /&gt;&lt;/td&gt;     &lt;td&gt;&lt;br /&gt;&lt;a imageanchor="1" target="_blank"  href="http://www.amazon.com/XSLT-Cookbook-Solutions-Examples-Developers/dp/0596009747?ie=UTF8&amp;tag=codeg06-20&amp;link_code=bil&amp;camp=213689&amp;creative=392969"&gt;&lt;img alt="XSLT Cookbook: Solutions and Examples for XML and XSLT Developers, 2nd Edition" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL160_&amp;ASIN=0596009747&amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;l=bil&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596009747" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;&lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-5072910204809328955?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/5072910204809328955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/navigating-xml-nodes-with-xpath.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/5072910204809328955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/5072910204809328955'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/navigating-xml-nodes-with-xpath.html' title='Navigating XML Nodes With XPATH'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_vPSWlMYlhHg/S-vCvCqr7HI/AAAAAAAAAFI/RpHsxqeWJ08/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-7247775722851976593</id><published>2010-05-12T04:17:00.000-07:00</published><updated>2010-05-15T21:05:02.721-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Query'/><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Stored Procedure'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>WCF - The Simple Example Project</title><content type='html'>Windows Communication Foundation or WCF has many similarities if we compare it &lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;amp;l=bil&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=B001SK4JXK" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" /&gt;with DCOM (Distributed Component Object Model) in 1998s. Both bring up the consept on how to distribute the process to other computers on the network and bring back the result of the operation to the calling computers. By this way the system is becoming more scalable to handle the rapid growing data to be processed.&lt;br /&gt;&lt;br /&gt;But WCF is better off in term of how the data is formatted and transported.&amp;nbsp; It starts with TCP/IP, MSMQ,FTP and the Name Pipe.&amp;nbsp; And it uses XML as a document format for data exchange, in which also can be digested easly by non Microsoft platform such Java. And the main element that elivitates WCF on the horizon is the IIS.Even though you still can run WCF as part of MS Windows Services but most people run their WCF on IIS as services.&lt;br /&gt;&lt;b&gt; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Database&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;To run the example you need to download the database first and attach that database to your local MSSQL Server. In this case i was using MSSQL Express 2005. This database contains &lt;b&gt;Book&lt;/b&gt; table and several stored procedures.&lt;br /&gt;&lt;br /&gt;picture .1.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S-sdfCDmsrI/AAAAAAAAAEY/ZZMHp6uniBY/s1600/1.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5470498591336739506" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S-sdfCDmsrI/AAAAAAAAAEY/ZZMHp6uniBY/s400/1.gif" style="cursor: pointer; float: left; height: 400px; margin: 0pt 10px 10px 0pt; width: 197px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After you attach your database, you need to modify the connection string on the web config. You need to change to server name according to yours. In my case i used &lt;b&gt;LivingSuburb&lt;/b&gt; as my server name.&lt;br /&gt;&lt;br /&gt;picture .2. (click to enlarge)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S-se43SdZHI/AAAAAAAAAEg/Og1Em0UCJJM/s1600/1.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5470500134634480754" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S-se43SdZHI/AAAAAAAAAEg/Og1Em0UCJJM/s400/1.gif" style="cursor: pointer; float: left; height: 18px; margin: 0pt 10px 10px 0pt; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Server Host&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Now it is time to open the host project with Visual Studio and run it. &lt;br /&gt;&lt;br /&gt;picture .3.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S-sbZHjZBLI/AAAAAAAAAEI/eaGX9ooqvLQ/s1600/1.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5470496290709767346" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S-sbZHjZBLI/AAAAAAAAAEI/eaGX9ooqvLQ/s400/1.gif" style="cursor: pointer; float: left; height: 226px; margin: 0pt 10px 10px 0pt; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Client&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;to insert&lt;br /&gt;picture .3.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S-sSmcpYdyI/AAAAAAAAADw/O3kY8sVUNtw/s1600/1.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5470486624105690914" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S-sSmcpYdyI/AAAAAAAAADw/O3kY8sVUNtw/s400/1.gif" style="cursor: pointer; float: left; height: 36px; margin: 0pt 10px 10px 0pt; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;to update&lt;br /&gt;&lt;br /&gt;picture .4.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S-sZ772qJNI/AAAAAAAAAEA/lyiwdl8BCfk/s1600/4.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5470494689841521874" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S-sZ772qJNI/AAAAAAAAAEA/lyiwdl8BCfk/s400/4.gif" style="cursor: pointer; float: left; height: 146px; margin: 0pt 10px 10px 0pt; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;to show all the record&lt;br /&gt;&lt;br /&gt;picture .5.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S-sTn9JBnUI/AAAAAAAAAD4/C-xKbTxCZpg/s1600/2.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5470487749519842626" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S-sTn9JBnUI/AAAAAAAAAD4/C-xKbTxCZpg/s400/2.gif" style="cursor: pointer; float: left; height: 166px; margin: 0pt 10px 10px 0pt; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;to read a specific record&lt;br /&gt;&lt;br /&gt;picture .6.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S-sfzrgc0ZI/AAAAAAAAAEo/kuzXGbtBLkU/s1600/1.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5470501145084219794" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S-sfzrgc0ZI/AAAAAAAAAEo/kuzXGbtBLkU/s400/1.gif" style="cursor: pointer; float: left; height: 56px; margin: 0pt 10px 10px 0pt; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100512/wcf-simple-example-project/HostBookService.rar"&gt;Server Host C#&lt;/a&gt;   &lt;a href="http://download.livingsuburb.com.au/20100512/wcf-simple-example-project/ClientBookService.rar"&gt;Client Application C#&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100512/wcf-simple-example-project/HostBookServiceVB.rar"&gt;Server Host VB.NET&lt;/a&gt;  &lt;a href="http://download.livingsuburb.com.au/20100512/wcf-simple-example-project/ClientBookServiceVB.rar"&gt;Client Application VB.NET&lt;/a&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100512/wcf-simple-example-project/BookServiceDataBase.rar"&gt;Database&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="2" cellspacing="2"&gt;&lt;tr&gt; &lt;td colspan="3" align="left"&gt;&lt;br /&gt;Recommended Book :&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;br /&gt;&lt;a imageanchor="1" target="_blank"  href="http://www.amazon.com/Programming-WCF-Services-Juval-Lowy/dp/0596521308?ie=UTF8&amp;tag=codeg06-20&amp;link_code=bil&amp;camp=213689&amp;creative=392969"&gt;&lt;img alt="Programming WCF Services" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL160_&amp;ASIN=0596521308&amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;l=bil&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596521308" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a style="margin-left:20px;margin-right:20px;" imageanchor="1" target="_blank"  href="http://www.amazon.com/Professional-WCF-Windows-Communication-Foundation/dp/0470563141?ie=UTF8&amp;tag=codeg06-20&amp;link_code=bil&amp;camp=213689&amp;creative=392969"&gt;&lt;img alt="Professional WCF 4: Windows Communication Foundation with .NET 4" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL160_&amp;ASIN=0470563141&amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;l=bil&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0470563141" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;&lt;br /&gt;&lt;/td&gt; &lt;td&gt;&lt;br /&gt;&lt;a imageanchor="1" target="_blank"  href="http://www.amazon.com/Pro-WCF-Practical-Microsoft-Implementation/dp/1590597028?ie=UTF8&amp;tag=codeg06-20&amp;link_code=bil&amp;camp=213689&amp;creative=392969"&gt;&lt;img alt="Pro WCF: Practical Microsoft SOA Implementation" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL160_&amp;ASIN=1590597028&amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;l=bil&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1590597028" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-7247775722851976593?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/7247775722851976593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/wcf-simple-example-project.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/7247775722851976593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/7247775722851976593'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/05/wcf-simple-example-project.html' title='WCF - The Simple Example Project'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_vPSWlMYlhHg/S-sdfCDmsrI/AAAAAAAAAEY/ZZMHp6uniBY/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-8991383392111549140</id><published>2010-04-30T02:36:00.000-07:00</published><updated>2010-05-01T05:34:47.493-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='WebClient'/><category scheme='http://www.blogger.com/atom/ns#' term='Thread'/><category scheme='http://www.blogger.com/atom/ns#' term='Console Application'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Keeping Your Web Application Active</title><content type='html'>I had a personal bad experience with web hosting company. It seemed like they had set up their web servers to terminate any web application that was idle around 1 minute. That caused problem with my site. Because my site is new and only few user came to visit so every user experienced a long delay as the IIS recompiled my web application all over again.&lt;br /&gt;&lt;br /&gt;It made me think on how to keep my web application looks actively accessed by many users. Then i made this &lt;span style="font-weight: bold;"&gt;KeepAlive&lt;/span&gt; console application. It is easy to be used and very light.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100430/Keeping%20Your%20Web%20Application%20Active/KeepAliveCS.rar"&gt;Source Code C#&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-8991383392111549140?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/8991383392111549140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/04/keeping-your-web-application-active.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/8991383392111549140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/8991383392111549140'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/04/keeping-your-web-application-active.html' title='Keeping Your Web Application Active'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2790750329469603390.post-933362060653560648</id><published>2010-04-18T18:43:00.000-07:00</published><updated>2010-05-15T21:08:22.757-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>Simulating SQL Query  SELECT IN on LINQ</title><content type='html'>We have a student table. It contains 7 records.  Now we intend to use the &lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;SELECT IN&lt;/span&gt; statement to get records with id 2,5 and 7.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vCJJkKwuI/AAAAAAAAACU/jN7djOladU8/s1600/1.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: left; cursor: pointer; width: 320px; height: 150px;" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vCJJkKwuI/AAAAAAAAACU/jN7djOladU8/s320/1.gif" alt="" id="BLOGGER_PHOTO_ID_5461672435559088866" border="0" /&gt;&lt;/a&gt;&lt;div style="text-align: center; font-weight: bold;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;select * from student where id in (2,5,7)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-weight: normal;"&gt;And the result is :&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_vPSWlMYlhHg/S8vFWzZd16I/AAAAAAAAACc/4Ug1PDc52xw/s1600/2.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 252px; height: 119px;" src="http://2.bp.blogspot.com/_vPSWlMYlhHg/S8vFWzZd16I/AAAAAAAAACc/4Ug1PDc52xw/s320/2.gif" alt="" id="BLOGGER_PHOTO_ID_5461675968661673890" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;We can do similar query on LINQ.  First i need to create an Object that has similar properties as the &lt;span style="font-weight: bold;"&gt;Student&lt;/span&gt; table has.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vJDq_E3hI/AAAAAAAAACk/Rwt__qd7Wa0/s1600/3.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 184px; height: 320px;" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vJDq_E3hI/AAAAAAAAACk/Rwt__qd7Wa0/s320/3.gif" alt="" id="BLOGGER_PHOTO_ID_5461680038032498194" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;Second step is to create a list of Student that contains 7 records to mimic the same values as shown on &lt;span style="font-weight: bold;"&gt;Student&lt;/span&gt; table.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_vPSWlMYlhHg/S8vPmLSP8QI/AAAAAAAAACs/3-nrXHJZZ4I/s1600/4.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 169px;" src="http://1.bp.blogspot.com/_vPSWlMYlhHg/S8vPmLSP8QI/AAAAAAAAACs/3-nrXHJZZ4I/s320/4.gif" alt="" id="BLOGGER_PHOTO_ID_5461687227888169218" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: normal;"&gt;Third, we create another List that holds the selected id we about to retrieve.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vR6YB10dI/AAAAAAAAAC0/Gj99kcH0iFQ/s1600/5.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 23px;" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vR6YB10dI/AAAAAAAAAC0/Gj99kcH0iFQ/s320/5.gif" alt="" id="BLOGGER_PHOTO_ID_5461689773929648594" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: normal;"&gt;Fourth, we construct the LINQ query , join the two list but only select from the first like everything that their id are match with the id of the second list.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_vPSWlMYlhHg/S8vT2iwHDhI/AAAAAAAAAC8/juS84Cxx6gA/s1600/6.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 30px;" src="http://3.bp.blogspot.com/_vPSWlMYlhHg/S8vT2iwHDhI/AAAAAAAAAC8/juS84Cxx6gA/s320/6.gif" alt="" id="BLOGGER_PHOTO_ID_5461691907111849490" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;Fifth, simply just to prove the result.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vUaP1ulKI/AAAAAAAAADE/4xfhVPgqX2I/s1600/7.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 52px;" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vUaP1ulKI/AAAAAAAAADE/4xfhVPgqX2I/s320/7.gif" alt="" id="BLOGGER_PHOTO_ID_5461692520510428322" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vVdG8-bxI/AAAAAAAAADM/At5YkUV-Sho/s1600/8.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 90px;" src="http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vVdG8-bxI/AAAAAAAAADM/At5YkUV-Sho/s320/8.gif" alt="" id="BLOGGER_PHOTO_ID_5461693669176143634" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.livingsuburb.com.au/20100418/Simulating%20SQL%20Query%20SELECT%20IN%20on%20LINQ/ConsoleCS.rar"&gt;Source Code - C#&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://download.livingsuburb.com.au/20100418/Simulating%20SQL%20Query%20SELECT%20IN%20on%20LINQ/ConsoleVB.rar"&gt;&lt;span style="font-weight: normal;"&gt;Source Code - VB.NET&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tr&gt;    &lt;td&gt;&lt;br /&gt;&lt;a imageanchor="1" target="_blank"  href="http://www.amazon.com/LINQ-Action-Fabrice-Marguerie/dp/1933988169?ie=UTF8&amp;tag=codeg06-20&amp;link_code=bil&amp;camp=213689&amp;creative=392969"&gt;&lt;img alt="LINQ in Action" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL160_&amp;ASIN=1933988169&amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;l=bil&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1933988169" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;&lt;br /&gt;&lt;/td&gt;    &lt;td&gt;&lt;br /&gt;&lt;a style="margin-left:20px;margin-right:20px;" imageanchor="1" target="_blank"  href="http://www.amazon.com/Linq-Pocket-Reference-OReilly/dp/0596519249?ie=UTF8&amp;tag=codeg06-20&amp;link_code=bil&amp;camp=213689&amp;creative=392969"&gt;&lt;img alt="Linq Pocket Reference (Pocket Reference (O&amp;#39;Reilly))" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL160_&amp;ASIN=0596519249&amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;l=bil&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=0596519249" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;&lt;br /&gt;&lt;/td&gt;     &lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;a imageanchor="1" target="_blank"  href="http://www.amazon.com/Programming-Entity-Framework-Julia-Lerman/dp/059652028X?ie=UTF8&amp;tag=codeg06-20&amp;link_code=bil&amp;camp=213689&amp;creative=392969"&gt;&lt;img alt="Programming Entity Framework" src="http://ws.amazon.com/widgets/q?MarketPlace=US&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL160_&amp;ASIN=059652028X&amp;tag=codeg06-20" /&gt;&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=codeg06-20&amp;l=bil&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=059652028X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;tr&gt; &lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2790750329469603390-933362060653560648?l=johnhadikusumo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://johnhadikusumo.blogspot.com/feeds/933362060653560648/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/04/simulating-select-in-on-linq.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/933362060653560648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2790750329469603390/posts/default/933362060653560648'/><link rel='alternate' type='text/html' href='http://johnhadikusumo.blogspot.com/2010/04/simulating-select-in-on-linq.html' title='Simulating SQL Query  SELECT IN on LINQ'/><author><name>John Hadikusumo</name><uri>http://www.blogger.com/profile/12208386276596882177</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/-HC4eqd_3tKI/TYcHYFnC4nI/AAAAAAAAAXw/WBNpl0f-bF0/s220/187628_749296872_6968295_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_vPSWlMYlhHg/S8vCJJkKwuI/AAAAAAAAACU/jN7djOladU8/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
