Wednesday, September 18, 2013

Prevent to open multiple windows from window.open function

function launchApplication(l_url, l_windowName)
{
  if ( typeof launchApplication.winRefs == 'undefined' )
  {
    launchApplication.winRefs = {};
  }
  if ( typeof launchApplication.winrefs[l_windowName] == 'undefined' || launchApplication.winrefs[l_windowName].closed )
  {
    var l_width = screen.availWidth;
    var l_height = screen.availHeight;

    var l_params = 'status=1' +
                   ',resizable=1' +
                   ',scrollbars=1' +
                   ',width=' + l_width +
                   ',height=' + l_height +
                   ',left=0' +
                   ',top=0';

    launchApplication.winrefs[l_windowName] = window.open(l_url, l_windowName, l_params);
    launchApplication.winrefs[l_windowName].moveTo(0,0);
    launchApplication.winrefs[l_windowName].resizeTo(l_width, l_height);
  } else {
    launchApplication.winrefs[l_windowName].focus()
  }
}

Saturday, August 31, 2013

Disable Image button

 I used this code:  OnClientClick="DisableLink(this);"
This is the JS function:

function DisableLink(obj) {
    obj.disabled = 1;
    obj.style.visibility = "hidden";
    obj.style.display = "none";

Sunday, June 23, 2013

Find Control inside any repeater row or html row using Jquery

To find the control just pass the current row object from any front end page(ASPX, PHP, HTML etc)

1. row.all will give all the elements present in the row
2. use find method to find the element of particular id. I used id*= any id which contains lblName. i have only one label.

function FindConrol(row) {
            var label = $(row.all).find('[id*=lblName]');
            alert(label.text());
        }

we can perform the same operation using .each function

This idea is better than using
row.cell[cellnumber].all[elementNumber]