Friday, March 2, 2018

find next table-row

When iterating though a table there are instances where we have to get the next/ previous rows.
In an earlier article I discussed how to iterate on table rows using jQuery. We can use the same code with few extra lines to get the row as shown below.

var next =$this.closest('tr').next('tr');
var prev =$this.closest('tr').prev('tr');


Thursday, February 8, 2018

jquery using same event for multiple classes

You can attach same event for multiple css classes as displayed below.

<script type='''text/javascript">

function OnClicked(){
    if ($(this).hasClass('tag1')){
        // code
    else {
         // code

  $(function() {
    //method 1
     $(".tag1, .tag2").click(OnClicked);

         //method 2
        $(".tag1, .tag2").click(function(){




Friday, January 26, 2018

Iterate a table rows with JQuery

 HTML table can be easily iterated using jQuery as shown below. The trick is to use a class for each row and iterate using $("tr.item") selector. 
Also note that $this.find is used to get value of a given table cell.

 <tr class="item">

    <td> cell1 </td>
    <td> <span class="value">25.00 </span> € </td>
    <td> <input type="text" value="15" class="quantity" /> </td>
   <tr class="item">
    <td> cell2 </td>
    <td> <span class="value">50.00 </span> € </td>
    <td> <input type="text" value="16" class="quantity" /> </td>

$("tr.item").each(function() {
  $this = $(this);
  //gets value of span 
  var value = $this.find("span.value").html();
  //gets value of input 
  var quantity = $this.find("input.quantity").val();

Thursday, January 18, 2018

Retrieve button value

You can use jQuery val() function to retrieve buttons' value as shown below.


<button class="btn1"  name="btn1" value="button1">


<script type="text/javascript">
    $(function() {
        $('.btn1').click(function() {

 This will display the value button1.


Wednesday, December 6, 2017

.NET Support for TLS 1.2

It seems that support for TLS 1.2 dependent on the .net framework version.

  • NET 4.6 and above. Supported by default.
  • .NET 4.5. TLS 1.2 is supported. The following code will make TLS 1.2 to be used as the default protocol.                                                                  ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  • .NET 4.0. TLS 1.2 is not supported, but following code can be used as a workaround:
    ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
  • .NET 3.5 or below. TLS 1.2 is not supported.


Thursday, November 16, 2017

Removing XML Nodes from a XML Document

Following code can be used to remove a XmlNode with all the children nodes

      XmlDocument doc = new XmlDocument();
        doc .Load(MapPath("~/FileName.xml"));
        XmlNodeList selectedNodes = doc .SelectNodes("//SubNode");
       foreach (XmlNode node in selectedNodes )


Thursday, November 2, 2017

IIS error accessing WCF (HTTP Error 404.3)

When accessing a WCF service through browser, you  might have encountered following IIS error.

HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

This occurs due to a feature in IIS which is not turned on by default.

This issue can be solved through following steps.

  1. From Control Panel -> Programs and Features -? Turn Windows features on or off.
  2. Click.NET Framework 4.6 Advanced Services - WCF Services (actual framework version may change)
  3.  Select HTTP Activation
  4. Ok