Saturday, March 26, 2011

How to use cufon.replace inside UpdatePanel?


Place below code inside Update Panel 
 
<script type="text/javascript" language="javascript">
  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
  function EndRequestHandler(sender, args)
  {
   Cufon.replace('h1');
   Cufon.now();  
 }
<script>

Saturday, March 12, 2011

how can I jump to the top of page using UpdatePanel?


<script type="text/javascript" language="javascript">
  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
  function EndRequestHandler(sender, args)
  {
  scrollTo(0,0);
  }
<script>

Monday, March 7, 2011

Difference between JOIN and INNER JOIN

SELECT * FROM table JOIN otherTable ON table.ID = otherTable.FK

OR

SELECT * FROM table INNER JOIN otherTable ON table.ID = otherTable.FK

They function the same. INNER JOIN can be a bit more clear to read, especially if your query has other join types (e.g. LEFT or RIGHT) included in it.

Similarly with OUTER JOINs the word "OUTER" is optional, its the LEFT or RIGHT keyword that makes the JOIN an "OUTER" JOIN.

However for some reason I always use "OUTER" as in LEFT OUTER JOIN and never LEFT JOIN, but I never use INNER JOIN but rather I just use "JOIN"

Monday, October 18, 2010

Sql - server - Find Last updated stored procedures

SELECT name, create_date, modify_date
FROM sys.objects
WHERE type = 'P'
ORDER BY modify_date desc, create_date desc

Wednesday, October 6, 2010

SQL-Server - Generalized Paging Query That Includes Sorting Clauses

SELECT TOP page_size * FROM table WHERE primary_key NOT IN
(SELECT TOP page_size * (page_number - 1) primary_key FROM table
WHERE filter_conditions
ORDER BY sort_field)
AND filter_criteria
ORDER BY sort_field

How do I open PDF's to specific pages?

Open a PDF to a specific page from a web-server
1. Use name/destination pairs when you Distill your PDF document. Please refer to the https://partners.adobe.com/asn/acrobat/sdk/explodedSDK/Documentation/PDF_Creation_APIs/pdfmarkReference.pdf This is designed for PostScript engineers or for those who are generating their own PostScript.
2. Use a highlight file.
3. append #page=x [where x is the page number].
4. Select File > Document Properties > Open Options and target the page and view you want. This is the easiest, but least flexible method, as you get exactly one view that you can open to.

JavaScript function to check/Uncheck all the check boxes on a form

function CheckAll(flag) {
var fmobj = document.friendbox;
for (var i=0;i {
var e = fmobj.elements[i];
if(e.type=='checkbox')
{
if(flag=='false')
e.checked = false;
else
e.checked = true;
}
}
}

javascript to get values of query string variable:

var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}

Javascript: Function to get Cookies values

function getCookiesValue(objCkNm)
{
var beginindex, endindex, result, num;
num = objCkNm.length;
beginindex=document.cookie.indexOf(objCkNm) + num +1 ;
endindex=beginindex;
//while we haven't hit ";" and it's not end of cookie
while (document.cookie.charAt(endindex)!=";" && endindex <= document.cookie.length)
endindex++

//result contains "JavaScript Kit"
result=document.cookie.substring(beginindex,endindex)
return result;
}

Javascript: function to check that number is numeric

function IsNumeric(strString)
{
// check for valid numeric strings
var strValidChars = "0123456789.-";
var strChar;
var blnResult = true;

if (strString.length == 0) return false;

// test strString consists of valid characters listed above
for (i = 0; i < strString.length && blnResult == true; i++)
{
strChar = strString.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
{
blnResult = false;
}
}
return blnResult;
}