Saturday, July 31, 2010

How to get Row Index at Row Command event of GridView

 If e.CommandName.Equals("Save") Then
            Dim gvr As GridViewRow = CType(CType(e.CommandSource, LinkButton).NamingContainer, GridViewRow)
            Dim RowIndex As Integer = gvr.RowIndex
End If

Thursday, July 1, 2010

Function to show pressed key in javascript

function show_key(e)
{ 
 
KeyID= Window.Event ? e.KeyCode : e.Which;
switch(KeyID)

   {

      case 16:

      document.Form1.KeyName.value = "Shift";

      break; 

      case 17:

      document.Form1.KeyName.value = "Ctrl";

      break;

      case 18:

      document.Form1.KeyName.value = "Alt";

      break;

      case 19:

      document.Form1.KeyName.value = "Pause";

      break;

      case 37:

      document.Form1.KeyName.value = "Arrow Left";

      break;

      case 38:

      document.Form1.KeyName.value = "Arrow Up";

      break;

      case 39:

      document.Form1.KeyName.value = "Arrow Right";

      break;

      case 40:

      document.Form1.KeyName.value = "Arrow Down";

      break;
   }

}