Monday, 29 April 2013

Automatically Move Cursor to Next Field When Textbox Full using javascript in asp.net

JavaScript-
 
<script type="text/javascript">
function movetoNext(current, nextFieldID) {
if (current.value.length >= current.maxLength) {
document.getElementById(nextFieldID).focus();
}
}
</script>


html-

<input type="text" id="txtFirst" size="4" onkeyup="movetoNext(this, 'txtSecond')" maxlength="10" />
<input type="text" id="txtSecond" size="4" onkeyup="movetoNext(this, 'txtThird')" maxlength="10" />
<input type="text" id="txtThird" size="5" maxlength="11" />

between condition with two fields

select id from tblSupplier where PID= @val_PID and @val_IPCWrkFrm between IPFrom and IPdteTo

Join with and condition in sql server



select * from table a inner join tableB b on a.id=b.id and a.name=b.name

Friday, 19 April 2013

Remove scroll then print all data using javascript



function getForm()
    {
   
        var prtContent = document.getElementById('divPrintSupplierBill');
       var WinPrint = window.open('','','letf=100,top=100,width=1000px,height=640px,toolbar=1,scrollbars=1,status=1');
       WinPrint.document.write(prtContent.outerHTML);
       WinPrint.document.close();
       WinPrint.focus();
       WinPrint.print();
     //WinPrint.close();
       //prtContent.innerHTML=strOldOne;
    }
   
    function disableBtn() {
    document.getElementById("btnPrintInvoice").disabled=true
}





function ff()
    {
   var tt= document.getElementById("ctl00_ContentPlaceHolder1_pnlSupplierBilDetail");
    tt.style.cssText='overflow-y:hidden';
    getForm();
    scrollallow();
    return false;
    }
function scrollallow()
{
var tt= document.getElementById("ctl00_ContentPlaceHolder1_pnlSupplierBilDetail");
   tt.style.cssText='overflow-y:scroll;Height:350px';
    return false;
}

Print only gridview data with preview using javascript


///  print grid data directly
function PrintGridData() {
var prtGrid = document.getElementById('<%=GDVBOQDetail.ClientID %>');
prtGrid.border = 0;
var prtgriddata = window.open('', 'GDVBOQDetail', 'left=100,top=100,width=1000,height=1000,tollbar=0,scrollbars=1,status=0,resizable=1');
prtgriddata .document.write(prtGrid.outerHTML);
prtgriddata .document.close();
prtgriddata .focus();
prtgriddata .print();
prtgriddata .close();
}

print preview then print


function PrintGridData() {
var prtGrid = document.getElementById('<%=GDVBOQDetail.ClientID %>');
prtGrid.border = 0;
var prtgriddata = window.open('', 'GDVBOQDetail', 'left=100,top=100,width=1000,height=1000,tollbar=0,scrollbars=1,status=0,resizable=1');
prtgriddata .document.write(prtGrid.outerHTML);
prtgriddata .document.close();
prtgriddata .focus();
//prtgriddata .print();
//prtgriddata .close();
}

Saturday, 13 April 2013

Gridview datakey value on rowcommand


GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer;
            string id =GridView1.DataKeys[row.RowIndex].Values[0].ToString();

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...