Monday, May 21, 2007

Restrict User From Ctrl Key Press

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Restrict Ctrl Key Press</title>
<script>
function Restrict()
{
if((window.event.keyCode ==17))
{
alert("Ctrl Key Press In !"+'\r\n'+ "Add Your Own Code Here"); // Add Your Code Here

}
}
</script>
</head>
<body onload="JavaScript:document.body.focus();" onkeydown="Restrict()">
</body>
</html>


(IE Supported)

Saturday, May 19, 2007

JavaScript Get Key Values Or Code On KeyDown

Script
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Find KeyCode</title>
<script language="JavaScript">
function TriggeredKey(e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
alert("keycode: " + keycode);
}
</script>
</head>
<body onkeydown="TriggeredKey(this)">
</body>
</html>




(IE Supported)


Special Keyboard Key(s) Code

KeyCode
Backspace      8
Tab           9
Enter        13
Shift        16
Ctrl         17
Alt          18
Pause/Break   19
Caps Lock     20
Esc          27
Page Up      33
Page Down     34
End          35
Home         36
Left Arrow    37
Print Screen 44
Delete       46
F1           112
F2           113
F3           114
F4           115
F5           116
F6           117
F7           118
F8           119
F9           120
F10          121
F11          122
F12          123

Google Page Creator

Want to create an online photo tour of your vacation or to share the memorable moments with Your Fiends,Peers and others.....

If you Have Gmail Acount It's Enough Get,Set,Go.................

             Google testing a new product that makes creating your own web pages as easy as creating a document in  a word processor. Google Page Creator is a free tool that lets you create web pages right in your browser and publish them to the web with one click. There's no software to download and no web designer to hire. The pages you create are hosted on Google servers and are available at http://yoursitename.googlepages.com for the world to see.

Courtesy
Courtesy Google

Tuesday, May 15, 2007

Hold Back Or Retain Scroll Bar Postion After PostBack Or Roundtrip

Page Directive

<%Page smartNavigation="True" %>

Global setting

<configuration>
        <system.web>
                 <pages smartNavigation="true"/>
       </system.web>
</configuration>


SmartNavigation Property available only in .NET 1.1,In ASP.NET version 2.0, the SmartNavigation property is deprecated.Use the SetFocus method and the MaintainScrollPositionOnPostback property instead.

Note Regarding SmartNavigation

  1. Eliminating the Flicker caused by navigation Or Postback.
  2. Persisting the scroll position when moving from page to page.
  3. Persisting element focus between navigations.

Delete File If Exists Else Create

This Porgarm will delete a file with name Test.txt if exists in the Root Dir, else create a new file with name Test.txt with in the Root dir.FileInfo and File both the classes are available in System.IO namespace.

FileInfo Class
Provides instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects. This class cannot be inherited.

File Class
Provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.



Program

protected void btCreate_Click(object sender, EventArgs e)
{
try
{
FileInfo TheFile = new FileInfo(MapPath(".") + "\\" + "Test.txt");
if (TheFile.Exists)
{
File.Delete(MapPath(".") + "\\" + "Test.txt");
}
else
{
File.Create(Server.MapPath(".") + "\\" + "Test.txt");
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}