Saturday, March 30, 2019

Targeting Microsoft Edge with CSS

CSS snippet follows can be used to target Edge browser

@supports (-ms-ime-align: auto) {
  .className {
        border: 1px solid;
  }
}

Please note that Edge is the only browser that supports this property.

Following snippet can be used to target both Edge/IE browsers.

_:-ms-lang(x),
.classNamer
{
  border: 1px solid;
}

Visit this link for more information,

Cheers
Samitha

Wednesday, February 27, 2019

CSS Accessing Elements using data attributes

When selecting elements in CSS, normally we user ID or class to select them. We can use data attribute in an element to select an element as shown below.

HTML

<div data-somename>
  Hi
</div>

CSS
[data-somename] {
color: red;
font-style: underline;

}

Cheers,
Samitha

Friday, February 15, 2019

read only radio input

A radio button can be easily disabled using "return false" on click as shown below.


<input type="radio" id="rbOptions" checked="checked" onclick="return false;"/>

Cheers
Samitha


Thursday, January 24, 2019

get RadioButtonList selected value.

You can use jQuery / JavaScript to get the selected value of a RadioButtonList . jQuery provides much more simpler approach as shown below.

jQuery
var selectedVal = $('#<%= RadioButtonList.ClientID %> input:checked').val();

JavaScript

var radioList= document.getElementById("<%= RadioButtonList.ClientID %>");
 var options= radioList.getElementsByTagName("input");
 var selected;
 for (var i = 0; i < options.length; i++) {
      if (options[i].checked) {
          selected = options[i];
          break;
       }
  }
  if (selected) {
       alert(selected.value);
  }

Regards,
Samitha

Wednesday, January 9, 2019

jQuery find element in a table

jQuery can be used to find an element inside a table easily as shown below.

var td = $("#tbIntervalos").find("#tdId");

cheers
Samitha

Saturday, December 22, 2018

The "SqlBuildTask" task failed unexpectedly

When using Visual Studio database projects, suddenly you will come across The "SqlBuildTask" task failed unexpectedly when building the database project.

The reason behind this error is a recent update to SQL Server Data Tools (SSDT) for Visual Studio. You can find all previous releases for SSDT here.

Cheers,
Samitha

Sunday, December 2, 2018

retrieve RadioButtonList selected value from jQuery

You can use jQery to get  RadioButtonList selected value as shown below.

var selectedVal = $('#<%= RadioButtonList.ClientID %> input:checked').val();

If you inspect the HTML DOM for a radiobutton list, you can observe that it is a set of <input type="radio"> with the same name attribute. So you can use getElementsByName to access the collection of radio buttons their index as shown below.

alert(document.getElementsByName('RadioButtonListName') [0].checked);


cheers,
Samitha