How to apply css to text box control

 How to apply css to text box control

Create Website:-
1) Open Visual Studio
2) File->New Website->Give Website name and path.
3) Choose C#

Paste below code in your aspx file.

[code]
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>

<!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">
    <title>How to apply css to text box control</title>
<style type="text/css">

.textbox1
{
    background-color : #99FFCC;
    border: 1px solid #008000;
    width: 230px;
     font-size: 12px;
color: red;
}



</style> 
    
</head>
<body>

    <form id="form1" runat="server">
    <asp:TextBox ID="TextBox1" CssClass="textbox1" runat="server"></asp:TextBox>
     
    </form>
</body>
</html>

[/code]

SQL Server Error code 2

when you login SQL server "Microsoft sql server error 2" will display in this case you need to Start SQL Server Service account.

I want to write java script validation for textbox contain only numeric values and if all the values are numeric then there is one button control will get enable or else disable.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!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">
<title>Untitled Page</title>
<script type="text/javascript">
function valNumeric(evt)
{
var charCode;
charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode >= 48 && charCode <= 57 || charCode== 8 || charCode == 118 || charCode == 120 || charCode == 99 )
{
return true;
}
else
{
return false;
}
}
function EnableButton()
{
document.getElementById("Button1").style.visibility ="visible";
}
function DisableButton()
{
document.getElementById("Button1").style.visibility ="hidden";
}
</script>
</head>
<body onload="return DisableButton()">
<form id="form1" runat="server ">
<div>

<asp:TextBox ID="TextBox1" onkeypress="if(valNumeric(event)==true){EnableButton()}else{ return false}" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>

How to get Row Number with the result of SQL select query?

How to get Row Number with the result of SQL select query?

Row Number concept not available in SQL Server 2000. It's introduced in SQL Server 2005.

The syntax of Row Number is

ROW_NUMBER () OVER ([] )

Example of Row Number is
[code]
SELECT ROW_NUMBER() OVER (ORDER BY FieldName ASC) AS ROWNO, * FROM Table_Name
[/code]

Ranking Functions in SQL Server 2005

Ranking functions are introduced in sql server 2005. Ranking functions are used to creating arrays, generating sequential numbers, finding ranks, and so on, which in pre-2005 versions require more lines of code, now can be implemented easier and faster.

Let's look at the syntax of ranking functions

ROW_NUMBER () OVER ([] )
RANK () OVER ([] )
DENSE_RANK () OVER ([] )
NTILE (integer_expression) OVER ([] )


Try the following code to get Row Number:-

SELECT ROW_NUMBER() OVER (ORDER BY FieldName ASC) AS ROWNO, * FROM Table_Name