Skip to main content

Posts

Showing posts from 2007

How to Prevent Users to Press F5 key (Refresh button)

Some times we want to prevent user to Press F5 key to prevent Page Refresh. You can use the below script. Paste this code in the Head Section of your Page. <script language=javascript> document.onkeydown = function(){ if(window.event && window.event .keyCode == 116){ window.event.keyCode = 505; // Capture and remap F5 } if(window.event && window.event .keyCode == 505){ // New action for F5 return false; // Must return false }} </script>

How to Prevent Right Mouse Click in IE

Some times we want to prevent user to click Right Mouse Button. This Script works fine.(As i tested in IE.) Paste this code in the Head Section of your Page. < script language =javascript> var isNS = (navigator.appName == "Netscape" ) ? 1 : 0; if (navigator.appName == "Netscape" ) document.captureEvents(Event.MOUSEDOWNEvent.MOUSEUP); function mischandler() { return false ; } function mousehandler(e){ var myevent = (isNS) ? e : event ; var eventbutton = (isNS) ? myevent.which : myevent.button; if ((eventbutton==2)(eventbutton==3)) return false ; } document.oncontextmenu = mischandler; document.onmousedown = mousehandler(); document.onmouseup = mousehandler(); </ script > Regards, Anuj Kumar Rathi

What Javascript can't do

Javascript cannot read from or write to files on the server . Because Javascript is running in the web browser after the web page has been copied from the server, it therefore cannot interact with the server (the computer that the web page was copied from) in any way. Javascript cannot interact with server side scripts . Any server side scripts are run before the web page is downloaded to the browser. This means that a server side scripting language such as PHP or ASP can update the content of your Javascript code before it is downloaded. Since the Javascript itself isn't run until after the page has been downloaded the Javascript is not able to affect the server side script because that has already finished running. The only way that Javascript can pass information back to a server side script would be to reload the page passing the required information from Javascript as a query string on the end of the page address. avascript cannot read from or write to files in the client . Ev...

Improve your website's user interface using javascript

Hi friends, This is after a very long time. I was so busy now the days. Now i am sharing some client side javascript functions. Now the days most of the companies wants to give the as much as possible functionalite in the web applications like desktop applications. & one can achive this with the help of javascript. Another thing that comes into picture is AJAX. But now i will not talk about AJAX in this article. here i will describe some javascript techniques by which you can improve your web sites user interface & create it more user friendly. Lets start some basic tests: Blank String Test: String.prototype.IsBlank=function(){ var flag=true; for(var i=0;i<this.length;i++){var temp=this.substring(i,i+1); if(temp != " "){ flag=false; break; } } if(flag==true){return true;} else {return false;} }; Another Blank String Test: Enter Your Name: String.prototype.CheckBlank=function(fname){if(this.IsBlank()){alert(fname+genblnk);return true;}return false;}; String Revers...

Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'

Hi Friends, This is after a long time. Now I am sharing a Login problem in ASP.NET 2.0. Actually I was uploading our new website before two days. In My application I have a Login.aspx page for user login. First of All, I want to say to those who are not familier with the asp.net 2.0 that here we use PUBLISH web site option in place of RELEASE that was in older versions.   So, after i published my site sucessfully, & try to run the site, it rurns fine. But as soon as i hav clicked on the Login page link, I surprised because there is an error... Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login' When I tried a name like MemberLogin.aspx,    my application ran sucessfully after publishing online.   So, After all the result of the above problem is, that you will have to create your login page with any name other then Login.aspx. Because if u use login.aspx, .net compiler assumes that it use the Login control...

Microsoft releases ASP.NET AJAX 1.0

Yesterday Microsoft released "Atlas" or what has become ASP.NET Ajax 1.0. Scott Guthrie has the big news and Mary Jo Foley here on ZDNet has some good information as always. You can go grab the framework on the ASP.NET AJAS website . So we're finally seeing a release version of Microsoft's commitment to the standards-based web and by most accounts, they've done a good job. Scott has an example of the ASP.NET AJAX Control Toolkit running inside of Opera so I think they want to make clear that Microsoft is targeting developers rather than trying to lock in consumers. This has implications for how WPF/E fits into the strategy, so I think this release is a good sign for all of us hoping to see Microsoft go more cross-platform. The other thing to mention is that Scott talked briefly about "Orcas" the next iteration of Visual Studio: All of the ASP.NET AJAX 1.0 features will be integrated directly into the next release of ASP.NET (codename...

NEWS - Web Application Projects is now available!

Hello everybody,   I am again back after a long time. Now developers have two choices when converting their Visual Studio .NET 2003 Web projects to 2005! Web Application Projects provide an alternate web project model for Visual Studio 2005. Similar to the Visual Studio .NET 2003 web project model, this new model is ideal for web site developers who are converting a Visual Studio .Net 2003 web project to Visual Studio 2005. If you prefer, you can still convert to the built-in Web Site Project model in Visual Studio 2005. You should download the latest Migration Wizard for the best conversion results. -- Thanks & Regards Anuj Rathi .NET Developer