Following are some HTML Tips that i found very useful and collected during my work experience.
1) To Hide Save toolbar from Images
use the following code in html HEAD tag
meta equiv='imagetoolbar' content='no'
OR
use the following in image attribute
img src='abc.gif' galleryimg='no'
2) Adding Scrollbars to DIV
div style="'overflow:auto;" height="SPECIFTY HEIGHT'
3) Exporting number fields (like phone number) from a dataGrid or any other grid to EXCEL
Note, this implementation will only work if you are iterating in all columns and rows of the respective data to be exported in Excel
use the following CSS style while exporting the respective column.
.text {mso-number-format:\@;}
4) Remove crash in code if user writes in any input box
use the following in Page directive (in aspx page) OR in Web.config file
pages validaterequest="'false'"
Will continue to post more regarding same.
Please provide comments if you find this post helpful.
Monday, March 10, 2008
Monday, March 3, 2008
Tips & Tricks
1) Debugging Javascript Code (in aspx file)
Step 1: Make sure that in Browser Advanced options Disable "Script Debugging" option should be unchecked.
Step 2: Write debugger; just before the line you want to debug to start at runtime.
Thats it guys [:)], now run the application and when you will fire the respective event the debugger will act at a breakpoint applied on that page.
2) Getting away from document.getElementById() method
Have you ever thought that you are writing 23 characters everytime, just to get a variable. Now if you have to get 10 variables in one method, you will have to call this method 10 times !! [:(].
Underlying is a suggestion to all of you (including me [:)])
1) Add a .js file in your project
2) Write a method
function $(elementID) { return document.getElementById(elementID);}
3) Use this $ whereever you have written document.getElementById.
e.g. in aspx page javascript function
var ctl = $('inputId');
Note: make sure that the .js file is referenced on that page where you are using this method (this is th only limitation)
Hear you go..... you have optimized your javascript code and replaced 23 letter function with only one character function.
3) To Register a script from Codebehind
Use the following code sample, in Page_Load event:
Step 1: Make sure that in Browser Advanced options Disable "Script Debugging" option should be unchecked.
Step 2: Write debugger; just before the line you want to debug to start at runtime.
Thats it guys [:)], now run the application and when you will fire the respective event the debugger will act at a breakpoint applied on that page.
2) Getting away from document.getElementById() method
Have you ever thought that you are writing 23 characters everytime, just to get a variable. Now if you have to get 10 variables in one method, you will have to call this method 10 times !! [:(].
Underlying is a suggestion to all of you (including me [:)])
1) Add a .js file in your project
2) Write a method
function $(elementID) { return document.getElementById(elementID);}
3) Use this $ whereever you have written document.getElementById.
e.g. in aspx page javascript function
var ctl = $('inputId');
Note: make sure that the .js file is referenced on that page where you are using this method (this is th only limitation)
Hear you go..... you have optimized your javascript code and replaced 23 letter function with only one character function.
3) To Register a script from Codebehind
Use the following code sample, in Page_Load event:
Subscribe to:
Posts (Atom)