Sunday, January 16, 2011
Javascript pop up window focus
Give as below:
newwindow = window.open(url, "myWin", "width=600,height=400,toolbar=0,scrollbars=0");
newwindow.focus();
Thursday, December 23, 2010
Cookie transition between classic ASP and ASP.NET
I have a classic asp application that has a login module. There is another sub folder that has dotnet pages (.aspx). Any user who logs in to the asp application should be automatically able to view the .net pages too. But the aspx page was not able to access the cookie created in asp page. After a reasearch for some time i found out the reason why it was hapening like that.
Here is the reason:
My cookie name in the application is "cki_user". Point to be observed is the underscore symbol in the name. In classic ASP, the cookie name will be url encoded and created. That means, the actual cookie name will be "cki%5Fuser". But in asp.net, there will no url encoding hence the name remains "cki_user" when requesting. Hence i was not able to access the value. Finally i had to access it using Request.Cookies["cki%5Fuser"] which worked well.
Friday, December 3, 2010
9 Tips to write an Article
2. Most of the time, try to write an article in bullets or points...something like "10 ways to keep yourself fit".
3. Begin the article with an introduction on the topic or problem. If possible add your experiences.
4. Do not think too much on grammar while writing. Keep the grammar check job at the end.
5. Try to keep the article short.
6. Write the article in an informal way as if you are talking to your friend. That will make the reader feel easier to read.
7. Do a proofread after you are finished. Check for grammatical mistakes or any spelling mistakes.
8. Dont look at the article for one day. After a day, do a proofread again and check if you have put in everything that you wanted to.. in the article.
9. Now publish your article! DONE!!
Thursday, December 2, 2010
ASP.NET Pages not working on windows 64 bit server
Solution: Change the default app pool Identity to NETWORK SERVICE and allow all permission for NETWORK SERVICE on the website.
Note: Any new website that is created need to be given Full Control to NETWORK SERVICE in IIS.
Tuesday, November 3, 2009
Monday, July 13, 2009
Tips for Cross Browser Compatibility
1. All HTML controls in the page should have an ID attribute.
Example: <.... type="”text”" name="”txtname”" id="”txtname”">
2. Always use fixed width and height rather than percentages.
Example:
Fixed width: <.... width="”600”">......< /table>
Percentages: <.... width="”70%”">......< /table>
3. All the elements in the page should be bound in a proper html layout.
Example:
Correct: <..><..><..><..>< id="”test”">< /span>< /td>< /tr>< /table>< /body>
Wrong: <..><..><..><..>< /td>< /tr>< /table>< id="”test”">< /span>< /body>
4. Modal windows does not work properly in firefox. Use normal pop up windows instead.
Example:
window.open(....) works well in all conditions. ShowModaldialog does not work properly.
5. parent.dialogArguments does not work in firefox. Use parent.opener instead.
Example:
var strVals = parent.opener ? parent.opener : parent.dialogArguments;
strVals.callfunction()
6. While accessing html elements in javascript,
do not use document.forms[0].......Use document.getElementById(...)
do not use document.all(....). Always use document.getElementById(...)
7. window.event does not work in firefox. Instead we should pass the event to the calling javascript function and access using event.target.
Example:
< type="image" src="images/SFReset.gif" id="img2" name="img2" onclick="”ResetFields(event)”">
function ResetFields(e)
{
if (window.event)
var xButton = window.event.srcElement;
else
var xButton = e.target.name;
}
8. Automatic reload of the page does not work in some situations. Use Ajax in such cases.
9. SQL Reporting services reports frame width is height is shrinked in firefox.
To increase the frame height and width,
Go to Program Files → Microsoft SQL Server → MSSQL3 (Differs for different versions of sql server. Purpose is to locate Reporting Services folder) → Reporting Services → Report Server → Pages
Open ReportViewer.aspx
Add width and height attributes to the custom report viewer control.
Example: RS:ReportViewerHost width="1000px" height="860px" id="ReportViewerControl" runat="server">
10. semicolon in “nbsp;” is a must.
11. In javascript, use "getFullYear" whereever you use "getYear".
Tuesday, December 2, 2008
onkeypress not fired for Backspace and Delete
Here is a new thing that i have come across and wanted to share.
Scenario:
I was just experimenting to show the character count dynamically when a user types text in textarea. I have called a javascript function in onkeypress event of the textarea to calculate the count and put that in a html div element using innerHTML.
Observation:
onkeypress event does not fire for Back space and Delete keys in the keyboard.
Solution:
Use both onkeypress and onkeyup events and call the same function.