<?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:blogger='http://schemas.google.com/blogger/2008' 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-4341475203469836024</id><updated>2024-10-04T18:59:41.353-07:00</updated><category term="jQuery"/><category term="jQuery Tips"/><category term="ASP.Net"/><category term="LINQ"/><category term="SEO Tips"/><category term="ASMX"/><category term="Ajax"/><category term="LINQ to SQL"/><category term="LINQ to XML"/><category term="REST"/><category term="WCF"/><category term="Web Service"/><category term="Website development"/><title type='text'>Code Tech Blog</title><subtitle type='html'>Every now and then you run into a small discovery that you know you will ever need again in your life. This is where I throw together all of mine. Perhaps they come in handy for you too...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-1174994238002393910</id><published>2010-12-06T20:09:00.000-08:00</published><updated>2010-12-06T20:09:11.806-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASMX"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><category scheme="http://www.blogger.com/atom/ns#" term="REST"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF"/><category scheme="http://www.blogger.com/atom/ns#" term="Web Service"/><title type='text'>JQuery: Consuming WCF / ASMX / REST service</title><content type='html'>In this article I will explain how to consume a WCF / ASMX service using jQuery.  The scope of the article is limited to creating &amp;amp;  consuming different kind of services using jQuery. I have segregated this article into 7 topics based on the service consumption.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Calling ASMX Web service using jQuery&lt;/li&gt;
&lt;li&gt;Calling WCF service using jQuery and retrieving data in JSON Format&lt;/li&gt;
&lt;li&gt;Calling WCF service using jQuery and retrieving data in XML Format&lt;/li&gt;
&lt;li&gt;Calling WCF service using jQuery and retrieving data in JSON Format (pass multiple input parameters) &amp;amp; ( Get multiple objects as output using DataContract)&lt;/li&gt;
&lt;li&gt;Calling WCF service using jQuery[ Get Method] and retrieving data in JSON Format&lt;/li&gt;
&lt;li&gt;Calling REST based WCF service using jQuery&lt;/li&gt;
&lt;li&gt;Streaming an image through WCF and request it through HTTP GET verb..&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
If you have never heard about jQuery or WCF or JSON, please learn it before dwelling into this article. The scope  is limited to service creation and consumption. &lt;br /&gt;
&lt;br /&gt;
In the below example I have  used jQuery version 1.3.2 , you can download the same from http://jQuery.com/. This article demonstrates how our jQuery based browser app will retrieve the Provinces for supplied country. All the services are hosted in the same web  application. Please download the source code to experiment the sample by yourself.&lt;br /&gt;
&lt;br /&gt;
For calling the service we need to use the .ajax method of jQuery which makes XMLHttpRequest &lt;br /&gt;
to the server.   In the below code section I have explained the key value pair attributes to be passed  by marking comments on the right side of the attribute. &lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot; src=&quot;script/jQuery-1.3.2.min.js&quot; &quot;&amp;gt;&amp;lt;/script&amp;gt;

     &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;

        var varType;
        var varUrl;
        var varData;
        var varContentType;
        var varDataType;
        var varProcessData; 

        function CallService() 
        {
                $.ajax({
                    type                : varType, //GET or POST or PUT or DELETE verb
                    url                   : varUrl, // Location of the service
                    data                : varData, //Data sent to server
                    contentType    : varContentType, // content type sent to server
                    dataType         : varDataType, //Expected data format from server
                    processdata    : varProcessData, //True or False
                    success            : function(msg) {//On Successfull service call
                    ServiceSucceeded(msg);                    
                    },
                    error: ServiceFailed// When Service call fails
                });
        }
    &amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;I have made the above method generic to use it for all different type of services which we are going to discuss.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Business Logic:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Business logic for below demonstrated service is quite simple, we store Country and Province details in a Name Value collection ,When a request supplies the country name it returns the provinces associated with it. &lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;public class CountryProvinceBL
{
    NameValueCollection nvProvince = null;
    public CountryProvinceBL()
    {
        nvProvince = new NameValueCollection();
        nvProvince.Add(&quot;usa&quot;, &quot;Massachusetts&quot;);
        nvProvince.Add(&quot;usa&quot;, &quot;California&quot;);
        nvProvince.Add(&quot;india&quot;, &quot;Tamil Nadu&quot;);
        nvProvince.Add(&quot;india&quot;, &quot;Karnataka&quot;);
    }
    
    public string[] GetProvince(string Country)
    {  return nvProvince.GetValues(Country).ToArray();}

}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Calling ASMX Web service using jQuery&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Create a web service and add the below code&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;[WebService(Namespace = &quot;http://tempuri.org/&quot;)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// Below line allows the web service to be called through HTTP protocol. 
[System.Web.Script.Services.ScriptService]
public class CountryProvinceWebService : System.Web.Services.WebService
{

    [WebMethod]
   //Business Logic returns the provinces for the supplied country
    public string[] GetProvince(string Country) 
    {  return new CountryProvinceBL().GetProvince(Country); }    
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Step 2:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Invoke the below method on button click&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;unction CountryProvinceWebService() {
            varType              = &quot;POST&quot;;         
            varUrl                 = &quot;service/CountryProvinceWebService.asmx/GetProvince&quot;; 
            //Pass country from drop down ddlCountry&#39;
            varData               = &#39;{&quot;Country&quot;: &quot;&#39; + $(&#39;#ddlCountry&#39;).val() + &#39;&quot;}&#39;;
            varContentType  = &quot;application/json; charset=utf-8&quot;;
            varDataType       = &quot;json&quot;;varProcessData = true; CallService();
        }

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 3:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
On Success  &quot;ServiceSucceeded&quot; will be called and it will populate the provinces dropdown with the values sent by the server.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;
function ServiceSucceeded(result) {
            var ProvinceDDL = document.getElementById(&quot;ddlProvince&quot;);
            for (j = ProvinceDDL.options.length - 1; j &amp;gt;= 0; j--) { ProvinceDDL.remove(j); }
            var resultObject = result.d; // Constructed object name will be object.d //Button 
            for (i = 0; i &amp;lt; resultObject.length; i++) {
                    var opt = document.createElement(&quot;option&quot;); opt.text = resultObject[i];
                    ProvinceDDL.options.add(opt)
                }
        }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;2. Calling WCF service using jQuery and retrieving data in JSON Format &lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Define  the Contracts  in the interface ICountryProvinceWCFService&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;[ServiceContract]
public interface ICountryProvinceWCFService
{
    [OperationContract]
    [WebInvoke(Method = &quot;POST&quot;,BodyStyle=WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]    
    string[] GetProvince(string Country);
}

Implement the contract in class CountryProvinceWCFService 

public class CountryProvinceWCFService : ICountryProvinceWCFService
{   
  // Call Business Logic to get provinces
    public string[] GetProvince(string Country)
    {return new CountryProvinceBL().GetProvince(Country); }
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Step 2:   &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Define the configuration in web.config&lt;br /&gt;
&lt;br /&gt;
a) &lt;servicemetadata httpgetenabled=&quot;true&quot;&gt; enables the user to view the metadata through web browser and generate WSDL  file&lt;br /&gt;
&lt;br /&gt;
b)  setting includeExceptionDetailInFaults = &quot;true&quot; allows the WCF service throw original error , it will be useful while debugging the application.&lt;br /&gt;
&lt;br /&gt;
c) Adding         &lt;webhttp&gt; to endpoint behaviour  &amp;amp; webHttpBinding  to binding enables the web programming model for WCF and allows the service to be accessible through web protocols.&lt;br /&gt;
&lt;br /&gt;
d) Define contract and  name of the service&lt;br /&gt;
&lt;br /&gt;
Step 3:&lt;br /&gt;
&lt;br /&gt;
Invoke the WCF service on the button click event&lt;br /&gt;
&lt;br /&gt;
&lt;/webhttp&gt;&lt;/servicemetadata&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;function CountryProvinceWCFJSON() {
            varType              = &quot;POST&quot;;
            varUrl                 = &quot;service/CountryProvinceWCFService.svc/GetProvince&quot;;
            varData              = &#39;{&quot;Country&quot;: &quot;&#39; + $(&#39;#ddlCountry&#39;).val() + &#39;&quot;}&#39;;
            varContentType = &quot;application/json; charset=utf-8&quot;;
            varDataType      = &quot;json&quot;; varProcessData = true; CallService();
        }

&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
On successful service invocation  &quot;ServiceSucceeded&quot; will be called and the province value will get added to province drop down.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;
function ServiceSucceeded(result) {/
       var ProvinceDDL = document.getElementById(&quot;ddlProvince&quot;);
       for (j = ProvinceDDL.options.length - 1; j &amp;gt;= 0; j--) { ProvinceDDL.remove(j); }
               // Constructed object name will be object.[ServiceName]Result // Button 2 &amp;amp; 3
              var resultObject = result.GetProvinceResult;
           for (i = 0; i &amp;lt; resultObject.length; i++) {
               var opt = document.createElement(&quot;option&quot;); opt.text = resultObject[i];
               ProvinceDDL.options.add(opt)
           }       
   }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt; 3. Calling WCF service using jQuery and retrieving data in XML Format&lt;br /&gt;
&lt;br /&gt;
Step 1:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In operation contract set ResponseFormat to XML.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;[OperationContract]
    [WebInvoke(Method = &quot;POST&quot;, BodyStyle = WebMessageBodyStyle.Wrapped,ResponseFormat = WebMessageFormat.Xml)]
    string[] GetProvinceXML(string Country);

Then implement the service 

    public string[] GetProvinceXML(string Country)
    {  return new CountryProvinceBL().GetProvince(Country); }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Use the web.config,  defined in  Figure 1 .&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; Step 2:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Invoke the WCF service on the button click event, Make sure you set the expected data type as XML&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;function CountryProvinceWCFXML() {
            varType              = &quot;POST&quot;;
            varUrl                 = &quot;service/CountryProvinceWCFService.svc/GetProvinceXML&quot;;
            varData              = &#39;{&quot;Country&quot;: &quot;&#39; + $(&#39;#ddlCountry&#39;).val() + &#39;&quot;}&#39;;
            varContentType = &quot;application/json; charset=utf-8&quot;; 
            varDataType      = &quot;xml&quot;;  varProcessData = true; CallService();
        }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt; Step 3:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
On successful service invocation  &quot;ServiceSucceeded&quot; will be called and the province value will get added to province drop down.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;function ServiceSucceeded(result) {
              var ProvinceDDL = document.getElementById(&quot;ddlProvince&quot;);
              for (j = ProvinceDDL.options.length - 1; j &amp;gt;= 0; j--) { ProvinceDDL.remove(j); }
            //Below jQuery code will loop through the XML result set
              $(result).find(&quot;GetProvinceXMLResult&quot;).children().each(function() {
                  var opt = document.createElement(&quot;option&quot;); opt.text = $(this).text();
                  ProvinceDDL.options.add(opt)
              });          
          }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt; 4. Calling WCF service using jQuery and retrieving data in JSON Format (pass multiple input parameters) &amp;amp; ( Get multiple objects as output using DataContract)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In this example Country and Browser type will be passed as input parameter to the WCF service in JSON format, Upon receiving the values the service will send back provinces for the passed country and  some comments for the browser information.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; Step 1: &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Define Data contract and service contact  for the service&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;[DataContract]
public class CustomData
{
    [DataMember]
    public String BrowserInfo;
    [DataMember]
    public String[] ProvinceInfo;
}

  [OperationContract]
    [WebInvoke(Method = &quot;POST&quot;, BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
    CustomData GetProvinceAndBrowser(string Country, string Browser);


And implement the contract in your service call

    public CustomData GetProvinceAndBrowser(string Country, string Browser)
    {
        CustomData customData = new CustomData();
        customData.ProvinceInfo = new CountryProvinceBL().GetProvince(Country);
        if (Browser == &quot;ie&quot;)
            customData.BrowserInfo = &quot; Did you learn to program IE 8.0&quot;;
        else if (Browser == &quot;firefox&quot;)
            customData.BrowserInfo = &quot; Mozilla rocks, try Firebug &amp;amp; Fiddler addon&#39;s&quot;;
        else
            customData.BrowserInfo = &quot; I did not test in this browser&quot;;
        return customData;
    }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; Step 2:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Invoke the WCF service on the button click event, Make sure you set the expected data type as XML&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;function CountryProvinceWCFJSONMulti() {
            var browser = &quot;&quot;;
            if (jQuery.browser.mozilla == true) browser=&quot;firefox&quot;
            else if(jQuery.browser.msie == true) browser = &quot;ie&quot;
            varType                = &quot;POST&quot;;
            varUrl                   = &quot;service/CountryProvinceWCFService.svc/GetProvinceAndBrowser&quot;;
            //We are passing multiple paramers to the service in json format {&quot;Country&quot; : &quot;india&quot;, &quot;Browser&quot;:&quot;ie&quot;}
            varData                = &#39;{&quot;Country&quot;: &quot;&#39; + $(&#39;#ddlCountry&#39;).val() + &#39;&quot;,&quot;Browser&quot;: &quot;&#39; + browser + &#39;&quot;}&#39;;
            varContentType   = &quot;application/json; charset=utf-8&quot;;
            varDataType        = &quot;json&quot;;varProcessData = true; CallService();
    }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt; Step 3:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
On successful service invocation  &quot;ServiceSucceeded&quot; will be called and the province value will get added to province drop down.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt; function ServiceSucceeded(result) {
                    var ProvinceDDL = document.getElementById(&quot;ddlProvince&quot;);
                    for (j = ProvinceDDL.options.length - 1; j &amp;gt;= 0; j--) { ProvinceDDL.remove(j); }                   
                   //WCF Service with multiple output paramaetrs //First object 
                    var resultObject = result.GetProvinceAndBrowserResult.ProvinceInfo;
                    for (i = 0; i &amp;lt; resultObject.length; i++) {
                        var opt = document.createElement(&quot;option&quot;); opt.text = resultObject[i];
                        ProvinceDDL.options.add(opt)
                    }
                    //Second object sent in JSON format
                    $(&quot;#divMulti&quot;).html(result.GetProvinceAndBrowserResult.BrowserInfo);          
                }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt; 5. Calling WCF service using jQuery[ Get Method] and retrieving data in JSON Format&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This time we will use GET Verb instead of POST to retrieve the data through WCF &amp;amp; jQuery&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; Step 1:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
We can use the WebGet attribute instead of WebInvoke to perform the operation,&lt;br /&gt;
[OperationContract]&lt;br /&gt;
[WebGet(ResponseFormat=WebMessageFormat.Json)]&lt;br /&gt;
string[] GetProvinceGET(string Country);&lt;br /&gt;
&lt;br /&gt;
Implement the contract&lt;br /&gt;
&lt;br /&gt;
public string[] GetProvinceGET(string Country)&lt;br /&gt;
{return new CountryProvinceBL().GetProvince(Country);}&lt;br /&gt;
&lt;br /&gt;
And use the web.config defined in figure 1&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; Step 2:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Set the verb to GET instead of POST and pass the data as a query string. Invoke the WCF Service using below method&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;function CountryProvinceWCFJSONGet() {
            varType                 = &quot;GET&quot;;
            varUrl                    = &quot;service/CountryProvinceWCFService.svc/GetProvinceGET?Country=&quot; +$(&#39;#ddlCountry&#39;).val();
            varContentType    = &quot;application/json; charset=utf-8&quot;;
            varDataType = &quot;json&quot;;varProcessData = false; CallService();
        }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
On successful service invocation  &quot;ServiceSucceeded&quot; will be called and the province value will get added to province drop down.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;function ServiceSucceeded(result) {
           var ProvinceDDL = document.getElementById(&quot;ddlProvince&quot;);
           for (j = ProvinceDDL.options.length - 1; j &amp;gt;= 0; j--) { ProvinceDDL.remove(j); }          
           for (i = 0; i &amp;lt; result.length; i++) {
               var opt = document.createElement(&quot;option&quot;); opt.text = result[i];
               ProvinceDDL.options.add(opt)
           }
       }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt; 6. Calling REST based WCF service using jQuery&lt;br /&gt;
&lt;br /&gt;
Step 1:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Define the URI for REST service in the operation contract and set the BodyStyle to Bare. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;[OperationContract]
    [WebInvoke(Method = &quot;GET&quot;, ResponseFormat = WebMessageFormat.Json, UriTemplate = &quot;GetProvinceREST/{Country}&quot;, BodyStyle=WebMessageBodyStyle.Bare)]
    string[] GetProvinceREST(string Country);

Implement the contract:

    public string[] GetProvinceREST(string Country)
    { return new CountryProvinceBL().GetProvince(Country);  }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;Use the web.config defined in Figure 1

&lt;b&gt;Step 2:&lt;/b&gt;

While using REST services use GET verb for retrieving data and POST , PUT , DELETE for modifying, adding and deleting information
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;function CountryProvinceWCFREST() {
            varType               = &quot;GET&quot;;
            varUrl                  = &quot;service/CountryProvinceWCFService.svc/GetProvinceREST/&quot; + $(&#39;#ddlCountry&#39;).val();            
            varContentType  = &quot;application/json; charset=utf-8&quot;;
            varDataType       = &quot;json&quot;; varProcessData = false; CallService();
        }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
On successful service invocation  &quot;ServiceSucceeded&quot; will be called and the province value will get added to province drop down.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;function ServiceSucceeded(result) {
           var ProvinceDDL = document.getElementById(&quot;ddlProvince&quot;);
           for (j = ProvinceDDL.options.length - 1; j &amp;gt;= 0; j--) { ProvinceDDL.remove(j); }          
           for (i = 0; i &amp;lt; result.length; i++) {
               var opt = document.createElement(&quot;option&quot;); opt.text = result[i];
               ProvinceDDL.options.add(opt)
           }
       }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt; Step 1:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Define the contract and set the return type to Stream since we are going to send it in Image/jpeg Format  &lt;br /&gt;
[OperationContract]&lt;br /&gt;
[WebInvoke(Method = &quot;GET&quot;)]&lt;br /&gt;
Stream GetPicture();&lt;br /&gt;
&lt;br /&gt;
Implement the contract&lt;br /&gt;
&lt;br /&gt;
public Stream GetPicture()&lt;br /&gt;
{&lt;br /&gt;
string fileName = Path.Combine(HostingEnvironment.ApplicationPhysicalPath,&quot;vista.jpg&quot;);&lt;br /&gt;
FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);  &lt;br /&gt;
// Set the content type as image/ jpeg&lt;br /&gt;
System.ServiceModel.Web.WebOperationContext.Current.OutgoingResponse.ContentType = &quot;image/jpeg&quot;;&lt;br /&gt;
return (Stream)fileStream;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
And use the web.config which we defined earlier in this article&lt;br /&gt;
&lt;br /&gt;
Step 2:&lt;br /&gt;
&lt;br /&gt;
On Button  click event set the src attribute of  image element [image1] to  the WCF service&lt;br /&gt;
&lt;br /&gt;
function ShowImage() {// Call the WCF service&lt;br /&gt;
$(&quot;#image1&quot;).attr(&#39;src&#39;,&#39;service/CountryProvinceWCFService.svc/GetPicture&#39;);&lt;br /&gt;
&lt;br /&gt;
}</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/1174994238002393910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/12/jquery-consuming-wcf-asmx-rest-service.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/1174994238002393910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/1174994238002393910'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/12/jquery-consuming-wcf-asmx-rest-service.html' title='JQuery: Consuming WCF / ASMX / REST service'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-7237523058360859957</id><published>2010-12-06T19:46:00.000-08:00</published><updated>2010-12-06T19:46:00.488-08:00</updated><title type='text'>ASP.NET : Creating a Tag Cloud</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;A tag cloud is a way to display a weighted list such that the weight of each item is reflected by the size of the item&#39;s text. Tag clouds provide a quick way for one to eyeball a list and ascertain what items are more prevalent. Oftentimes, each item in a tag cloud is rendered as a link that, when clicked, allows the user to drill into the selected category. &lt;br /&gt;
&lt;br /&gt;
Ideally, a tag cloud could be associated with some data, a few properties set, and, voila, the tag cloud appears! In fact, we&#39;ll examine how to accomplish exactly this in a future article by creating a custom, compiled ASP.NET 2.0 server control. For now, though, let&#39;s just implement the tag cloud directly from an ASP.NET page (although this could be moved to a User Control for greater reuse opportunities).&lt;br /&gt;
First things first - we need the data that returns the list with each item weighted. In the demo downloadable at the end of this article, I have used a SqlDataSource control to query the Northwind database, returning the CategoryID, CategoryName, and number of products belonging to each category:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;SELECT Categories.CategoryID, Categories.CategoryName, 
       COUNT(Products.ProductID) AS NumberOfProducts 

FROM Categories 
    INNER JOIN Products ON 
        Categories.CategoryID = Products.CategoryID 

GROUP BY Categories.CategoryID, Categories.CategoryName
ORDER BY Categories.CategoryName
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
This query uses the GROUP BY clause to return the count of products associated with each category. See Using the GROUP BY Clause for more information on this SQL clause.&lt;br /&gt;
&lt;br /&gt;
The tag cloud is outputted in the Web page via a Literal Web control named CloudMarkup. In code we&#39;re going to loop through the database results, compute the font size scale, and then emit an HTML hyperlink as markup into the Text property of the Literal control. To start, we need to get the data from the SqlDataSource control. This is accomplished by calling its Select() method, which returns a DataView object:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&#39;First, read data from SqlDataSource
Dim cloudData As DataView = CType(CategoriesProductsBreakdownDataSource.Select(DataSourceSelectArguments.Empty), DataView)
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Next, a series of constants are defined in an attempt to generalize this code at least a little bit. For example, there are constants that define the names of the database columns that return the weight, the text field to display, along with the field to use (and a format string) when constructing the URL for each hyperlink. You&#39;ll also find the set of font sizes and the markup to inject between each link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;Const SpacerMarkup As String = &quot; &quot; &#39;The markup injected between each item in the cloud
Dim FontScale() As String = {&quot;xx-small&quot;, &quot;x-small&quot;, &quot;small&quot;, &quot;medium&quot;, &quot;large&quot;, &quot;x-large&quot;, &quot;xx-large&quot;}

&#39;All database column names are centralized here. To customize this, simply modify the column names here
Const WeightColumnName As String = &quot;NumberOfProducts&quot;
Const TextColumnName As String = &quot;CategoryName&quot;
Const NavigateUrlColumnName As String = &quot;CategoryID&quot;
Const NavigateUrlFormatString As String = &quot;~/ViewProductsByCategory.aspx?CategoryID={0}&quot;
&lt;/code&gt;&lt;/pre&gt;Next, we need to determine the minimum and maximum weight values in the list. This information is then used to compute the linear scale by which we&#39;ll map an item&#39;s weight to a font size. The scaleUnitLength holds the &quot;length&quot; of each notch on the scale.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;Dim minWeight As Decimal = Decimal.MaxValue, maxWeight As Decimal = Decimal.MinValue

For Each row As DataRowView In cloudData
    Dim numProductsObj As Object = row(WeightColumnName)
    If Not Convert.IsDBNull(numProductsObj) Then
       Dim numProductsDec As Decimal = Convert.ToDecimal(numProductsObj)

       If numProductsDec &amp;lt; minWeight Then minWeight = numProductsDec
       If numProductsDec &amp;gt; maxWeight Then maxWeight = numProductsDec
    End If
Next

Dim scaleUnitLength As Decimal = (maxWeight - minWeight + 1) / Convert.ToDecimal(FontScale.Length)
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
After computing the scale, the data is enumerated one more time, this time with a hyperlink element emitted for each record. To find the place on the scale, the current item&#39;s weight is subtracted from the minimum and divided by scaleUnitLength. This index is used to select the appropriate font size from FontScale. Also note that the specified values for NavigateUrlColumnName and NavigateUrlFormatString are used to configure the href portion of the hyperlink.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;For Each row As DataRowView In cloudData
    Dim numProductsObj As Object = row(&quot;NumberOfProducts&quot;)
    If Not Convert.IsDBNull(numProductsObj) Then
       Dim numProductsDec As Decimal = Convert.ToDecimal(numProductsObj)

       Dim scaleValue As Integer = Math.Truncate((numProductsDec - minWeight) / scaleUnitLength)
       CloudMarkup.Text &amp;amp;= String.Format(&quot;&amp;lt;a href=&quot;&quot;{0}&quot;&quot; style=&quot;&quot;font-size:{1};&quot;&quot;&amp;gt;{2}&amp;lt;/a&amp;gt;{3}&quot;, _
                                    Page.ResolveUrl(String.Format(NavigateUrlFormatString, row(NavigateUrlColumnName).ToString())), _
                                    FontScale(scaleValue), row(TextColumnName).ToString(), SpacerMarkup)
    End If
Next
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;That&#39;s all there is to it! The resulting output is a chunk of HTML that, when rendered in the user&#39;s browser, lists each category as a hyperlink pointing to ViewProductsByCategory.aspx?CategoryID=categoryID. Each link&#39;s text size is based on its weight using a linear scale. The following screenshot below shows a tag cloud of the Northwind database&#39;s categories table along with the raw data used to populate the cloud.
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiROCiEPxUmsinpMc7Toj8tGxfg-hhnGP7_voCQyfSVeHtEV0KfGqDUX4Ldje-pF-lHL-l1u7abjaDk_21dLKd7tUm2-F-6RfxmQbJFf1cCsu4EFSR1FyT1tQSkwou9xvGK7AZkEo5L8wKo/s1600/TagCloud2.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiROCiEPxUmsinpMc7Toj8tGxfg-hhnGP7_voCQyfSVeHtEV0KfGqDUX4Ldje-pF-lHL-l1u7abjaDk_21dLKd7tUm2-F-6RfxmQbJFf1cCsu4EFSR1FyT1tQSkwou9xvGK7AZkEo5L8wKo/s320/TagCloud2.gif&quot; style=&quot;cursor: move;&quot; width=&quot;273&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/7237523058360859957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/12/aspnet-creating-tag-cloud.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/7237523058360859957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/7237523058360859957'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/12/aspnet-creating-tag-cloud.html' title='ASP.NET : Creating a Tag Cloud'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiROCiEPxUmsinpMc7Toj8tGxfg-hhnGP7_voCQyfSVeHtEV0KfGqDUX4Ldje-pF-lHL-l1u7abjaDk_21dLKd7tUm2-F-6RfxmQbJFf1cCsu4EFSR1FyT1tQSkwou9xvGK7AZkEo5L8wKo/s72-c/TagCloud2.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-2746822888990423501</id><published>2010-09-17T13:24:00.000-07:00</published><updated>2010-09-17T13:24:28.720-07:00</updated><title type='text'>Microsoft AJAX CDN</title><content type='html'>What does a CDN provide?&lt;br /&gt;
&lt;br /&gt;
Content delivery networks (CDNs) are composed of &quot;edge cache&quot; servers that are strategically placed around the world at key Internet network points.  These &quot;edge cache&quot; servers can be used to cache and deliver all types of content – including images, videos, CSS and JavaScript files.&lt;br /&gt;
&lt;br /&gt;
Using a CDN can significantly improve a website&#39;s end-user performance, since it enables browsers to more quickly retrieve and download content.  For example, instead of having a browser request for an image traverse all the way across the Internet to your web server to download, a CDN can instead serve the request directly from a nearby &quot;edge cache&quot; server that might only be a single network hop away from your customer (making it return much faster – which makes your pages load quicker).  &lt;br /&gt;
&lt;br /&gt;
What does the Microsoft AJAX CDN provide?&lt;br /&gt;
&lt;br /&gt;
The Microsoft AJAX CDN makes it really easy to add the jQuery and ASP.NET AJAX script libraries to your web sites, and have them be automatically served from one of our thousands of geo-located edge-cache servers around the world. &lt;br /&gt;
&lt;br /&gt;
For example, if you want to use jQuery from the Microsoft AJAX CDN then you can simply add a standard script tag to your page using the URL below:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: arial; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-family: arial; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&lt;span style=&quot;font-family: arial; font-size: x-small;&quot;&gt;script&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial; font-size: x-small;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/javascript&quot;&amp;gt;&lt;span style=&quot;color: #a31515;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: arial; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
When the browser requests the script file it will be automatically served by the CDN &quot;edge cache&quot; server that is closest to the end-user.  This means:&lt;br /&gt;
&lt;br /&gt;
* The request will be processed much faster than if it had to hit your web-server (making the end-user&#39;s page load much faster)&lt;br /&gt;
&lt;br /&gt;
* You don&#39;t have to pay for the bandwidth of this file – since the file comes from our server we pay the bandwidth cost (saving you money)&lt;br /&gt;
&lt;br /&gt;
* The script can be easily cached across multiple web-sites – which means it might not even need to be downloaded if the user has already hit a web-site that requested the file (and as such has it already in the browser&#39;s cache). &lt;br /&gt;
&lt;br /&gt;
You can get a full listing of the JavaScript libraries (and associated URLs) we already have loaded in our CDN cache here: www.asp.net/ajax/cdn &lt;br /&gt;
&lt;br /&gt;
We&#39;ll update the available libraries in the CDN as we ship new versions of ASP.NET AJAX, and continue to update it to include all of the JavaScript files we ship with ASP.NET and Visual Studio (including jQuery, the jQuery Validation plugin, and additional libraries we ship in the future). &lt;br /&gt;
&lt;br /&gt;
The CDN service is free and available for anyone in the community to use for both commercial and non-commercial purposes.  You do not need to register to take advantage of it.&lt;br /&gt;
Using the Microsoft AJAX CDN with the ASP.NET 4.0 ScriptManager&lt;br /&gt;
&lt;br /&gt;
In addition to allowing you to reference script files directly using a&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjax.js&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/javascript&quot;&amp;gt;&lt;span style=&quot;color: #a31515;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;      &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxTemplates.js&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;text/javascript&quot;&amp;gt;&lt;span style=&quot;color: #a31515;&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;script&gt;
 element, ASP.NET 4.0 will make it easy to use the CDN from ASP.NET Web Forms applications that use the &lt;asp:scriptmanager/&gt; server control. 

The ASP.NET 4.0 &lt;asp:ScriptManager&gt; control includes a new property named EnableCdn. When you assign the value true to this property, your application will use the Microsoft CDN to request JavaScript files automatically:

When you enable the CDN with the ScriptManager, your application will retrieve all JavaScript files that it normally retrieves from the System.Web.dll or System.Web.Extensions.dll assemblies from the CDN instead.  This includes both the JavaScript files within ASP.NET AJAX, as well as the built-in Web Forms JavaScript files (for example: the WebUIValidation.js file for client-side validation, and the JavaScript files for controls like TreeView, Menu, etc).

This provides a nice end-user performance improvement, and means that users accessing your ASP.NET website won’t need to re-download these files if they have visited another ASP.NET website that uses the CDN.
Using ASP.NET AJAX Preview 5 from the CDN

In addition to launching the AJAX CDN site, the ASP.NET team has also recently released ASP.NET AJAX Preview 5. You can download ASP.NET AJAX Preview 5 (with sample code) from CodePlex: http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=32770

You can also now use the ASP.NET AJAX libraries simply by adding the following script tags that point at the CDN:
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/2746822888990423501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/09/microsoft-ajax-cdn.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/2746822888990423501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/2746822888990423501'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/09/microsoft-ajax-cdn.html' title='Microsoft AJAX CDN'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-6551684215388547964</id><published>2010-05-29T11:21:00.000-07:00</published><updated>2010-09-12T22:31:30.150-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><title type='text'>Asp.Net AutoComplete Textbox Using Jquery</title><content type='html'>This article demonstrates how to use the jQuery UI AutoComplete widget to consume an ASP.NET Web Service (EmployeeList.asmx) that is JSON Serialized. The data source for this web service is List&lt;employee&gt; in the Employee.cs class. You can download this class from the source code attached with this article.&lt;br /&gt;
The Autocomplete widget is one of the widgets provided in jQuery UI and provides suggestions while you type into the field. jQuery UI is a free widget and interaction library built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications.&lt;br /&gt;
&lt;br /&gt;
Let us first glance through the entire code with the jQuery UI AutoComplete widget added to the TextBox (tb)&lt;br /&gt;
&lt;br /&gt;
&lt;/employee&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 98%;&quot;&gt;&lt;code&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head runat=&quot;server&quot;&amp;gt;
&amp;lt;title&amp;gt;AutoComplete Box with jQuery&amp;lt;/title&amp;gt;
&amp;lt;link href=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; 
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
$(function() {
    $(&quot;.tb&quot;).autocomplete({
        source: function(request, response) {
            $.ajax({
                url: &quot;EmployeeList.asmx/FetchEmailList&quot;,
                data: &quot;{ &#39;mail&#39;: &#39;&quot; + request.term + &quot;&#39; }&quot;,
                dataType: &quot;json&quot;,
                type: &quot;POST&quot;,
                contentType: &quot;application/json; charset=utf-8&quot;,
                dataFilter: function(data) { return data; },
                success: function(data) {
                    response($.map(data.d, function(item) {
                        return {
                            value: item.Email
                        }
                    }))
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(textStatus);
                }
            });
        },
        minLength: 2
    });
});
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;
&amp;lt;div class=&quot;demo&quot;&amp;gt;
&amp;lt;div class=&quot;ui-widget&quot;&amp;gt;
    &amp;lt;label for=&quot;tbAuto&quot;&amp;gt;Enter Email: &amp;lt;/label&amp;gt;
     &amp;lt;asp:TextBox ID=&quot;tbAuto&quot; class=&quot;tb&quot; runat=&quot;server&quot;&amp;gt;
     &amp;lt;/asp:TextBox&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Now before explaining to you how this code functions, let us go through the WebService first. Assuming you have downloaded the source code and are looking at the EmployeeList.cs/vb file, you will observe that the method has been decorated with the [WebMethod] attribute to allow calls from client script&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 98%;&quot;&gt;&lt;code&gt;&amp;lt;WebMethod&amp;gt;
Public Function FetchEmailList(ByVal mail As String) As List(Of Employee)
      Dim emp = New Employee()
      Dim fetchEmail = emp.GetEmployeeList().Where(Function(m) m.Email.ToLower().StartsWith(mail.ToLower()))
      Return fetchEmail.ToList()
End Function
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Here the FetchEmailList(string mail) method calls the GetEmployeeList() method on the Employee class which returns a List&lt;employee&gt;. We then filter the list using the filter string (mail) passed from the UI and then return the list of emails that match the filter string.&lt;br /&gt;
Note: If a method is not marked with [ScriptMethod] attribute, the method will be called by using the HTTP POST command and the response will be serialized as JSON.&lt;br /&gt;
Going back to code we saw above, observe how the TextBox is wired to the AutoComplete widget.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/employee&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 98%;&quot;&gt;&lt;code&gt;$(function() {
    $(&quot;.tb&quot;).autocomplete({
        source: function(request, response) {
            $.ajax({
                // consume the webservice
        },
        minLength: 2
    });
});
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
To consume this web service using jQuery $.ajax(), two important points to note is that the request should be a POST request and the request’s content-type must be ‘application/json; charset=utf-8’. The code structure of the $.ajax() call looks similar to the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 98%;&quot;&gt;&lt;code&gt;$.ajax({
    url: &quot;EmployeeList.asmx/FetchEmailList&quot;,
    data: &quot;{ &#39;mail&#39;: &#39;&quot; + request.term + &quot;&#39; }&quot;,
    dataType: &quot;json&quot;,
    type: &quot;POST&quot;,
    contentType: &quot;application/json; charset=utf-8&quot;,
    success: function(data) {
 
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
    }
});
&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;
Observe how the parameter (that the user types in the textbox) is passed to the webservice using data: &quot;{ &#39;mail&#39;: &#39;&quot; + request.term + &quot;&#39; }&quot; .You may need to add additional checks to format the data or validate it. Once the Ajax method is completed, the success function will be executed and the matching results (Email) will be returned using the following code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 98%;&quot;&gt;&lt;code&gt;dataFilter: function(data) { return data; },
success: function(data) {
    response($.map(data.d, function(item) {
        return {
            value: item.Email
        }
    }))
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
    alert(textStatus);
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Now when you browse the page and type the first 2 characters in the textbox, the jQuery UI AutoComplete widget added to the TextBox, provides suggestion that it pulls from the JSON enabled WebService as shown below&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgluzalaF7rBkxaKRpoGHyqn4onBNXRBzmrLYNdHEYSxXRixI1Nt8P1L1PkemAQwiXoRRtuLXPGv2v6uGx_QqhgABKEeXRbuICvFLAeE1vvfPOX56TiEdHsRqZk4Dy0Gk2YGkyP-K-Dc8AI/s1600/27_05_2010WebService.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgluzalaF7rBkxaKRpoGHyqn4onBNXRBzmrLYNdHEYSxXRixI1Nt8P1L1PkemAQwiXoRRtuLXPGv2v6uGx_QqhgABKEeXRbuICvFLAeE1vvfPOX56TiEdHsRqZk4Dy0Gk2YGkyP-K-Dc8AI/s320/27_05_2010WebService.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7y1gjwLWA3gWlLyv26e_UypPj9OBpqFHs0afM-Y4mYKHzGu_JoSEB0Q-QQN_ND75av2y0tK7M5CM05GEfI4yNySwVVtumtrnr1KWO9D95ZLJGIrCpaDhHSrujpGKQN20ZoRuswCClGbjT/s1600/27_05_2010WebService_1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7y1gjwLWA3gWlLyv26e_UypPj9OBpqFHs0afM-Y4mYKHzGu_JoSEB0Q-QQN_ND75av2y0tK7M5CM05GEfI4yNySwVVtumtrnr1KWO9D95ZLJGIrCpaDhHSrujpGKQN20ZoRuswCClGbjT/s320/27_05_2010WebService_1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/6551684215388547964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/05/aspnet-autocomplete-textbox-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/6551684215388547964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/6551684215388547964'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/05/aspnet-autocomplete-textbox-using.html' title='Asp.Net AutoComplete Textbox Using Jquery'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgluzalaF7rBkxaKRpoGHyqn4onBNXRBzmrLYNdHEYSxXRixI1Nt8P1L1PkemAQwiXoRRtuLXPGv2v6uGx_QqhgABKEeXRbuICvFLAeE1vvfPOX56TiEdHsRqZk4Dy0Gk2YGkyP-K-Dc8AI/s72-c/27_05_2010WebService.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-5852014763159755219</id><published>2010-03-22T02:15:00.000-07:00</published><updated>2010-09-12T22:31:48.896-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LINQ"/><category scheme="http://www.blogger.com/atom/ns#" term="LINQ to XML"/><title type='text'>Filtering RSS Feed using LINQ</title><content type='html'>In this article, we will see how to read and filter the RSS Feed of &lt;a href=&quot;http://codetechblog.blogspot.com/&quot;&gt;codetechblog.blogspot.com&lt;/a&gt; using LINQ to XML. We will first read the RSS feed and populate the DropDownList with ‘Authors’ retrieved from the feed. We will then filter the feed results based on the Author selected in the DropDownList.&lt;br /&gt;
e will be reading and filtering the RSS feed of this site &lt;a href=&quot;http://codetechblog.blogspot.com/&quot;&gt;codetechblog.blogspot.com&lt;/a&gt;. The RSS feed can be obtained over here &lt;a href=&quot;http://feeds.feedburner.com/codetechblog&quot;&gt;http://feeds.feedburner.com/codetechblog&lt;/a&gt;. Let us quickly jump to the solution.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt; Create a new website (Open Visual Studio &amp;gt; File &amp;gt; New Website) called ‘FilterRSS.&lt;br /&gt;
&lt;b&gt;Step 2:&lt;/b&gt; Drag and drop a GridView and a DropDownList control to the page.&lt;br /&gt;
&lt;b&gt;Step 3:&lt;/b&gt; Once you visit the RSS Feed over here, right click on the page and View Source. You will find an XML file, since RSS is an XML file.&lt;br /&gt;
Let us now write a LINQ to XML query to read the Title, Link, Description and Author elements from our RSS Feed and filter the results. Add the following markup to the DropDownList and some template Columns to the GridView, to display content:&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;div&amp;gt;
    &amp;lt;asp:DropDownList ID=&quot;DropDownList1&quot; runat=&quot;server&quot;
        onselectedindexchanged=&quot;DropDownList1_SelectedIndexChanged&quot;
        AutoPostBack=&quot;True&quot;&amp;gt;
    &amp;lt;/asp:DropDownList&amp;gt;
    &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
    &amp;lt;asp:GridView ID=&quot;GridView1&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;False&quot;&amp;gt;
    &amp;lt;Columns&amp;gt;
        &amp;lt;asp:TemplateField HeaderText=&quot;Title&quot;&amp;gt;
         &amp;lt;ItemTemplate&amp;gt;
         &amp;lt;a href=&#39;&amp;lt;%# Eval(&quot;link&quot;) %&amp;gt;&#39; target=&quot;_blank&quot;&amp;gt;&amp;lt;%# Eval(&quot;title&quot;) %&amp;gt;&amp;lt;/a&amp;gt;
         &amp;lt;/ItemTemplate&amp;gt;
        &amp;lt;/asp:TemplateField&amp;gt;
        &amp;lt;asp:BoundField DataField=&quot;Author&quot;
           HeaderText=&quot;Author&quot; /&amp;gt;
       &amp;lt;asp:BoundField DataField=&quot;description&quot; HtmlEncode=&quot;false&quot;
               HeaderText=&quot;Description&quot; /&amp;gt;
    &amp;lt;/Columns&amp;gt;
    &amp;lt;/asp:GridView&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Step 4:&lt;/b&gt; Now create an ArticlesList class which will act as a container for the items read from the feed&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;VB.NET
Public Class ArticlesList
      Private privateTitle As String
      Public Property Title() As String
            Get
                  Return privateTitle
            End Get
            Set(ByVal value As String)
                  privateTitle = value
            End Set
      End Property
      Private privateLink As String
      Public Property Link() As String
            Get
                  Return privateLink
            End Get
            Set(ByVal value As String)
                  privateLink = value
            End Set
      End Property
      Private privateDescription As String
      Public Property Description() As String
            Get
                  Return privateDescription
            End Get
            Set(ByVal value As String)
                  privateDescription = value
            End Set
      End Property
      Private privateAuthor As String
      Public Property Author() As String
            Get
                  Return privateAuthor
            End Get
            Set(ByVal value As String)
                  privateAuthor = value
            End Set
      End Property
End Class
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
We are using Generics to return a strongly typed collection of IEnumerable&lt;articleslist&gt; items. This collection can now be passed to any other part of the application or stored in a session object to be used during postbacks.&lt;br /&gt;
The code will look similar to the following:&lt;br /&gt;
&lt;/articleslist&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;VB.NET
 
Imports System
Imports System.Linq
Imports System.Xml.Linq
Imports System.Collections.Generic
 
Partial Public Class _Default
      Inherits System.Web.UI.Page
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
            If (Not IsPostBack) Then
                  Dim xFeed As XElement = XElement.Load(&quot;http://feeds.feedburner.com/netCurryRecentArticles&quot;)
 
                  Dim items As IEnumerable(Of ArticlesList) = From item In xFeed.Elements(&quot;channel&quot;).Elements(&quot;item&quot;) _
                                                              Select New ArticlesList
                                    item.Element(&quot;description&quot;).Value, Author = item.Element(&quot;author&quot;).Value
                                    item.Element(&quot;link&quot;).Value, Description = item.Element(&quot;description&quot;).Value, Author
                                    item.Element(&quot;title&quot;).Value, Link = item.Element(&quot;link&quot;).Value, Description
                                    Title = item.Element(&quot;title&quot;).Value, Link
 
                  &#39;store items in a session
                  Session(&quot;feed&quot;) = items
 
                  Dim authors = items.Select(Function(p) p.Author).Distinct()
 
                  DropDownList1.DataSource = authors
                  DropDownList1.DataBind()
                  Dim selAuth As String = DropDownList1.SelectedValue
                  PopulateGrid(selAuth)
            End If
      End Sub
 
      Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
            Dim selAuth As String = DropDownList1.SelectedValue
            PopulateGrid(selAuth)
      End Sub
 
      Protected Sub PopulateGrid(ByVal author As String)
            Dim items = CType(Session(&quot;feed&quot;), IEnumerable(Of ArticlesList))
 
            If items IsNot Nothing Then
                  Dim filteredList = From p In items _
                                     Where p.Author = author _
                                     Select p
 
                  GridView1.DataSource = filteredList
                  GridView1.DataBind()
            End If
      End Sub
End Class
&lt;/code&gt;&lt;/pre&gt;In the code above, we load the Xml from the RSS feed using the XElement class. We then enumerate through all the Channel\Item elements and populate the items collection. This collection is stored in a Session object to be reused during postbacks.&lt;br /&gt;
Note: Observe the !IsPostBack which populates the collection only once, thereby saving the list from getting populated on every pageload.&lt;br /&gt;
We then apply a filter on this collection and select distinct authors and bind the result to a DropDownList. The selected author is passed to the PopulateGrid() method where the session object is casted back to IEnumerable&lt;t&gt;. The list is then filtered based on the author passed and the results are bound to a GridView.&lt;br /&gt;
Similarly as and when the users selects a new author from the DropDownList, the list gets filtered and only the articles belonging to that author is displayed. Here are some screenshots:&lt;/t&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrwy-txTM1_DI6CgHW2WsVKDYUp9HBewWl2l4_jBrSzCDOY2rlLDYdlxIvtfIuEM56LpPN7IRni7Jb9ylaN7IgsEsqJPKVyyFo3Zd4S5fs8YMA_vXW9YtE62WLQ-T2zR3-fs_1CJkDVthH/s1600-h/Using+Linq+in+RSS.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;97&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrwy-txTM1_DI6CgHW2WsVKDYUp9HBewWl2l4_jBrSzCDOY2rlLDYdlxIvtfIuEM56LpPN7IRni7Jb9ylaN7IgsEsqJPKVyyFo3Zd4S5fs8YMA_vXW9YtE62WLQ-T2zR3-fs_1CJkDVthH/s400/Using+Linq+in+RSS.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;t&gt;&lt;br /&gt;
&lt;/t&gt;&lt;br /&gt;
&lt;br /&gt;
I hope this article was useful and I thank you for viewing it</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/5852014763159755219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/03/filtering-rss-feed-using-linq.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5852014763159755219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5852014763159755219'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/03/filtering-rss-feed-using-linq.html' title='Filtering RSS Feed using LINQ'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrwy-txTM1_DI6CgHW2WsVKDYUp9HBewWl2l4_jBrSzCDOY2rlLDYdlxIvtfIuEM56LpPN7IRni7Jb9ylaN7IgsEsqJPKVyyFo3Zd4S5fs8YMA_vXW9YtE62WLQ-T2zR3-fs_1CJkDVthH/s72-c/Using+Linq+in+RSS.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-1450855297467501226</id><published>2010-03-14T11:13:00.000-07:00</published><updated>2010-09-12T22:32:10.784-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><title type='text'>Rotate Hyperlink Controls Using Jquery</title><content type='html'>This short article demonstrates how to rotate a group of Hyperlink Controls in the same position using jQuery.&lt;br /&gt;
Note that for demonstration purposes, I have included jQuery code in the same page. Ideally, these resources should be created in separate folders for maintainability.&lt;br /&gt;
People who have been monetizing their sites need no introduction to TextLinkAds. In simple words, Text Link Ads are Hyperlinks sponsored by Advertisers. When a user clicks on these hyperlinks, they are sent to the sponsor’s website. In this recipe, I will demonstrate how to rotate multiple hyperlinks or TextLinkAds on the same position.&lt;br /&gt;
Let us quickly jump to the solution and see how we can rotate a group of Hyperlink Controls using client-side code. This example uses the latest minified version of jQuery which is 1.3.2 that can be downloaded from here. This example assumes that you have a folder called &quot;Scripts&quot; with the jQuery file (jquery-1.3.2.min.js) in that folder&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head id=&quot;Head1&quot; runat=&quot;server&quot;&amp;gt;
    &amp;lt;title&amp;gt;Timer based toggling of hyperlink&amp;lt;/title&amp;gt;
    &amp;lt;script type=&#39;text/javascript&#39;
        src=&#39;../Scripts/jquery-1.3.2.min.js&#39;&amp;gt;
    &amp;lt;/script&amp;gt;
   
    &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
        $(function() {
            var anch = $(&quot;a.dev&quot;);
            $(anch).hide().eq(0).show();
            var cnt = anch.length;
 
            setInterval(linkRotate, 3000);
 
            function linkRotate() {
               $(anch).eq((anch.length++) % cnt).fadeOut(&quot;slow&quot;, function() {
                    $(anch).eq((anch.length) % cnt)
                    .fadeIn(&quot;slow&quot;);
                });
            }
        });
    &amp;lt;/script&amp;gt;
 
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;
    &amp;lt;div class=&quot;tableDiv&quot;&amp;gt;
        &amp;lt;h2&amp;gt;The Hyperlink and Text shown below changes after 3 seconds
        &amp;lt;/h2&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:HyperLink ID=&quot;linkA&quot; runat=&quot;server&quot; class=&quot;dev&quot;
            NavigateUrl=&quot;http://www.google.com&quot;&amp;gt;
            Google&amp;lt;/asp:HyperLink&amp;gt;
        &amp;lt;asp:HyperLink ID=&quot;linkB&quot; runat=&quot;server&quot; class=&quot;dev&quot;
            NavigateUrl=&quot;http://www.yahoo.com&quot;&amp;gt;
            Yahoo&amp;lt;/asp:HyperLink&amp;gt;
        &amp;lt;asp:HyperLink ID=&quot;linkC&quot; runat=&quot;server&quot; class=&quot;dev&quot;
            NavigateUrl=&quot;http://www.microsoft.com&quot;&amp;gt;
            Microsoft&amp;lt;/asp:HyperLink&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;We begin by hiding all the hyperlinks with class=&quot;dev&quot; and then display the first one.&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Calibri, Arial, serif; font-size: 12px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;anch = $(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;a.dev&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; line-height: 13px;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$(anch).hide().eq(0).show();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot; style=&quot;margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Verdana; font-size: x-small;&quot;&gt;We then use the JavaScript setInterval() function to delay the execution of a function (linkRotate) for a specific time, in our case 3000 millisecond (3 seconds), as shown below:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; line-height: 13px;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;setInterval(linkRotate, 3000);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot; style=&quot;margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Verdana; font-size: x-small;&quot;&gt;The advantage of the setInterval() function is that it continues to repeat the process of triggering the function at the specified interval, thereby giving it a loop effect.&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot; style=&quot;margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;In the linkRotate() function, we use a simple expression&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; line-height: 14px;&quot;&gt;(anch.length++) % cnt&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&amp;nbsp;that calculates the index to be supplied to the eq() selector and applies the fadeout/fadeIn() animations on the current hyperlink. eq(0) refers to the first link, eq(1) to the second link and so on.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; line-height: 14px;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; line-height: 14px;&quot;&gt;&amp;nbsp;linkRotate() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; line-height: 13px;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(anch).eq((anch.length++) % cnt).fadeOut(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;slow&quot;&lt;/span&gt;,&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt;() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; line-height: 13px;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(anch).eq((anch.length) % cnt)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; line-height: 13px;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .fadeIn(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;slow&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; line-height: 13px;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; line-height: 14px;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/1450855297467501226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/03/rotate-hyperlink-controls-using-jquery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/1450855297467501226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/1450855297467501226'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/03/rotate-hyperlink-controls-using-jquery.html' title='Rotate Hyperlink Controls Using Jquery'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-5289953848792811854</id><published>2010-03-03T08:25:00.000-08:00</published><updated>2010-09-17T13:22:23.474-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><title type='text'>Jquery :Increase image&#39;s size on Mouseclick</title><content type='html'>This short article demonstrates how to click and view a larger image when the thumbnail is clicked on.Note that for demonstration purposes, I have included jQuery and CSS code in the same page. Ideally, these resources should be created in separate folders for maintainability.&lt;br /&gt;
&lt;br /&gt;
Let us quickly jump to the solution and see how we can view a larger image when an image is clicked on&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head id=&quot;Head1&quot; runat=&quot;server&quot;&amp;gt;
    &amp;lt;title&amp;gt;Click and Increase the Size of an Image&amp;lt;/title&amp;gt;
    &amp;lt;style type=&quot;text/css&quot;&amp;gt;
        .imgthumb
        {
            height:100px;
            width:100px;
        }
        .imgdiv
        {
            background-color:White;
            margin-left:auto;
            margin-right:auto;
            padding:10px;
            border:solid 1px #c6cfe1;
            height:500px;
            width:450px;
        }
    &amp;lt;/style&amp;gt;
    &amp;lt;script type=&quot;text/javascript&quot;
     src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&amp;gt;
    &amp;lt;/script&amp;gt;
   
     &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
         $(function() {
             $(&quot;img.imgthumb&quot;).click(function(e) {
                 var newImg = &#39;&amp;lt;img src=&#39;
                                + $(this).attr(&quot;src&quot;) + &#39;&amp;gt;&amp;lt;/img&amp;gt;&#39;;
                 $(&#39;#ladiv&#39;)
                    .html($(newImg)
                    .animate({ height: &#39;300&#39;, width: &#39;450&#39; }, 1500));
             });
         });    
     &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;
    &amp;lt;div class=&quot;imgdiv&quot;&amp;gt;
        &amp;lt;h2&amp;gt;Click on the thumbnail to view a large image&amp;lt;/h2&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Image ID=&quot;imgA&quot; class=&quot;imgthumb&quot; runat=&quot;server&quot;
            ImageUrl=&quot;../images/1.jpg&quot; /&amp;gt;
        &amp;lt;asp:Image ID=&quot;imgB&quot; class=&quot;imgthumb&quot; runat=&quot;server&quot;
            ImageUrl=&quot;../images/2.jpg&quot; /&amp;gt;
        &amp;lt;asp:Image ID=&quot;imgC&quot; class=&quot;imgthumb&quot; runat=&quot;server&quot;
            ImageUrl=&quot;../images/3.jpg&quot; /&amp;gt;
        &amp;lt;asp:Image ID=&quot;Image1&quot; class=&quot;imgthumb&quot; runat=&quot;server&quot;
            ImageUrl=&quot;../images/4.jpg&quot; /&amp;gt;
        &amp;lt;hr /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;div id=&quot;ladiv&quot;&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;This recipe demonstrates how to increase the size of an image when it is clicked. To give it an Image gallery effect, when a thumbnail is clicked, we create a new image element and set its source, to the source of the clicked thumbnail.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;var newImg = &#39;&amp;lt;img src=&#39;
              + $(this).attr(&quot;src&quot;) + &#39;&amp;gt;&amp;lt;/img&amp;gt;&#39;;
&lt;/code&gt;&lt;/pre&gt;The next and final step is to set the html contents of a div element to the ‘newImg’ variable and then increase the image size, by animating the height and width of the image.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;$(&#39;#ladiv&#39;)
         .html($(newImg)
         .animate({ height: &#39;300&#39;, width: &#39;450&#39; }, 1500));
&lt;/code&gt;&lt;/pre&gt;When you run the application, click on the thumbnail to see a large version of the image with animation, as shown below. Additionally, you can also preload the images for better performance..&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3le2AiU-gDeabpJCLld17o6fbyoP4y_cd4xCNAl6zmIaZAMFu3lFA51q4SMolMfqg624gjD8W8JUX4OA3Q3ZPhGiPpch3_zT2ty2iIp-8Ah9L8GCN80Pf5BNbfQce95cTN1Ks5QNQY7DP/s1600-h/26122009Image.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3le2AiU-gDeabpJCLld17o6fbyoP4y_cd4xCNAl6zmIaZAMFu3lFA51q4SMolMfqg624gjD8W8JUX4OA3Q3ZPhGiPpch3_zT2ty2iIp-8Ah9L8GCN80Pf5BNbfQce95cTN1Ks5QNQY7DP/s400/26122009Image.jpg&quot; width=&quot;367&quot; /&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;
I hope you found this article useful and I thank you for viewing it.</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/5289953848792811854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/03/jquery-increase-images-size-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5289953848792811854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5289953848792811854'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/03/jquery-increase-images-size-on.html' title='Jquery :Increase image&#39;s size on Mouseclick'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3le2AiU-gDeabpJCLld17o6fbyoP4y_cd4xCNAl6zmIaZAMFu3lFA51q4SMolMfqg624gjD8W8JUX4OA3Q3ZPhGiPpch3_zT2ty2iIp-8Ah9L8GCN80Pf5BNbfQce95cTN1Ks5QNQY7DP/s72-c/26122009Image.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-5982167404599849388</id><published>2010-02-24T11:00:00.000-08:00</published><updated>2010-02-24T11:00:35.780-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><title type='text'>Jquery :Change Image Opacity on MouseOver</title><content type='html'>This short article demonstrates how to change the opacity of an image when the user hovers the mouse over an image.&lt;br /&gt;
Note that for demonstration purposes, I have included jQuery and CSS code in the same page. Ideally, these resources should be created in separate folders for maintainability.&lt;br /&gt;
Let us quickly jump to the solution and see how we can change the opacity of an image.&lt;br /&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 95%&quot;&gt;&lt;code&gt;&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
&amp;lt;head id=&amp;quot;Head1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;title&amp;gt;Change Image Opacity on Hover&amp;lt;/title&amp;gt;
    &amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
    .imgOpa
    {
        height:250px;
        width:250px;
        opacity:0.3;
        filter:alpha(opacity=30);
    }
    &amp;lt;/style&amp;gt;
    &amp;lt;script type=&amp;quot;text/javascript&amp;quot;
     src=&amp;quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&amp;quot;&amp;gt;
    &amp;lt;/script&amp;gt;
   
    &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
        $(function() {
            $(&#39;.imgOpa&#39;).each(function() {
                $(this).hover(
                    function() {
                        $(this).stop().animate({ opacity: 1.0 }, 800);
                    },
                   function() {
                       $(this).stop().animate({ opacity: 0.3 }, 800);
                   })
                });
        });
    &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2&amp;gt;Hover over an Image to change its Transparency level&amp;lt;/h2&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Image ID=&amp;quot;Image1&amp;quot; runat=&amp;quot;server&amp;quot;
            ImageUrl=&amp;quot;../images/1.jpg&amp;quot; class=&amp;quot;imgOpa&amp;quot; /&amp;gt;
        &amp;lt;asp:Image ID=&amp;quot;Image2&amp;quot; runat=&amp;quot;server&amp;quot;
            ImageUrl=&amp;quot;../images/2.jpg&amp;quot; class=&amp;quot;imgOpa&amp;quot; /&amp;gt;
        &amp;lt;asp:Image ID=&amp;quot;Image3&amp;quot; runat=&amp;quot;server&amp;quot;
            ImageUrl=&amp;quot;../images/3.jpg&amp;quot; class=&amp;quot;imgOpa&amp;quot; /&amp;gt;
        &amp;lt;asp:Image ID=&amp;quot;Image4&amp;quot; runat=&amp;quot;server&amp;quot;
            ImageUrl=&amp;quot;../images/4.jpg&amp;quot; class=&amp;quot;imgOpa&amp;quot; /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;In this example, observe that the images have a class attribute ‘imgOpa’. The definition of the CSS class is as shown here:&lt;br /&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 95%&quot;&gt;&lt;code&gt;.imgOpa
    {
        height:250px;
        width:250px;
        opacity:0.3;
        filter:alpha(opacity=30);
    }
&lt;/code&gt;&lt;/pre&gt;When the images are loaded, they are in a semitransparent state. In Firefox, Chrome and Safari, we use the opacity:n property for transparency. The opacity value can be from 0.0 - 1.0, where a lower value makes the element more transparent.&lt;br /&gt;
In IE 7 and later, we use filter:alpha(opacity=n) property for transparency, where the opacity value can be from 0-100.&lt;br /&gt;
When the user hovers the mouse over a semitransparent image, we use the jQuery hover() method to animate the opacity property from 0.3 to 1.0, thereby creating a cool effect on the images. The code to achieve this effect is shown below:&lt;br /&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 95%&quot;&gt;&lt;code&gt;$(this).hover(
    function() {
        $(this).stop().animate({ opacity: 1.0 }, 800);
    },
   function() {
       $(this).stop().animate({ opacity: 0.3 }, 800);
   })
});
&lt;/code&gt;&lt;/pre&gt;I hope you found this article useful and I thank you for viewing it</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/5982167404599849388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/02/jquery-change-image-opacity-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5982167404599849388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5982167404599849388'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/02/jquery-change-image-opacity-on.html' title='Jquery :Change Image Opacity on MouseOver'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-5825153827198208559</id><published>2010-02-24T10:56:00.000-08:00</published><updated>2010-02-24T10:58:10.748-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>ASP.NET TextBox with Watermark Effect using jQuery</title><content type='html'>This short article demonstrates how to create a watermark effect on your TextBox and display instructions to users, without taking up screen space.&lt;br /&gt;
Note that for demonstration purposes, I have included jQuery code in the same page. Ideally, these resources should be created in separate folders for maintainability.&lt;br /&gt;
Let us quickly jump to the solution and see how we can create a watermark effect on your TextBox using client-side code.&lt;br /&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 95%&quot;&gt;&lt;code&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot;
&amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;
 
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
&amp;lt;head id=&amp;quot;Head1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;title&amp;gt;TextBox WaterMark&amp;lt;/title&amp;gt;
    &amp;lt;script type=&amp;quot;text/javascript&amp;quot;
        src=&amp;quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&amp;quot;&amp;gt;
    &amp;lt;/script&amp;gt;  
   
    &amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
    .water
    {
         font-family: Tahoma, Arial, sans-serif;
         color:gray;
    }
    &amp;lt;/style&amp;gt;
   
    &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
        $(function() {
 
            $(&amp;quot;.water&amp;quot;).each(function() {
                $tb = $(this);
                if ($tb.val() != this.title) {
                    $tb.removeClass(&amp;quot;water&amp;quot;);
                }
            });
 
            $(&amp;quot;.water&amp;quot;).focus(function() {
                $tb = $(this);
                if ($tb.val() == this.title) {
                    $tb.val(&amp;quot;&amp;quot;);
                    $tb.removeClass(&amp;quot;water&amp;quot;);
                }
            });
 
            $(&amp;quot;.water&amp;quot;).blur(function() {
                $tb = $(this);
                if ($.trim($tb.val()) == &amp;quot;&amp;quot;) {
                    $tb.val(this.title);
                    $tb.addClass(&amp;quot;water&amp;quot;);
                }
            });
        });       
 
    &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;div class=&amp;quot;smallDiv&amp;quot;&amp;gt;
     &amp;lt;h2&amp;gt;TextBox Watermark Demonstration&amp;lt;/h2&amp;gt;    &amp;lt;br /&amp;gt;          
        &amp;lt;asp:TextBox ID=&amp;quot;txtFNm&amp;quot; class=&amp;quot;water&amp;quot; Text=&amp;quot;Type your First Name&amp;quot;
        Tooltip=&amp;quot;Type your First Name&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:TextBox ID=&amp;quot;txtLNm&amp;quot; class=&amp;quot;water&amp;quot; Text=&amp;quot;Type your Last Name&amp;quot;
        Tooltip=&amp;quot;Type your Last Name&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button ID=&amp;quot;btnSubmit&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;quot;Submit&amp;quot; /&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        Tip: Click on the TextBox to start typing. The watermark
        text disappears.
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;The code shown above adds the “watermark” behavior to controls marked with the ‘class=water’ attribute. When the user loads the page, a watermarked textbox displays a message to the user. As soon as the watermarked textbox receives focus and the user types some text, the watermark goes away. This technique is a great space saver as you can use it to provide instructions to the user, without using extra controls that take up valuable space on your form.&lt;br /&gt;
The ‘Tooltip’ attribute applied to the textbox is crucial to this example. The ‘Tooltip’ gets rendered as ‘title’. Observe the code, as we use this ‘title’ property to compare it to the textbox value and remove the watermark css, when the textbox control gains focus&lt;br /&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 95%&quot;&gt;&lt;code&gt;$(&amp;quot;.water&amp;quot;).focus(function() {
                $tb = $(this);
                if ($tb.val() == this.title) {
                    $tb.val(&amp;quot;&amp;quot;);
                    $tb.removeClass(&amp;quot;water&amp;quot;);
                }
            });
&lt;/code&gt;&lt;/pre&gt;Similarly when the user moves focus to a different control without entering a value in the textbox, we add the watermark css again.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 95%&quot;&gt;&lt;code&gt;$(&amp;quot;.water&amp;quot;).blur(function() {
                $tb = $(this);
                if ($.trim($tb.val()) == &amp;quot;&amp;quot;) {
                    $tb.val(this.title);
                    $tb.addClass(&amp;quot;water&amp;quot;);
                }
            });
&lt;/code&gt;&lt;/pre&gt;The water class declared in Demos.css looks like this:&lt;br /&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 95%&quot;&gt;&lt;code&gt;.water
{
     font-family: Tahoma, Arial, sans-serif;
     font-size:75%;
     color:gray;
}
&lt;/code&gt;&lt;/pre&gt;When the user enters the First/Last Name and submits the form, the watermark behavior is no more needed to be displayed. This is achieved by comparing the ‘title’ with the ‘value’ of the textbox. If the ‘value’ does not match the ‘title’, this indicates that the user has entered some value in the textboxes and submitted the form. So in this case we remove the watermark appearance.&lt;br /&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 95%&quot;&gt;&lt;code&gt;$(&amp;quot;.water&amp;quot;).each(function() {
                $tb = $(this);
                if ($tb.val() != this.title) {
                    $tb.removeClass(&amp;quot;water&amp;quot;);
                }
            });
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/5825153827198208559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/02/aspnet-textbox-with-watermark-effect.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5825153827198208559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5825153827198208559'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/02/aspnet-textbox-with-watermark-effect.html' title='ASP.NET TextBox with Watermark Effect using jQuery'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-2067980611920090090</id><published>2010-02-24T10:12:00.000-08:00</published><updated>2010-09-17T13:22:36.223-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><title type='text'>Convert all texts email addresses to mailto links using jQuery</title><content type='html'>In this post I’ll show how to use  jQuery to automatically convert all email addesses from static text into a mailto link.&lt;br /&gt;
Consider the following table which contains a person’s details including their email address.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJrGCjrGR1rcVj1ObgsVHSm9tN5ih_3GatKNtlf0vwA91axp4CgLl4bel6NGvZQjV-VmYHmSUlzSWk5E38-NSzdzIt_uhWsA_XVcxFkRJ2R_p9CW_rBxgPNKEAX85nzUhmksHpjl2hrziM/s1600-h/jqueryemail1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;80&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJrGCjrGR1rcVj1ObgsVHSm9tN5ih_3GatKNtlf0vwA91axp4CgLl4bel6NGvZQjV-VmYHmSUlzSWk5E38-NSzdzIt_uhWsA_XVcxFkRJ2R_p9CW_rBxgPNKEAX85nzUhmksHpjl2hrziM/s400/jqueryemail1.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using jQuery I can easily find table cells that contain an email address by using a regular expression and then convert the address into a mailto link:&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;$().ready(function() {
    var regEx = /(\w+([-+.&#39;]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)/;

    $(&quot;table td&quot;).filter(function() {
        return $(this).html().match(regEx);
    }).each(function() {
        $(this).html($(this).html().replace(regEx, &quot;&amp;lt;a href=\&quot;mailto:$1\&quot;&amp;gt;$1&amp;lt;/a&amp;gt;&quot;));
    });
});
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
First I’ve defined my email regular expression. I have also made sure the entire expression is in brackets, this sets up a regular expression group for the whole thing which I use when doing the replace.&lt;br /&gt;
For my example I’m only going to replace email addresses within a TD tag so my selector first gets these elements. I next use the filter function to only select the email address content from the TD by using the JavaScript match function with my email regular expression. I then iterate over the collection of elements and use the JavaScript replace function to replace the static email address with a mailto hyperlink to the same email address.&lt;br /&gt;
In my replace string I’m using $1, which will output the matching text from the original string from the first grouping in my regular expression. As I said earlier I put brackets around my entire regular expression so that the first grouping it the whole thing. This means that $1 will output the matched email address.&lt;br /&gt;
Now when I run my project the email addresses are automatically mailto links:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhefFFm6rZCZifQ-3q6Ahx8c_C19IiNaUjOxXgFsfy3aa_bOufRjE-HJyYIFv3fh1ILGbXVwQJRFshZ7f3ku69AR623uK85FPw7T9tWhfTqTCN5XvvNvafKTzGEtAZQrrYGfmBTPU7uWnIm/s1600-h/jqueryemail2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;75&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhefFFm6rZCZifQ-3q6Ahx8c_C19IiNaUjOxXgFsfy3aa_bOufRjE-HJyYIFv3fh1ILGbXVwQJRFshZ7f3ku69AR623uK85FPw7T9tWhfTqTCN5XvvNvafKTzGEtAZQrrYGfmBTPU7uWnIm/s400/jqueryemail2.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/2067980611920090090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/02/convert-all-texts-email-addresses-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/2067980611920090090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/2067980611920090090'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/02/convert-all-texts-email-addresses-to.html' title='Convert all texts email addresses to mailto links using jQuery'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJrGCjrGR1rcVj1ObgsVHSm9tN5ih_3GatKNtlf0vwA91axp4CgLl4bel6NGvZQjV-VmYHmSUlzSWk5E38-NSzdzIt_uhWsA_XVcxFkRJ2R_p9CW_rBxgPNKEAX85nzUhmksHpjl2hrziM/s72-c/jqueryemail1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-5226307229838414504</id><published>2010-02-15T09:58:00.000-08:00</published><updated>2010-02-15T10:01:23.705-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><title type='text'>AutoScroll Multiline TextBox using jQuery in Asp.Net</title><content type='html'>This article demonstrates how to autoscroll a multiline textbox both upwards and downwards using &lt;a href=&quot;http://www.jquery.com/&quot;&gt;jQuery&lt;/a&gt; 1.3.2.&lt;br /&gt;
&lt;br /&gt;
Note that for demonstration purposes, I have included jQuery code in the same page. Ideally, these resources should be created in separate folders for maintainability. The code shown below has been tested on IE7, Firefox 3, Chrome 2 and Safari 4&lt;br /&gt;
Let us quickly jump to the solution and see how to AutoScroll a multiline textbox.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head id=&quot;Head1&quot; runat=&quot;server&quot;&amp;gt;
    &amp;lt;title&amp;gt;AutoScroll a Multiline TextBox&amp;lt;/title&amp;gt;
    &amp;lt;script type=&quot;text/javascript&quot;
     src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&amp;gt;
    &amp;lt;/script&amp;gt;
 
   
    &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
        $(function() {
            var $tb = $(&#39;textarea[id$=tb1]&#39;);
 
            $(&#39;input[id$=btnScroll]&#39;).toggle(
            function(e) {
                e.preventDefault();
                scrollArea($tb, $tb[0].scrollHeight);
            },
            function(e) {
                e.preventDefault();
                scrollArea($tb, 0);
            });
        });
 
        function scrollArea(ctrl, ht) {
            ctrl.animate({ scrollTop: ht }, 1000);
        }
    &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;
    &amp;lt;div class=&quot;smallDiv&quot;&amp;gt;
        &amp;lt;h2&amp;gt;Scroll the box contents by clicking on the Button&amp;lt;/h2&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:TextBox ID=&quot;tb1&quot; runat=&quot;server&quot; TextMode=&quot;MultiLine&quot;
        Text=&quot;Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem
        Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum
        Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum
        Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum
        Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum&quot;
        Rows=&quot;5&quot;/&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button ID=&quot;btnScroll&quot; runat=&quot;server&quot; Text=&quot;Scroll&quot;/&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        Tip: The Text can be scrolled both downwards and upwards.
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
When the user clicks on the button (btnScroll), we toggle the click behavior. On the first click, we cancel the postback by using e.preventDefault() and then call a function called scrollArea() passing in the textarea and the scrollHeight. The code $tb[0].scrollHeight is for scrolling downwards&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;e.preventDefault();
scrollArea($tb, $tb[0].scrollHeight);
&lt;/code&gt;&lt;/pre&gt;When the user clicks the button (btnScroll) again, the postback is cancelled and the scrollHeight is set to 0 (zero). This is done for scrolling upwards.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;e.preventDefault();
scrollArea($tb, 0);
&lt;/code&gt;&lt;/pre&gt;The scrollArea() function accepts the textarea that is to be scrolled as well as the scrollHeight. We then animate the scrollTop property to scroll upwards/downwards depending on the height parameter. The duration of the animation is set to 1000 milliseconds which provides a smooth scrolling effect&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;function scrollArea(ctrl, ht) {
    ctrl.animate({ scrollTop: ht }, 1000);
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
The code here assumes that you are not scrolling the textarea manually and then clicking the Scroll button.&lt;br /&gt;
I hope you found this article useful and I thank you for viewing it.</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/5226307229838414504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/02/autoscroll-multiline-textbox-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5226307229838414504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5226307229838414504'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/02/autoscroll-multiline-textbox-using.html' title='AutoScroll Multiline TextBox using jQuery in Asp.Net'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-325339831055851808</id><published>2010-02-15T09:51:00.000-08:00</published><updated>2010-02-15T09:53:52.694-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><title type='text'>Moving data between two ListBoxes Using jQuery and Asp.Net</title><content type='html'>Recently a new version of jQuery was released. This version is 1.4. As with any new version, ultimately you see what used to take you several lines of code, now rolled up into a single line of code. I&#39;m going to demonstrate a question I&#39;ve been asked many times on forums and that is how to move selected items from one &amp;amp;lgt;select&amp;gt; element to another. I&#39;ll show you how you could do it using jQuery 1.3.2 and how to minimize the code by using the new 1.4 library. Before we begin, the new version can be found &lt;a href=&quot;http://docs.jquery.com/Downloading_jQuery&quot;&gt;here&lt;/a&gt;.  &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;The HTML  &lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The HTML for this is pretty straight forward. It&#39;s simply two  elements side by side with two buttons between them. Here&#39;s what it looks like: &lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;form method=&quot;get&quot;&amp;gt;             
      &amp;lt;select id=&quot;SelectLeft&quot; multiple=&quot;multiple&quot;&amp;gt;
            &amp;lt;option value=&quot;1&quot;&amp;gt;Australia&amp;lt;/option&amp;gt;
            &amp;lt;option value=&quot;2&quot;&amp;gt;New Zealand&amp;lt;/option&amp;gt;
            &amp;lt;option value=&quot;3&quot;&amp;gt;Canada&amp;lt;/option&amp;gt;
            &amp;lt;option value=&quot;4&quot;&amp;gt;USA&amp;lt;/option&amp;gt;
            &amp;lt;option value=&quot;5&quot;&amp;gt;France&amp;lt;/option&amp;gt;
      &amp;lt;/select&amp;gt;
           
      &amp;lt;input id=&quot;MoveRight&quot; type=&quot;button&quot; value=&quot; &amp;gt;&amp;gt; &quot; /&amp;gt;
      &amp;lt;input id=&quot;MoveLeft&quot; type=&quot;button&quot; value=&quot; &amp;lt;&amp;lt; &quot; /&amp;gt;
       
      &amp;lt;select id=&quot;SelectRight&quot; multiple=&quot;multiple&quot;&amp;gt;          
      &amp;lt;/select&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicPrnhDHm_hWwJmvTjIfiOckXO3F4hNrDhoFaVKDekV5y3xhRyjESbVtJIZ7ZC6e_qtREaWQNc6O8TeafsUPl3_46KyplRaZeEeaavkvozcDglc4BYaQ-1tCc8ytyQ2XdVqubSF8RFnIF5/s1600-h/ListBoxMoveData.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;172&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicPrnhDHm_hWwJmvTjIfiOckXO3F4hNrDhoFaVKDekV5y3xhRyjESbVtJIZ7ZC6e_qtREaWQNc6O8TeafsUPl3_46KyplRaZeEeaavkvozcDglc4BYaQ-1tCc8ytyQ2XdVqubSF8RFnIF5/s400/ListBoxMoveData.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicPrnhDHm_hWwJmvTjIfiOckXO3F4hNrDhoFaVKDekV5y3xhRyjESbVtJIZ7ZC6e_qtREaWQNc6O8TeafsUPl3_46KyplRaZeEeaavkvozcDglc4BYaQ-1tCc8ytyQ2XdVqubSF8RFnIF5/s1600-h/ListBoxMoveData.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&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;jQuery 1.3.2&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Below is the code to move the selected items from each &amp;lt;select&amp;gt; element.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;   
    &amp;lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&amp;gt;
        $(function() {
            $(&quot;#MoveRight,#MoveLeft&quot;).click(function(event) {
                var id = $(event.target).attr(&quot;id&quot;);
                var selectFrom = id == &quot;MoveRight&quot; ? &quot;#SelectLeft&quot; : &quot;#SelectRight&quot;;
                var moveTo = id == &quot;MoveRight&quot; ? &quot;#SelectRight&quot; : &quot;#SelectLeft&quot;;
 
                var selectedItems = $(selectFrom + &quot;option:selected&quot;);
                var output = [];               
                $.each(selectedItems, function(key, e) {                   
                  output.push(&#39;&amp;lt;option value=&quot;&#39; + e.value + &#39;&quot;&amp;gt;&#39; + e.text + &#39;&amp;lt;/option&amp;gt;&#39;);
                                });
               
                $(moveTo).append(output.join(&quot;&quot;));               
                selectedItems.remove();
            });
        });
    &amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
I&#39;ve bound one event handler for the button clicks. To decide which direction the selected items should go, I&#39;m using the ID of the button that fired the event:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;var id = $(event.target).attr(&quot;id&quot;);
var selectFrom = id == &quot;MoveRight&quot; ? &quot;#SelectLeft&quot; : &quot;#SelectRight&quot;;
var moveTo = id == &quot;MoveRight&quot; ? &quot;#SelectRight&quot; : &quot;#SelectLeft&quot;;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Next I create an empty array and loop through every selected item and add it to the end of the array:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;var output = [];               
$.each(selectedItems, function(key, e) {                   
      output.push(&#39;&amp;lt;option value=&quot;&#39; + e.value + &#39;&quot;&amp;gt;&#39; + e.text + &#39;&amp;lt;/option&amp;gt;&#39;);
});
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Then I append it to the end of the &amp;lt;select&amp;gt; element and remove the moved items:&lt;br /&gt;
$(moveTo).append(output.join(&quot;&quot;));               &lt;br /&gt;
selectedItems.remove();&lt;br /&gt;
&lt;br /&gt;
Overall I think that&#39;s a good approach. In jQuery 1.4 we can make this better!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;jQuery 1.4&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In the new jQuery library, the team has introduced a new function called &lt;a href=&quot;http://api.jquery.com/toArray/&quot;&gt;toArray&lt;/a&gt;. This retrieves all the DOM elements contained in the jQuery set, as an array. So here&#39;s the code below:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery-1.4.1.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&amp;gt;
        $(function() {
            $(&quot;#MoveRight,#MoveLeft&quot;).click(function(event) {
                var id = $(event.target).attr(&quot;id&quot;);
                var selectFrom = id == &quot;MoveRight&quot; ? &quot;#SelectLeft&quot; : &quot;#SelectRight&quot;;
                var moveTo = id == &quot;MoveRight&quot; ? &quot;#SelectRight&quot; : &quot;#SelectLeft&quot;;
 
                var selectedItems = $(selectFrom + &quot; :selected&quot;).toArray();
                $(moveTo).append(selectedItems);
                selectedItems.remove;
            });
        });
    &amp;lt;/script&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
The first thing you&#39;ll notice is the code has been reduced. Thanks to the &lt;a href=&quot;http://api.jquery.com/toArray/&quot;&gt;toArray &lt;/a&gt;function, I have eliminated the need to loop through the selected items. Now they&#39;re returned as an array&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;var selectedItems = $(selectFrom + &quot; :selected&quot;).toArray();
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
And to add them to the &amp;lt;select&amp;gt; element, I no longer need to use the join function, I simply append them:   $(moveTo).append(selectedItems);&lt;br /&gt;
&amp;nbsp;Nice and simple!</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/325339831055851808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/02/moving-data-between-two-listboxes-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/325339831055851808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/325339831055851808'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/02/moving-data-between-two-listboxes-using.html' title='Moving data between two ListBoxes Using jQuery and Asp.Net'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicPrnhDHm_hWwJmvTjIfiOckXO3F4hNrDhoFaVKDekV5y3xhRyjESbVtJIZ7ZC6e_qtREaWQNc6O8TeafsUPl3_46KyplRaZeEeaavkvozcDglc4BYaQ-1tCc8ytyQ2XdVqubSF8RFnIF5/s72-c/ListBoxMoveData.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-5006141113345685864</id><published>2010-02-01T11:05:00.000-08:00</published><updated>2010-02-02T10:41:35.120-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ajax"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>Inline Editing Using jQuery and Ajax in Repeater control</title><content type='html'>Repeater control is one of the light weight control when compared to the other databound controls. It provides more flexibility on the layout of data displayed and the control itself will not render any additional HTML like GridView and DataList control do. It only renders the HTML we specified in the template columns which makes it light weight when compared to other controls.&lt;br /&gt;
&lt;br /&gt;
Repeater control as such will not provide edit/update functionalities for the data.&lt;br /&gt;
&lt;br /&gt;
In this article, we will overcome this difficulty and provide an edit update feature similar to GridView control using the powerful &lt;a href=&quot;http://jquery.com/&quot;&gt;jQuery &lt;/a&gt;library and &lt;a href=&quot;http://www.asp.net/ajax/&quot;&gt;Ajax&lt;/a&gt;.&lt;br /&gt;
Refer the below figure to understand better.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM-noMG3p-8Yr51XPajQPAz6pfn4LJueJ_hwxjSmISZtFGxwT2F09K74SAhFbF5qN-mcsjXmuukeuKjCln3-FMUa3OU_3sMrMFfCzFo3cVitf3nFtL0muLG3VS_9ddBmSPmh5lT6D2e_Ny/s1600-h/InlineEditingUsingJquery.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM-noMG3p-8Yr51XPajQPAz6pfn4LJueJ_hwxjSmISZtFGxwT2F09K74SAhFbF5qN-mcsjXmuukeuKjCln3-FMUa3OU_3sMrMFfCzFo3cVitf3nFtL0muLG3VS_9ddBmSPmh5lT6D2e_Ny/s320/InlineEditingUsingJquery.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-decoration: underline;&quot;&gt;Steps&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Open Visual Studio 2008, Click File &amp;gt;Website and choose ASP.Net Website.&lt;/li&gt;
&lt;li&gt;Select a language of your choice. I have selected C#. You can name your website as per your need.&lt;/li&gt;
&lt;li&gt;Drag a Repeater control from the data tab of the Visual Studio.&lt;/li&gt;
&lt;li&gt;You can add a Sql server Express database in App_Data Folder and create a table called Employee with all the necessary fields. Enter some sample data to display in the Repeater control.&lt;/li&gt;
&lt;li&gt;Specify the HeaderTemplate, ItemTemplate and FooterTemplate to display the employee data in tabular format. Bind the Repeater control from codebehind by fetching employee detail from the express database we have created in App_Data folder.&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;Refer the below code,&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-decoration: underline;&quot;&gt;ASPX&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;asp:Repeater ID=&quot;rpEmployee&quot; runat=&quot;server&quot;&amp;gt;
    &amp;lt;HeaderTemplate&amp;gt;
    &amp;lt;table border=&quot;0&quot; ID=&quot;tblEmployee&quot;&amp;gt;
        &amp;lt;tr id=&quot;Tr2&quot; runat=&quot;server&quot; style=&quot;&quot;&amp;gt;
            &amp;lt;th id=&quot;Th1&quot;&amp;gt;
            &amp;lt;/th&amp;gt;
            &amp;lt;th id=&quot;Th2&quot;&amp;gt;
            EmpID&amp;lt;/th&amp;gt;
            &amp;lt;th id=&quot;Th3&quot;&amp;gt;
            EmpName&amp;lt;/th&amp;gt;
            &amp;lt;th id=&quot;Th4&quot;&amp;gt;
            Department&amp;lt;/th&amp;gt;
            &amp;lt;th id=&quot;Th5&quot;&amp;gt;
            Age&amp;lt;/th&amp;gt;
            &amp;lt;th id=&quot;Th6&quot;&amp;gt;
            Address&amp;lt;/th&amp;gt;
       &amp;lt;/tr&amp;gt;                   
    &amp;lt;/HeaderTemplate&amp;gt;
    &amp;lt;ItemTemplate&amp;gt;
      &amp;lt;tr ID=&#39;&amp;lt;%# Eval(&quot;EmpID&quot;) %&amp;gt;&#39;&amp;gt;
                    &amp;lt;td&amp;gt;                       
                        &amp;lt;input type=&quot;button&quot; value=&quot;Edit&quot;/&amp;gt;
                        &amp;lt;input type=&quot;button&quot; value=&quot;Update&quot; style=&quot;display:none&quot; /&amp;gt;
                        &amp;lt;input type=&quot;button&quot; value=&quot;Cancel&quot; style=&quot;display:none&quot; /&amp;gt;
                    &amp;lt;/td&amp;gt;
                    &amp;lt;td&amp;gt;
                       &amp;lt;%# Eval(&quot;EmpID&quot;) %&amp;gt;
                    &amp;lt;/td&amp;gt;
                    &amp;lt;td&amp;gt;
                        &amp;lt;%# Eval(&quot;EmpName&quot;) %&amp;gt;
                    &amp;lt;/td&amp;gt;
                    &amp;lt;td&amp;gt;
                        &amp;lt;%# Eval(&quot;Department&quot;) %&amp;gt;
                    &amp;lt;/td&amp;gt;
                    &amp;lt;td&amp;gt;
                        &amp;lt;%# Eval(&quot;Age&quot;) %&amp;gt;
                    &amp;lt;/td&amp;gt;
                    &amp;lt;td&amp;gt;
                      &amp;lt;%# Eval(&quot;Address&quot;) %&amp;gt;
                    &amp;lt;/td&amp;gt;
       &amp;lt;/tr&amp;gt;   
    &amp;lt;/ItemTemplate&amp;gt;
    &amp;lt;FooterTemplate&amp;gt;
    &amp;lt;/table&amp;gt;
    &amp;lt;/FooterTemplate&amp;gt;
    &amp;lt;/asp:Repeater&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;text-decoration: underline;&quot;&gt;CodeBehind&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;protected void Page_Load(object sender, EventArgs e)
    {
            rpEmployee.DataSource = GetEmployee(&quot;Select * from Employee&quot;);
            rpEmployee.DataBind();
    }
    public DataTable GetEmployee(string query)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[&quot;DatabaseConnectionString&quot;].ConnectionString);
        SqlDataAdapter ada = new SqlDataAdapter(query, con);
        DataTable dtEmp = new DataTable();
        ada.Fill(dtEmp);
        return dtEmp;
    }
&lt;/code&gt;&lt;/pre&gt;Execute the page and you can see the employee details in tabular view with an edit button.&lt;br /&gt;
&lt;br /&gt;
Next, we will make the Repeater control’s row editable similar to the inbuilt edit feature of GridView control using jQuery library.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Providing Edit Update Feature&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
When the user clicks the edit button, we will hide the edit button and enable update &amp;amp; cancel button for that row. Just like GridView control, we will also populate the table cell value of the editing row in a textbox control to edit. After editing the value and on clicking Update button, we call a page method called UpdateEmployee() to update the employee details in the database using the jQuery’s ajax() method. &lt;br /&gt;
&lt;br /&gt;
First, we will develop our page method UpdateEmployee() in our codebehind to update the employee details that is passed to it from jQuery’s ajax method.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;[WebMethod]
   public static string UpdateEmployee(string empid,string name,string dept,string age,string address)  
    { 
        string UpdateQuery = &quot;UPDATE [Employee] SET [EmpName] = @name, [Department] =  @dept, [Age] = @age, [Address] = @address WHERE [EmpID] = @empid&quot;;
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[&quot;DatabaseConnectionString&quot;].ConnectionString);
        con.Open();
        SqlCommand com = new SqlCommand(UpdateQuery, con);
        com.Parameters.Add(&quot;@name&quot;, SqlDbType.VarChar, 50).Value = name;
        com.Parameters.Add(&quot;@dept&quot;, SqlDbType.VarChar, 50).Value = dept;
        com.Parameters.Add(&quot;@age&quot;, SqlDbType.Int, 4).Value = age;
        com.Parameters.Add(&quot;@address&quot;, SqlDbType.VarChar, 50).Value = address;
        com.Parameters.Add(&quot;@empid&quot;, SqlDbType.Int, 4).Value = empid;       
        int n = com.ExecuteNonQuery();
        con.Close();
 
        return n.ToString();
    }
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
As we all know, a page method should be public static and should be decorated with WebMethod attribute. You need to include the System.Web.Services namespace for the WebMethod attribute to work. To know more about page methods and consuming it from jQuery, please read &lt;a href=&quot;http://codetechblg.blogspot.com/2010/01/jquery-and-ajax-in-aspnet-part-1.html&quot;&gt;Using JQuery in ASP.Net AJAX Applications – Part 1.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will move to the client side part of our implementation where we can provide an editing option to the user. Refer the above FAQ’s to integrate jQuery library into our project.&lt;br /&gt;
&lt;br /&gt;
The following jQuery code will help us to do the rest of our operations.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;script src=&quot;_scripts/jquery-1.3.2.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script language=&quot;javascript&quot;&amp;gt;
        $(function() {
            $(&quot;#tblEmployee &amp;gt; tbody &amp;gt; tr &quot;).each(function() {
                var TRID = $(this).attr(&quot;id&quot;);
                $(this).find(&quot;td:first &amp;gt; input[value=Edit]&quot;).click(function() {                   
                    ResetOtherRowEdit();
                    ChangeTableCellToTextbox(TRID);
                    $(this).hide();
                    return false;
                });
 
                $(this).find(&quot;td:first &amp;gt; input[value=Update]&quot;).click(function() {
                    UpdateRow(TRID);
                });
 
                $(this).find(&quot;td:first &amp;gt; input[value=Cancel]&quot;).click(function() {
                    CancelEdit(TRID);
                });
 
            });
        });
 
        function ChangeTableCellToTextbox(RowID) {
            $(&quot;#&quot; + RowID + &quot;&amp;gt; TD&quot;).filter(function() {
                if ($(this).find(&quot;INPUT&quot;).html() == null &amp;amp; !($(this).is(&quot;:nth-child(2)&quot;))) {
                    return true;
                }
            }).each(function() {
                var TDvalue = $(this).html();               
                var replacevalue = &quot;&amp;lt;input type=text value=\&quot;&quot; + TDvalue + &quot;\&quot;&amp;gt;&amp;lt;/input&amp;gt;&quot;;
                $(this).html(replacevalue);
            });
 
            $(&quot;#tblEmployee &amp;gt; tbody &amp;gt; tr[id=&quot;+ RowID +&quot;] &amp;gt; td:first&amp;gt; input[value=Update]&quot;).show();
            $(&quot;#tblEmployee &amp;gt; tbody &amp;gt;  tr[id=&quot; + RowID + &quot;] &amp;gt; td:first&amp;gt; input[value=Cancel]&quot;).show();
        }
 
        function UpdateRow(RowID) {           
            var empid = $(&quot;#&quot; + RowID + &quot;&amp;gt; TD:nth-child(2)&quot;).html();
            var empname =$(&quot;#&quot; + RowID + &quot;&amp;gt; TD:nth-child(3) &amp;gt; input[type=text]&quot;).val();
            var dept = $(&quot;#&quot; + RowID + &quot;&amp;gt; TD:nth-child(4) &amp;gt; input[type=text]&quot;).val();
            var age = $(&quot;#&quot; + RowID + &quot;&amp;gt; TD:nth-child(5) &amp;gt; input[type=text]&quot;).val();
            var address =$(&quot;#&quot; + RowID + &quot;&amp;gt; TD:nth-child(6) &amp;gt; input[type=text]&quot;).val();
 
            var options = {
                type: &quot;POST&quot;,
                url: &quot;RepeaterEdit.aspx/UpdateEmployee&quot;,
                data: &quot;{\&quot;empid\&quot;:\&quot;&quot; + empid + &quot;\&quot;,\&quot;name\&quot;:\&quot;&quot; + empname + &quot;\&quot;,\&quot;dept\&quot;:\&quot;&quot; + dept + &quot;\&quot;,\&quot;age\&quot;:\&quot;&quot; + age + &quot;\&quot;,\&quot;address\&quot;:\&quot;&quot; + address + &quot;\&quot;}&quot;,
                contentType: &quot;application/json; charset=utf-8&quot;,
                dataType: &quot;json&quot;,
                success: function(response) {
                    if (response.d != &quot;&quot;) {
                        if (response.d == &quot;1&quot;) {
                            alert(&quot;Updation Successful&quot;);
                            CancelEdit(RowID);
                        }
                        else {
                            alert(&quot;Updation failed!&quot;);
                        }
                    }
                }
            };
            //Call the PageMethods
            $.ajax(options);         
        }
 
        function CancelEdit(RowID) {
            $(&quot;#&quot; + RowID + &quot;&amp;gt; TD&quot;).filter(function() {
                if ($(this).find(&quot;INPUT[type=text]&quot;).val() != null) {
                    return true;
                }
            }).each(function() {              
                $(this).html($(this).find(&quot;INPUT[type=text]&quot;).val());
            });
          $(&quot;#tblEmployee &amp;gt; tbody &amp;gt; tr[id=&quot; + RowID + &quot;] &amp;gt; td:first&amp;gt; input[value=Update]&quot;).hide();
          $(&quot;#tblEmployee &amp;gt; tbody &amp;gt;  tr[id=&quot; + RowID + &quot;] &amp;gt; td:first&amp;gt; input[value=Cancel]&quot;).hide();
          $(&quot;#tblEmployee &amp;gt; tbody &amp;gt;  tr[id=&quot; + RowID + &quot;] &amp;gt; td:first&amp;gt; input[value=Edit]&quot;).show();
      }
 
      function ResetOtherRowEdit() {
          $(&quot;#tblEmployee &amp;gt; tbody &amp;gt; tr &quot;).each(function() {
              var TRID = $(this).attr(&quot;id&quot;);
              if ($(this).find(&quot;td:first &amp;gt; input[value=Update]&quot;).css(&quot;display&quot;) == &quot;inline&quot;) {
                  CancelEdit(TRID);
              }
          });
      }       
    &amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Execute the page and see it in action.&lt;br /&gt;
&lt;br /&gt;
The ajax() method uses &lt;a href=&quot;http://www.json.org/&quot;&gt;JSON&lt;/a&gt; and POST method to send the employee data to the page method. Once the data is updated successful, the page method will return 1 which indicates success(No of rows affected in ExecuteNonQuery() in our case). On success, you will see a success alert message.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Things to consider&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;The above jQuery code will call the page method even if you have not changed the details in any cell. You can modify UpdateRow() method to call the page method only if the value is changed by comparing with initial table cell value.&lt;/li&gt;
&lt;li&gt;The above jQuery code will change the table cell to textbox by populating its value to textbox directly. You can get the employee detail for that row using the employeeid from the server to get the latest data. You can write one more page method that can return the employee detail in JSON format and populate the textboxes.&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/5006141113345685864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/02/inline-editing-using-jquery-and-ajax-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5006141113345685864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5006141113345685864'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/02/inline-editing-using-jquery-and-ajax-in.html' title='Inline Editing Using jQuery and Ajax in Repeater control'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM-noMG3p-8Yr51XPajQPAz6pfn4LJueJ_hwxjSmISZtFGxwT2F09K74SAhFbF5qN-mcsjXmuukeuKjCln3-FMUa3OU_3sMrMFfCzFo3cVitf3nFtL0muLG3VS_9ddBmSPmh5lT6D2e_Ny/s72-c/InlineEditingUsingJquery.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-6091290179591555645</id><published>2010-02-01T10:47:00.000-08:00</published><updated>2010-09-17T13:24:23.292-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="LINQ"/><category scheme="http://www.blogger.com/atom/ns#" term="LINQ to SQL"/><title type='text'>How to read, insert, update and delete from an XML file Using LINQ to SQL</title><content type='html'>This is an introduction to Linq to XML showing how to read, insert, update and delete from an XML file.&lt;br /&gt;
First of all lets look at the XML file I will be using:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;
&amp;lt;Customers&amp;gt;
 &amp;lt;Customer ID=&quot;1&quot;&amp;gt;
  &amp;lt;Forename&amp;gt;Joe&amp;lt;/Forename&amp;gt;
  &amp;lt;Surname&amp;gt;Stevens&amp;lt;/Surname&amp;gt;
  &amp;lt;DOB&amp;gt;31/01/1983&amp;lt;/DOB&amp;gt;
  &amp;lt;Location&amp;gt;Sydney&amp;lt;/Location&amp;gt;
 &amp;lt;/Customer&amp;gt;
 &amp;lt;Customer ID=&quot;2&quot;&amp;gt;
  &amp;lt;Forename&amp;gt;Tom&amp;lt;/Forename&amp;gt;
  &amp;lt;Surname&amp;gt;Male&amp;lt;/Surname&amp;gt;
  &amp;lt;DOB&amp;gt;02/02/1977&amp;lt;/DOB&amp;gt;
  &amp;lt;Location&amp;gt;Brisbane&amp;lt;/Location&amp;gt;
 &amp;lt;/Customer&amp;gt;
 &amp;lt;Customer ID=&quot;3&quot;&amp;gt;
  &amp;lt;Forename&amp;gt;Emily &amp;lt;/Forename&amp;gt;
  &amp;lt;Surname&amp;gt;Stevens&amp;lt;/Surname&amp;gt;
  &amp;lt;DOB&amp;gt;14/01/1988&amp;lt;/DOB&amp;gt;
  &amp;lt;Location&amp;gt;Sydney&amp;lt;/Location&amp;gt;
 &amp;lt;/Customer&amp;gt;
 &amp;lt;Customer ID=&quot;4&quot;&amp;gt;
  &amp;lt;Forename&amp;gt;Lee&amp;lt;/Forename&amp;gt;
  &amp;lt;Surname&amp;gt;Phipps&amp;lt;/Surname&amp;gt;
  &amp;lt;DOB&amp;gt;05/12/1982&amp;lt;/DOB&amp;gt;
  &amp;lt;Location&amp;gt;Melbourne&amp;lt;/Location&amp;gt;
 &amp;lt;/Customer&amp;gt;
 &amp;lt;Customer ID=&quot;5&quot;&amp;gt;
  &amp;lt;Forename&amp;gt;Saul&amp;lt;/Forename&amp;gt;
  &amp;lt;Surname&amp;gt;Stevens&amp;lt;/Surname&amp;gt;
  &amp;lt;DOB&amp;gt;02/08/1984&amp;lt;/DOB&amp;gt;
  &amp;lt;Location&amp;gt;Perth&amp;lt;/Location&amp;gt;
 &amp;lt;/Customer&amp;gt;
&amp;lt;/Customers&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
As you can see it’s a very simple list of customers.  In my project I have also created a Customer class to represent each customer:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;public class Customer
{
    public int ID { get; set; }
    public string Forename { get; set; }
    public string Surname { get; set; }
    public string DOB { get; set; }
    public string Location { get; set; }
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Firsly I want to be able to select a single customer based on their ID.  The following method shows how to load the XML file and query it to find the customer we want, and return the data as a single Customer object:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;public static Customer GetCustomer(int customerID)
{
    XDocument data = XDocument.Load(HttpContext.Current.Server.MapPath(&quot;~/Data/Customers.xml&quot;));

    return (from c in data.Descendants(&quot;Customer&quot;)
            where c.Attribute(&quot;ID&quot;).Value.Equals(customerID.ToString())
            select new Customer()
            {
                ID = Convert.ToInt32(c.Attribute(&quot;ID&quot;).Value),
                Forename = c.Element(&quot;Forename&quot;).Value,
                Surname = c.Element(&quot;Surname&quot;).Value,
                DOB = c.Element(&quot;DOB&quot;).Value,
                Location = c.Element(&quot;Location&quot;).Value

            }).FirstOrDefault();
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Firstly the XML document is loaded using the XDocument class.  I then use Linq to look at all the Customer elements and find the one where the ID attribute matches the value passed to the method.  The Customer object is then populated with each element within the Customer element.&lt;br /&gt;
I’ve created a simple web form that uses an ObjectDataSource with this method to display a customer based on the ID in the query string:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;asp:DetailsView
    ID=&quot;dvCustomer&quot;
    DataSourceID=&quot;odsCustomer&quot;
    runat=&quot;server&quot;&amp;gt;
&amp;lt;/asp:DetailsView&amp;gt;

&amp;lt;asp:ObjectDataSource
    ID=&quot;odsCustomer&quot;
    TypeName=&quot;LinqToXml.Data.DAL&quot;
    SelectMethod=&quot;GetCustomer&quot;
    runat=&quot;server&quot;&amp;gt;
    &amp;lt;SelectParameters&amp;gt;
        &amp;lt;asp:QueryStringParameter Name=&quot;customerID&quot; QueryStringField=&quot;id&quot; DefaultValue=&quot;1&quot; /&amp;gt;
    &amp;lt;/SelectParameters&amp;gt;
&amp;lt;/asp:ObjectDataSource&amp;gt;
&lt;/code&gt;&lt;/pre&gt;The page creates the following table:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkhUoZqwPs4n8Oumr2zw9hDNtLoOuNPSbvTNYb48pDSOSVTIVsRy6wF3TdO03L1Eos_yaRdLi1BnnkNnrhG08WkVhS4RjV6ALNyb4Bkyz9iAXaEY89xF03RaUimGzE7Vro-h-Hui3NciTA/s1600-h/linqtoxml_single.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkhUoZqwPs4n8Oumr2zw9hDNtLoOuNPSbvTNYb48pDSOSVTIVsRy6wF3TdO03L1Eos_yaRdLi1BnnkNnrhG08WkVhS4RjV6ALNyb4Bkyz9iAXaEY89xF03RaUimGzE7Vro-h-Hui3NciTA/s320/linqtoxml_single.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get a list of all customers is very similar to getting a single customer, although the method will return a generic list of Customer objects:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;public static List&amp;lt;Customer&amp;gt; GetCustomers()
{
    XDocument data = XDocument.Load(HttpContext.Current.Server.MapPath(&quot;~/Data/Customers.xml&quot;));

    return (from c in data.Descendants(&quot;Customer&quot;)
            orderby c.Attribute(&quot;Surname&quot;)
            select new Customer()
            {
                ID = Convert.ToInt32(c.Attribute(&quot;ID&quot;).Value),
                Forename = c.Element(&quot;Forename&quot;).Value,
                Surname = c.Element(&quot;Surname&quot;).Value,
                DOB = c.Element(&quot;DOB&quot;).Value,
                Location = c.Element(&quot;Location&quot;).Value

            }).ToList();
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Here I am also using the orderby operator to order the results by the value of the Surname element.&lt;br /&gt;
I have a single method called Save which is used for both inserting and updating.  It accepts a Customer object and performs an insert or update depending on the ID value of that object:&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;public static void Save(Customer customer)
{
    XDocument data = XDocument.Load(HttpContext.Current.Server.MapPath(&quot;~/Data/Customers.xml&quot;));

    if (customer.ID &amp;gt; 0)
    {
        XElement customerElement = data.Descendants(&quot;Customer&quot;).Where(c =&amp;gt; c.Attribute(&quot;ID&quot;).Value.Equals(customer.ID.ToString())).FirstOrDefault();
        if (customerElement != null)
        {
            customerElement.SetElementValue(&quot;Forename&quot;, customer.Forename);
            customerElement.SetElementValue(&quot;Surname&quot;, customer.Surname);
            customerElement.SetElementValue(&quot;DOB&quot;, customer.DOB);
            customerElement.SetElementValue(&quot;Location&quot;, customer.Location);

            data.Save(HttpContext.Current.Server.MapPath(&quot;~/Data/Customers.xml&quot;));
        }
    }
    else
    {
        XElement newCustomer = new XElement (   &quot;Customer&quot;,
                                                new XElement(&quot;Forename&quot;, customer.Forename),
                                                new XElement(&quot;Surname&quot;, customer.Surname),
                                                new XElement(&quot;DOB&quot;, customer.DOB),
                                                new XElement(&quot;Location&quot;, customer.Location)
                                            );

        newCustomer.SetAttributeValue(&quot;ID&quot;, GetNextAvailableID());

        data.Element(&quot;Customers&quot;).Add(newCustomer);
        data.Save(HttpContext.Current.Server.MapPath(&quot;~/Data/Customers.xml&quot;));
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
In this method I load the XML document as before and then check the value of customer.ID to see whether to insert or update.&lt;br /&gt;
&lt;br /&gt;
If the value is greater than zero then it is an update.  Firstly I get the element matching the ID using the Where extension method and a lambda expression using the given ID. If the element is found (not null), I use the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.setelementvalue.aspx&quot;&gt;SetElementValue&lt;/a&gt; method to update the values of the child elements with their new values.  After this is done I call save on the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx&quot;&gt;XDocument&lt;/a&gt; and pass the URL on the original XML file to update it.&lt;br /&gt;
&lt;br /&gt;
If customer.ID is zero then I know this is a new record and I need to perform an insert.  This is done by creating a new &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.aspx&quot;&gt;XElement &lt;/a&gt;with the name Customer, then by creating a list of XElements for the children.  I then set the ID attribute on the Customer element by calling a method called GetNextAvailableID which I’ll explain in a moment.  Now my element is ready to be inserted so using my XDocument I use the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.xml.linq.xcontainer.element.aspx&quot;&gt;Element &lt;/a&gt;method to get the Customers element and the Add method to &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.add.aspx&quot;&gt;add &lt;/a&gt;my new element to it.  As with the update I then need to call the save method on the XDocument.&lt;br /&gt;
&lt;br /&gt;
The GetNextAvailableID method simply finds the highest ID used in the XML document and adds one to it:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;private static int GetNextAvailableID()
{
XDocument data = XDocument.Load(HttpContext.Current.Server.MapPath(&quot;~/Data/Customers.xml&quot;));

return Convert.ToInt32(
(from c in data.Descendants(&quot;Customer&quot;)
orderby Convert.ToInt32(c.Attribute(&quot;ID&quot;).Value) descending
select c.Attribute(&quot;ID&quot;).Value).FirstOrDefault()
) + 1;
}

public static void Delete(Customer customer)
{
XDocument data = XDocument.Load(HttpContext.Current.Server.MapPath(&quot;~/Data/Customers.xml&quot;));

XElement customerElement = data.Descendants(&quot;Customer&quot;).Where(c =&amp;amp;gt; c.Attribute(&quot;ID&quot;).Value.Equals(customer.ID.ToString())).FirstOrDefault();
if (customerElement != null)
{
customerElement.Remove();
data.Save(HttpContext.Current.Server.MapPath(&quot;~/Data/Customers.xml&quot;));
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
As with the update code I’m selecting the element based on the customer ID.  Once I have that element all I need to do is call the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.xml.linq.xnode.remove.aspx&quot;&gt;Remove &lt;/a&gt;method on it, then save the XDocument.&lt;br /&gt;
&lt;br /&gt;
I have put all this code to use with a GridView and ObjectDataSource in the following form:&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;&amp;lt;div&amp;gt;
&amp;lt;table&amp;gt;&amp;lt;tbody&amp;gt;
&amp;lt;tr&amp;gt;                 &amp;lt;th&amp;gt;
Forename&amp;lt;/th&amp;gt;                 &amp;lt;td&amp;gt;
&amp;lt;asp:textbox id=&quot;txtForename&quot; runat=&quot;server&quot;&amp;gt;
&amp;lt;/asp:textbox&amp;gt;&amp;lt;/td&amp;gt;             &amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;                 &amp;lt;th&amp;gt;
Surname&amp;lt;/th&amp;gt;                 &amp;lt;td&amp;gt;
&amp;lt;asp:textbox id=&quot;txtSurname&quot; runat=&quot;server&quot;&amp;gt;
&amp;lt;/asp:textbox&amp;gt;&amp;lt;/td&amp;gt;             &amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;                 &amp;lt;th&amp;gt;
DOB&amp;lt;/th&amp;gt;                 &amp;lt;td&amp;gt;
&amp;lt;asp:textbox id=&quot;txtDOB&quot; runat=&quot;server&quot;&amp;gt;
&amp;lt;/asp:textbox&amp;gt;&amp;lt;/td&amp;gt;             &amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;                 &amp;lt;th&amp;gt;
Location&amp;lt;/th&amp;gt;                 &amp;lt;td&amp;gt;
&amp;lt;asp:textbox id=&quot;txtLocation&quot; runat=&quot;server&quot;&amp;gt;
&amp;lt;/asp:textbox&amp;gt;&amp;lt;/td&amp;gt;             &amp;lt;/tr&amp;gt;
&amp;lt;/tbody&amp;gt;         &amp;lt;tfoot&amp;gt;
&amp;lt;tr&amp;gt;                 &amp;lt;td colspan=&quot;2&quot;&amp;gt;
&amp;lt;asp:button id=&quot;btnAddCustomer&quot; onclick=&quot;btnAddCustomer_Click&quot; runat=&quot;server&quot; text=&quot;Add Customer&quot;&amp;gt;
&amp;lt;/asp:button&amp;gt;&amp;lt;/td&amp;gt;             &amp;lt;/tr&amp;gt;
&amp;lt;/tfoot&amp;gt;     &amp;lt;/table&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div&amp;gt;
&amp;lt;asp:gridview autogeneratecolumns=&quot;false&quot; autogeneratedeletebutton=&quot;true&quot; autogenerateeditbutton=&quot;true&quot; datakeynames=&quot;ID&quot; datasourceid=&quot;odsCustomers&quot; id=&quot;gvCustomers&quot; runat=&quot;server&quot;&amp;gt;
&amp;lt;columns&amp;gt;
&amp;lt;asp:boundfield datafield=&quot;Forename&quot; headertext=&quot;Forename&quot;&amp;gt;
&amp;lt;asp:boundfield datafield=&quot;Surname&quot; headertext=&quot;Surname&quot;&amp;gt;
&amp;lt;asp:boundfield datafield=&quot;DOB&quot; headertext=&quot;DOB&quot;&amp;gt;
&amp;lt;asp:boundfield datafield=&quot;Location&quot; headertext=&quot;Location&quot;&amp;gt;
&amp;lt;/asp:boundfield&amp;gt;&amp;lt;/asp:boundfield&amp;gt;&amp;lt;/asp:boundfield&amp;gt;&amp;lt;/asp:boundfield&amp;gt;&amp;lt;/columns&amp;gt;
&amp;lt;/asp:gridview&amp;gt;

&amp;lt;asp:objectdatasource dataobjecttypename=&quot;LinqToXml.Customer&quot; deletemethod=&quot;Delete&quot; id=&quot;odsCustomers&quot; runat=&quot;server&quot; selectmethod=&quot;GetCustomers&quot; typename=&quot;LinqToXml.Data.DAL&quot; updatemethod=&quot;Save&quot;&amp;gt;
&amp;lt;/asp:objectdatasource&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
The only code required on the web form is the code to add a new customer, as the selecting, updating and deleting is handled by the ObjectDataSource by calling the methods discussed above:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 95%;&quot;&gt;&lt;code&gt;protected void btnAddCustomer_Click(object sender, EventArgs e)
{
Customer customer = new Customer()
{
Forename = txtForename.Text.Trim(),
Surname = txtSurname.Text.Trim(),
DOB = txtDOB.Text.Trim(),
Location = txtLocation.Text.Trim()
};

Data.DAL.Save(customer);

ClearForm();
gvCustomers.DataBind();
txtForename.Focus();
}

private void ClearForm()
{
txtForename.Text = string.Empty;
txtSurname.Text = string.Empty;
txtDOB.Text = string.Empty;
txtLocation.Text = string.Empty;
}
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
My resulting form looks like this:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-ZtKcGGrZWMv0SnyLdwQXQQv8GzQEtZRo3GGF8XTD5E5Ql8-TJPrQYFHuPHdkknPke9Lsup8mI1R4zZZvJYiD8VEeTdA2D4dEqLtyzE-5leRMzCQrrTo1I4OEvrs5Vz3UT-cleXWFTnMN/s1600-h/linqtoxml_multi.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-ZtKcGGrZWMv0SnyLdwQXQQv8GzQEtZRo3GGF8XTD5E5Ql8-TJPrQYFHuPHdkknPke9Lsup8mI1R4zZZvJYiD8VEeTdA2D4dEqLtyzE-5leRMzCQrrTo1I4OEvrs5Vz3UT-cleXWFTnMN/s320/linqtoxml_multi.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/6091290179591555645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/02/how-to-read-insert-update-and-delete.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/6091290179591555645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/6091290179591555645'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/02/how-to-read-insert-update-and-delete.html' title='How to read, insert, update and delete from an XML file Using LINQ to SQL'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkhUoZqwPs4n8Oumr2zw9hDNtLoOuNPSbvTNYb48pDSOSVTIVsRy6wF3TdO03L1Eos_yaRdLi1BnnkNnrhG08WkVhS4RjV6ALNyb4Bkyz9iAXaEY89xF03RaUimGzE7Vro-h-Hui3NciTA/s72-c/linqtoxml_single.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-9166447219581366469</id><published>2010-01-20T10:06:00.000-08:00</published><updated>2010-01-20T10:06:39.706-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><title type='text'>Open all Hyperlinks in Separate Window using jQuery</title><content type='html'>This is a simple but very powerful script which will prove the jQuery library&#39;s ability. The following script will make all the hyperlinks in the page bolder and add opens the link in new window if clicked.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 98%;&quot;&gt;&lt;code&gt;&amp;lt;script src=&quot;../_scripts/jquery-1[1].3.2.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script language=&quot;javascript&quot;&amp;gt;
$(function() {
$(&#39;A&#39;).css(&#39;font-weight&#39;, &#39;bold&#39;).attr(&#39;target&#39;, &#39;_blank&#39;);
});
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/9166447219581366469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/01/open-all-hyperlinks-in-separate-window.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/9166447219581366469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/9166447219581366469'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/01/open-all-hyperlinks-in-separate-window.html' title='Open all Hyperlinks in Separate Window using jQuery'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-3710937548224857255</id><published>2010-01-20T10:04:00.000-08:00</published><updated>2010-01-20T10:04:25.764-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery Tips"/><title type='text'>How to alert when the form is Submitted or Posted to Server using jQuery</title><content type='html'>Sometimes, we require intercepting whenever a page is posted or submitted to the server.&lt;br /&gt;
The below jQuery snippet will alert teh user with a confirm box with teh message &quot;Are you sure to continue?&quot; Clicking &quot;Yes&quot; will post the page and &quot;No&quot; will cancel the submit.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 98%;&quot;&gt;&lt;code&gt;&amp;lt;head runat=&quot;server&quot;&amp;gt;

&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;

&amp;lt;script src=&quot;_scripts/jquery-1.3.2.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;script language=&quot;javascript&quot;&amp;gt;

$(document).ready(function() {

$(&quot;form&quot;).submit(function() {

return confirm(&#39;Are you sure to continue?&#39;);

});

});

&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/3710937548224857255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/01/how-to-alert-when-form-is-submitted-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/3710937548224857255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/3710937548224857255'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/01/how-to-alert-when-form-is-submitted-or.html' title='How to alert when the form is Submitted or Posted to Server using jQuery'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-4833343430914116125</id><published>2010-01-10T12:11:00.000-08:00</published><updated>2010-01-10T12:12:42.950-08:00</updated><title type='text'>Top 15 Elements All Top Web Sites Should Have</title><content type='html'>There are a lot of details to consider when designing and developing a web site. In reality, it can seem like an endless list — but if you look carefully you’ll see that there are certain elements that are more important than others, elements that are used consistently among the most successful sites.&lt;br /&gt;
Once you’ve completed the Planning Stage of your website, the rest of the elements fall into broad categories ranging from User Interface Design to Content Creation to actual Development. Of course, there are also the issues surrounding Search Engine Optimization (SEO) — but we’ll save that for another day…&lt;br /&gt;
&lt;br /&gt;
With that in mind, here are the 15 elements that should always be included on any top web site. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Good Visual Design&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
First things first… Visual design. I don’t know about you, but if I go to a web site that is not visually pleasing, it is a quick turn off.&lt;br /&gt;
&lt;br /&gt;
That’s not to say that every top website needs an incredible visual design — but if a site looks like it hasn’t been updated since 1994, it’s just not going to be associated with other great websites.&lt;br /&gt;
&lt;br /&gt;
A clean and simple design is usually all you need. Bells and whistles are nice, but I’m one who tends to go with the “less is more” theory. You don’t want your design to be over crowded. You just want it to look good so it can stand out from your competitor(s) in the minds of your potential clients.&lt;br /&gt;
&lt;br /&gt;
First impressions are key. Although good design alone will not keep someone on your site — an eye-catching design will, at the very least, grab their attention long enough to take a look around.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Thoughtful User Interface&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
User Interface / NavigationAlong with good design comes a good user interface. The user interface is the foundation of any good functional web site. When designing a site, you’ll need to take into consideration your average user. Who is going to be visiting your web site — who is your ideal customer? Are they tech-savy? Are they computer illiterate?&lt;br /&gt;
&lt;br /&gt;
It’s helpful to create an image of your ideal visitor and have them in mind when planning out the design for your site. Be sure you offer everything on your site that they would want to find before buying from you or becoming a subscriber.&lt;br /&gt;
&lt;br /&gt;
You’ll want to be sure that your navigation is easy to spot and consistent throughout the entire web site. Make it obvious where the user should click both in terms of your primary navigation, as well as for links within your content areas.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. Primary Navigation Above The Fold&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Part of having an easy to navigate web site is ensuring that the primary means of navigation — links to the key areas of your site — are kept above the fold. With today’s large computer monitors and growing screen resolutions “above the fold” is generally considered to be within the top 500-600 pixels of your site design.&lt;br /&gt;
&lt;br /&gt;
Elements to include here are your logo (which should link back to your home page), as well as links to the main sections of your site. If you can link to sub-pages here that is great, but in most cases that will over-clutter your design.&lt;br /&gt;
&lt;br /&gt;
For example put “Home | About | Services | FAQ | Contact” in a very easy to find location at the top of your site. You can place sub-links such as About-Bio / About-Resume somewhere else, such as in your sidebar or as sub-links under the main page title of that section, etc.&lt;br /&gt;
&lt;br /&gt;
Consistency is key here — be sure to place both your primary and sub-navigational links in the same spot throughout the various pages of your web site.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. Repeat Navigation In The Footer&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you use images (or even flash) for your main navigation, it’s especially important to offer a duplicate set of navigation links in your footer. Even if you use text links at the top, the duplication is still helpful. You want to make it as easy as possible for people to find the content they are looking for on your site.&lt;br /&gt;
&lt;br /&gt;
Often times the footer will link to additional information — such as Terms of Service — as well. Things that should be easy to find, but not necessarily something you want taking up real estate on the primary navigation area of the site&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;5. Meaningful Content&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
You know the saying… “Content is King” — you might have a pretty web site which will catch someone’s eye, but if the content is no good, you can be willing to bet that they aren’t going to stick around.&lt;br /&gt;
&lt;br /&gt;
When writing the copy for your web site, it’s important to provide helpful, knowledgeable information about your company, products, services, etc. If you’re running a blog, informative articles related to your area of expertise are incredibly helpful as well.&lt;br /&gt;
&lt;br /&gt;
While it’s important to sell yourself or your company, you also don’t want to oversell, either. Particularly in a blog setting — people reading a blog don’t want to hear all about “me me me” — they want to know how you can help them.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;6. A Solid About Page&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Among the top 10 most popular pages of my own site (after the home page, blog, 3 specific blog posts and my portfolio) is the About page. I have more clicks to my about page than to my services or portfolio pages, if you can believe that!&lt;br /&gt;
&lt;br /&gt;
It’s simply because people are curious. They want to know who is behind a company or a blog. I was personally quite shy about including a photo on my own bio page, but finally did it a few months ago. It’s amazing what the sense of curiosity does — I myself am always clicking on about pages too, trying to find out more about the designer or writer, etc.&lt;br /&gt;
&lt;br /&gt;
Include information on your background and how it pertains to your own business and expertise, etc. The about page gives potential clients a little bit more information about you and can often help create a more personal bond. If they are reading your writing and know a bit more about you, they’ll have a better sense of connection and better be able to relate to you on another level.&lt;br /&gt;
&lt;br /&gt;
More often than not, a potential client will select the company with a “real” person behind it, rather than the faceless organization that refuses to get even a little bit personal.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;7. Contact Information&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Contact InformationNothing can turn off a prospective client more than not being able to find a way to contact you. If they’re interested in your services, and can’t find a simple contact page with a way to get in touch and hire you they’re going to end up going over to the competition.&lt;br /&gt;
&lt;br /&gt;
Ideally you’ll want to give more than one method of contact. At the very least an email address and contact form. To make you more “real” though you should try to include a phone number (and if possible a mailing address) as well. I know many freelancers work from a home office – as do I. A quick solution is to get a separate phone line for business calls, as well as either a PO Box or other mailing service address.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that these are tax deductible expenses and makes you look that much more professional than someone who only includes an email address. To other home business owners in the same boat, it might not make a difference. But if you work with any larger or corporate clients, they’ll see a public phone number and address as an added sign of stability and that could play a small part in them choosing you over someone else.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;8. Search&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you have a large web site or blog, having a search field is incredibly helpful, as well. There’s nothing like wading through hundreds of pages to find specific content without a search feature. If a potential customer can’t find something easily on your site, but Joe Designer over there does… odds are they are going to go with Joe whose content is easy to search through.&lt;br /&gt;
&lt;br /&gt;
You can often use a Google Search on your site, or if you have WordPress (or another blogging platform or CMS / Content Management System) this will be fairly easy to accomplish. It’s not quite as easy to set this up with a static html site, but there are still services out there that will let you incorporate a functional search box onto your site.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;9. Sign-Up / Subscribe&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
RSS SubscriptionIf your web site offers content on a consistent basis — such as with a blog — you’ll want to make it as easy as possible for people to sign up for updates.&lt;br /&gt;
&lt;br /&gt;
This is something else that’s extremely easy to add if you have a WordPress blog. By default they’ll provide you with a feed address. But if you want to step it up a notch, you’ll want to sign up for a free account with FeedBurner. Better yet, you might consider using the FeedBurner FeedSmith plugin that will help re-direct all feeds through your FeedBurner account for easy tracking of your subscribers.&lt;br /&gt;
&lt;br /&gt;
If you don’t have a blog, but still want to offer subscriptions to an email newsletter, for example, there are many companies that will let you setup and manage a mailing list. They will provide you code for your site to enable your web site visitors to sign up for updates using their email address. (FeedBurner allows you to collect email addresses too, btw). In some ways this is better than an RSS subscription because you are able to collect email addresses of potential prospects. While you can keep track of subscription numbers and other generic statistics, RSS subscribers get your updates via feed reader and have no need to provide an email address.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;10. Sitemap&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There are two kinds of sitemaps – one for humans and one for the search engines. An html (or php, etc.) sitemap meant for visitors to your site can be an invaluable tool for finding just what they are looking for.&lt;br /&gt;
&lt;br /&gt;
Creating a sitemap – a structured list of all pages of a web site – is especially useful if you are unable to add a search feature to your site. A link to the sitemap is another item that is helpful to place down in the footer of your site, as well. A good sitemap will list out every page of your site in a hierarchial format – clearly showing the relationship of pages in terms of primary pages with sub-pages and sub-sub-pages, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;11. Separate Design from Content&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Long gone are the days of using html tables for layout and design. The best developed sites use a combination of XHTML and CSS (Cascading Style Sheets), which create a separation of design vs content.&lt;br /&gt;
&lt;br /&gt;
With use of tags you can create containers for various areas of text and images on your page. Without a corresponding CSS file you’ll see just the basics – text – which is what the search engines want to see, too.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
By linking to an external CSS file in order to separate your content from the design, it leaves your html page with mostly nothing but actual relevant text in your source code. The separate CSS file is what specifies the fonts, colors, background images, etc. for your site design.&lt;br /&gt;
&lt;br /&gt;
What’s great about this is you can update just one CSS file and have the change made site-wide (no longer having to go into each and every html page of a static site, to change your main link color from blue to green, for example).&lt;br /&gt;
&lt;br /&gt;
With this separation of content from design, the search engines no longer have to wade through all of the excess code to find out if your content is relevant, either. And with separate files, the content can load quicker, too – always a good thing in the mind of visitors to your site.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;12. Valid XHTML / CSS&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
It’s not just enough to develop your site using XHTML and CSS, though. It has to be accurate code. Two invaluable tools for checking your source code are offered by the World Wide Web Consortium (W3C):&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://validator.w3.org/&quot;&gt;W3C Markup Validation Service&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://jigsaw.w3.org/css-validator/&quot;&gt;W3C CSS Validation Service&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
There are many reasons to write valid code… With valid code, you are a few steps closer to ensuring your site will look good across the different web browsers (see number 13 below) and will help you with the search engines, too. If your site is built to current web standards, the search engines can easily wade through your content.&lt;br /&gt;
&lt;br /&gt;
Not to mention it just shows that you know what you are doing. Yes, many clients don’t know the difference, but a few do – and specifically request standards compliant code. If you can offer this but your competitor can’t – that gives you an extra edge.&lt;br /&gt;
&lt;br /&gt;
And besides this, other web developers are likely to check out the source code of a site to see what’s under the hood… both out of sheer curiosity, and just because they can!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;13. Cross Browser Compatibility&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Although you might live and breathe inside Firefox, your client may not. There’s a good chance your client is using Internet Explorer. Unfortunately there’s an even better chance they’re using Internet Explorer 6 (please don’t get me started on this issue – lets just say I know I’m not the only web developer who wishes this browser will simply GO AWAY!)&lt;br /&gt;
&lt;br /&gt;
It’s imporant that your own web site and the site(s) you create for customers display well in as many of the mainstream web browsers as possible. If you can make them compatible across platforms too, that’s ideal. Most end users are on a PC so this is probably the most important platform to target. However many people in the creative fields are on a Mac, so if this is your audience they are important to pay attention to as well.&lt;br /&gt;
&lt;br /&gt;
Unfortunately most people aren’t lucky enough to have both a PC and a Mac (not to mention Linux, etc.) but with the help of a site called Browser Shots you can enter a URL – select from a variety of web browsers across different platforms – and have them create screenshots for you. Very helpful if you’re on a PC running Vista for example, where you no longer have access to an old copy of IE6.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;14. Web Optimized Images&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
When designing for the web, it’s important that you save all your images in a compressed format. Not too much that your images become pixelated, but as much as possible while retaining quality.&lt;br /&gt;
&lt;br /&gt;
If you’re accustomed to doing print work, you know that 300dpi is the standard. Not the case with web sites, though. When designing for the screen you’ll want to save your images at 72dpi which will make for a much smaller file size (aka quicker download time for your web visitors).&lt;br /&gt;
&lt;br /&gt;
Programs like Adobe Photoshop have a “Save for Web” feature that will automatically convert your image to 72dpi if you forgot, as well as give you a variety of compression settings when saving your imges. For web this will likely be either png, jpg or gif depending on the particular usage.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;15. Statistics, Tracking and Analytics&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Although this element is behind the scenes and not one you’re likely to know about as the web visitor — as a web site owner it is crucial, if not down-right addictive!&lt;br /&gt;
&lt;br /&gt;
There are many services that offer tracking of web site statistics which include information such as:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;How many hits does my site receive?&lt;/li&gt;
&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;How many of these are from unique visitors?&lt;/li&gt;
&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;How are people finding my web site?&lt;/li&gt;
&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;What search terms are they finding me under?&lt;/li&gt;
&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;What web sites link to me?&lt;/li&gt;
&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;What are the most popular pages on my site?&lt;/li&gt;
&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Who is my average visitor (platform / browser / screen resolution)?&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
It’s actually quite amazing what kind of information you can keep track of with a good analytics program. Perhaps the most popular site for this is Google Analytics which offer a very robust (and free) tracking solution.&lt;br /&gt;
&lt;br /&gt;
If you want to monitor your web site’s performance and figure out how you can improve your site, having a good stats package is key!&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/4833343430914116125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/01/top-15-elements-all-top-web-sites.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/4833343430914116125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/4833343430914116125'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/01/top-15-elements-all-top-web-sites.html' title='Top 15 Elements All Top Web Sites Should Have'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-5983175993145794899</id><published>2010-01-10T11:55:00.000-08:00</published><updated>2010-01-10T12:14:30.512-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SEO Tips"/><category scheme="http://www.blogger.com/atom/ns#" term="Website development"/><title type='text'>Top 10 SEO Techniques For Any Website</title><content type='html'>SEO is such a hot topic these days. How do you get your web site within the first page or two of the search engines? How do you increase your Google page rank?&lt;br /&gt;
&lt;br /&gt;
There are companies who dedicate themselves full time to doing SEO at a pretty penny. Something a lot of people can’t necessarily afford to pay for or spend the time on.&lt;br /&gt;
&lt;br /&gt;
However, there are some simple things you can do when building your site that will help increase your chances of having good results. In no particular order, below are 10 of these items…&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Title Tag&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Near the very top of a web site’s source code you’ll find various meta tags — the standard ones being the Title, Description and Keyword tags. The title tag is technically not a meta tag, though it is commonly associated with them. The title tag plays such a large role in the indexing of your web site, that it is considered the most important of the three.&lt;br /&gt;
&lt;br /&gt;
A page title is the first thing a search engine will look at when determining just what the particular page is about. It is also the first thing potential visitors will see when looking at your search engine listing.&lt;br /&gt;
&lt;br /&gt;
It’s important to include a keyword or two in the title tag — but don’t go overboard – you don’t want to do what’s known as “keyword stuffing” which does nothing but make your web site look like spam. Most people will include either the company name, or title of the particular page here, as well.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Meta Tags&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Meta TagsThere are two primary meta tags in terms of SEO — the description and the keyword tag. It’s debatable whether the search engines use the description tag as far as ranking your results. However it is one of the more important tags because it is listed in your search result — it is what users read when your link comes up and what makes them decide whether or not to click on your link.&lt;br /&gt;
&lt;br /&gt;
Be sure to include a few relevant keywords in this tag, but don’t stuff it with keywords either. The description tag should read like a sentence — not a keyword list.&lt;br /&gt;
&lt;br /&gt;
Due to “keyword stuffing” many search engines now completely disregard the keyword tag. It is no longer nearly as important as it was years ago, however it doesn’t hurt to include them in your source code.&lt;br /&gt;
&lt;br /&gt;
When creating your keyword list, you’ll want to think of the specific terms people will type in when searching for a site like yours. Just don’t go overboard — too many duplicates are not a good thing (as in “web designer” “web designers” “custom web designer” “html web designer” “your state here web designer” – you get the idea). Those are all basically the same, so pick one or two variations at the most and move onto the next keyword.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. Proper Use of Heading Tags&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is a very important element to consider when writing out your site copy. Use of heading tags helps users, web browsers and search engines alike know where the major key points of your copy are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your main page title should use the &quot;h1&quot; tag — this shows what your page is about. Use of additional tags, such as &quot;h2&quot; and &quot;h3&quot; are equally important by helping to break down your copy. For one, you’ll see a visual break in the text. But as far as the search engines are concerned, it will automatically know what your topics are on a page. The various heading tags give a priority to the content and help index your site properly.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. Alt Attributes on Images&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Putting alt attributes on your images actually serves two purposes. In terms of SEO, putting a brief yet descriptive alt attribute along with your image, places additional relevant text to your source code that the search engines can see when indexing your site. The more relevant text on your page the better chance you have of achieving higher search engine rankings.&lt;br /&gt;
&lt;br /&gt;
In addition, including image alt attributes help the visually impaired who access web sites using a screen reader. They can’t see the image, but with a descriptive alt attribute, they will be able to know what your image &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;5. Title Attributes on Links&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Including title attributes on links is another important step that any good web site will have. That’s the little “tool tip” that pops up when you place your mouse over a link. These are especially important for image links, but equally useful for text links.&lt;br /&gt;
&lt;br /&gt;
As a note, you should use descriptive text for your links. “Click here” doesn’t really tell a person – or more importantly, the search engines — what the link is. At the very least put a title tag that will explain that “Click Here” really means “Web Design Portfolio” for example. Better yet – make the main link text something like “View my web design portfolio” — this will give some value to the link showing that the resulting page is relevant to searches for portfolio’s.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;6. XML Sitemap&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
My last post referenced the sitemaps used by web visitors to help them navigate through your site themselves. However, there’s another version — XML sitemaps — that are used by the search engines in order to index through your site, as well.&lt;br /&gt;
&lt;br /&gt;
This list of ALL pages / posts / etc. of your site also includes information such as the date the page was last modified, as well as a priority number of what you feel the most important pages of your sites are. All elements that help the search engines properly find and link to all content of your site.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;7. Relevant Content&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Having content relevant to your main page or site topic is perhaps the most important SEO aspect of a page. You can put all the keywords you want in the meta tags and alt image tags, etc — but if the actual readable text on the page is not relevant to the target keywords, it ends up basically being a futile attempt.&lt;br /&gt;
&lt;br /&gt;
While it is important to include as many keywords in your page copy as possible, it is equally as important for it to read well and make sense. I’m sure we’ve all seen keyword stuffed pages written by SEO companies that honestly don’t make much sense from the reader’s point of view.&lt;br /&gt;
&lt;br /&gt;
When creating your site copy, just write naturally, explaining whatever information you’re discussing. The key is to make it relevant, and to have it make sense to the reader. Even if you trick the search engines into thinking your page is great — when a potential customer arrives at the site and can’t make heads or tails of your information and it just feels spammy to them — you can bet they’ll be clicking on the next web site within a matter of seconds.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;8. Link Building&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
We’ve probably all heard of Google Page Rank — it seems to be every web site owner’s dream to have as high a page rank as possible. While the algorithm for determining page rank encompasses many elements, and is constantly changing, one item is the number of links pointing to your web site.&lt;br /&gt;
&lt;br /&gt;
Now, you’ll want to steer clear of link farms and other spammy attempts at getting links to your site. However there are many reputable and niche directory sites that you can use to submit your web site, or specific blog articles to.&lt;br /&gt;
&lt;br /&gt;
With genuine content — especially if you have a blog — you’ll be able to generate links with other web sites and blogs, as well. It’s somewhat of a give and take, in that if you link out to other sites, you’ll find sites linking back to you  — and hopefully see your page rank going up, as well!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;9. Social Media&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Although technically not SEO, Social Media is such a growing factor in getting your web site noticed, that it’s an important element to include in your plan.&lt;br /&gt;
&lt;br /&gt;
Social media ranges from social networks like Twitter, Facebook and LinkedIn — to social bookmarking sites such as Delicious, Digg, StumbleUpon and many more. There is a lot of relationship building involved, but as you build your own networks and build quality content on your web site or blog, you’ll see traffic to your web site increasing, as well.&lt;br /&gt;
&lt;br /&gt;
As with any relationship, it is a give and take. Don’t just expect to join a site like Twitter for the pure sake of pushing your content. That just won’t fly — your true intentions will stick out like a sore thumb and do nothing but turn people off.&lt;br /&gt;
&lt;br /&gt;
Even if you are on the site purely for networking reasons, the key is to make friends. Help out members of your network if they ask for a “retweet” or Digg, give helpful advice if asked, etc. You’ll see the same in return.&lt;br /&gt;
&lt;br /&gt;
If you write a great post and have built meaningful relationships with peers in your  niche, you’ll often find that friends will submit your posts and give you votes on the social bookmarking sites. The more votes you receive, the more likely your post is to be noticed by others and shared around, often resulting in additional link backs from other blogs, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;10. A Few SEO Don’ts — Flash and Splash&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Flash PlayerAlong with any list of Do’s come the Don’ts. As far as SEO is concerned, two of these items are splash pages (often consisting of a flash animation) and all flash web sites.&lt;br /&gt;
&lt;br /&gt;
Yes, flash is pretty! Full flash web sites can actually be amazing to look at — their own bit of interactive artwork. But unfortunately the search engines don’t get along well with Flash. Although there is talk of possible advancement in this area, for the most part the search engines cannot read Flash.&lt;br /&gt;
&lt;br /&gt;
All that great content that you wrote for your site will not be seen by the search engines if it’s embedded into a Flash web site. As far as the search engines are concerned, your all flash web site might as well be invisible. And if the search engines can’t see your site content, a good chunk of potential customers will miss out on what you have to offer, too.&lt;br /&gt;
&lt;br /&gt;
Equally as “pointless” are splash pages. Once very popular, the splash page should no longer be an important feature of any site. While splash pages used to serve as an introduction into a web site (often with a flash animation), it is no longer seen as helpful, and often times might actually annoy visitors.&lt;br /&gt;
&lt;br /&gt;
For one — it’s an extra click to get into your content. Worse is when you don’t give a “skip intro” option or set of links into your main site content — because you’re essentially forcing your visitors to sit through the full animation. If you’re lucky, this will only annoy them… if not — they’ll just leave without giving your main web site a shot. And without an html link pointing into your site, the search engines have no way to continue either (unless you made use of a sitemap.xml file — but still…)&lt;br /&gt;
&lt;br /&gt;
A good alternative to both issues is to make use of a flash header. There’s no problem to include a flash animation at the top of your main site, or as a feature within the content area, etc. Because this is an addition to your web site, as opposed to a full separate element.</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/5983175993145794899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/01/top-10-seo-techniques-for-any-website.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5983175993145794899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/5983175993145794899'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/01/top-10-seo-techniques-for-any-website.html' title='Top 10 SEO Techniques For Any Website'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4341475203469836024.post-1561892356473366924</id><published>2010-01-09T10:53:00.000-08:00</published><updated>2010-01-09T11:04:44.774-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SEO Tips"/><title type='text'>Importance of ALT tag in SEO</title><content type='html'>&lt;b&gt;Alt Tag Definition:&lt;/b&gt;&lt;br /&gt;
With the help of HTML tag which provides alternative text when non-textual elements, typically images, cannot be displayed.&lt;br /&gt;
ALT Tag is a one of the important factor while Optimizing Image for a web page.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Alt Tag in Html:&lt;/b&gt;&lt;br /&gt;
The alt attribute is used to define an &quot;alternate text&quot; for an image. The value of the alt attribute is an author-defined text:&lt;br /&gt;
Free SEO Article&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Important Factor for On-page Optimization Alt Tag to Image:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Alt tag generally means the alternative tag. Alt Tag is the HTML tag that tells search engine about the images. Because search engines cannot read text in the images, so with the help of alt tag, search engines come to know about images.&lt;br /&gt;
&lt;br /&gt;
Search engines crawlers are able to index text but they are unable to index the text in the images can create problems. So while making a website you can not only target search engines but the outcome will be generated through visitors.&lt;br /&gt;
&lt;br /&gt;
According to Google friendly site guidelines, we have to create a website SEO friendly and it must helpful to visitors. If we are using the images in the WebPages, in such a situation, alt tag is the best option to add more beauty to your website.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Here are few Tips to add Alt Tag Text to Images:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt; Use ALT Tags to label every image on your web page.&lt;/li&gt;
&lt;li&gt;Only use the most relevant keyword in ALT Tag to label your image.&lt;/li&gt;
&lt;li&gt;Do not add unrelated keywords in ALT Tags.&lt;/li&gt;
&lt;li&gt;Try not to make ALT Tag look like spam for search engines.&lt;/li&gt;
&lt;li&gt;Add keyword or phrase for important images.&lt;/li&gt;
&lt;li&gt;For other images like background images, spacers, dividing lines, table borders, and other images used for designing use alt=”” as the Alternate Text.&lt;/li&gt;
&lt;li&gt;Do not repeat keywords.&lt;/li&gt;
&lt;li&gt;ALT Text should be a sentence or phrase, instead of keywords separated by commas.&lt;/li&gt;
&lt;li&gt;The correct way to use ALT Text is:”FreeWhere seo.jpg is the image name and “Free SEO Articles” is the ALT Tag added to the image so as to label it.&lt;/li&gt;
&lt;/ul&gt;It is recommended to use ALT tag with every image of your web page.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Alt Tag optimization Tips:&lt;/b&gt; &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Use alt tag for all images in the web pages and add most relevant keyword in your Alt tag.&lt;/li&gt;
&lt;li&gt;Use keywords that are present in title tag, Meta tag and body text.&lt;/li&gt;
&lt;li&gt;Use 2-3 relevant keywords rather than the repetition of keywords.&lt;/li&gt;
&lt;li&gt;Use plural keywords in alt tag.&lt;/li&gt;
&lt;li&gt;Alt tag should not be long and must not exceed more than 7 words.&lt;/li&gt;
&lt;li&gt;Avoid using of irrelevant keywords in the alt tag that are not related to images instead use keywords that directly explain the images.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://codetechblg.blogspot.com/feeds/1561892356473366924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codetechblg.blogspot.com/2010/01/alt-tag-importance-in-seo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/1561892356473366924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4341475203469836024/posts/default/1561892356473366924'/><link rel='alternate' type='text/html' href='http://codetechblg.blogspot.com/2010/01/alt-tag-importance-in-seo.html' title='Importance of ALT tag in SEO'/><author><name>hunterz85</name><uri>http://www.blogger.com/profile/17218049498811377010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>