Source Code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GriedViewupdatedelete.aspx.cs" Inherits="GriedViewupdatedelete" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script language ="javascript" >
function isNumberKey(evt)
{
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</form>
</body>
</html>
C# Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class GriedViewupdatedelete : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox2.Attributes.Add("onkeypress", "return isNumberKey(event)");
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GriedViewupdatedelete.aspx.cs" Inherits="GriedViewupdatedelete" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script language ="javascript" >
function isNumberKey(evt)
{
<---This Code Is Written For TextBox Nothing Taken--->
var charCode = (evt.which) ? evt.which : event.keyCodeif (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<---This Is Used For Upper Case Or Capital Letter--->
<asp:TextBox ID="TextBox1" runat="server" onkeyup="this.value=this.value.toUpperCase()"></asp:TextBox><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</form>
</body>
</html>
C# Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class GriedViewupdatedelete : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox2.Attributes.Add("onkeypress", "return isNumberKey(event)");
}
}
No comments:
Post a Comment