1. Set the Body tag in your page/master page:
<body runat="server" id="MyBody">
2. Write the script tag in your page:
3. In the code behind attach the onload attribute to the body tag:
protected void Page_Load(object […]
This ASP.NET tutorial explains how to replace \n line breaks with HTML line breaks in GridView.
This is very common scenario when you would like to show well formatted GridView content. To do this you could use the ItemTemplate which is used by default to render the cell for each row:
<%# ((string)Eval(“GridviewContent”)).Replace(“\n”, “<br />”) %>
Related TutorialsHow […]
This ASP.NET tutorial explains how to compare strings in ASP.NET.
Comparing 2 strings is often used action in ASP.NET. You could want to compare two strings when you check if the username and pasword entrered by user are correct. Also it could be very useful if you search some text.The ASP.NET provides several methods to compare the […]
This ASP.NET tutorial explains how to create a custom control in ASP.NET.
If none of the existing ASP.NET server controls meet your requirements, then you can create a custom control by deriving from one of the base control classes.
Adding Custom Control to the Toolbox
1. Create a test Web Forms page. (WebForm1)
2. Using Tools menu, click Add/Remove Toolbox […]
This ASP.NET tutorial explains how to connect to MySQL database using ASP.NET hosting.
Many developers use ASP.NET with MySQL with their applicaions. If you use ASP.NET hosting services and some of ASP.NET languages as VB.NET or C# then you could connect to the MySQL databse using ODBC .net data provider.
Connect to MysQL database using C# on ASP.NET […]
This ASP.NET tutorial explains how to disable a button after click in ASP.NET.
This is a very common scenario when you would like to disable button after click, so the user could not click it again if you need some time to do some task which takes longer time to be executed.
Disable a button after click in […]
This ASP.NET tutorial explains how to make the TextBox readonly or disabled in ASP.NET.
You can make the TextBox control readonly by setting its ReadOnly property to true. You can set this property in the .aspx page which contains the TextBox control, or programmatically from the code-behind. The next test .aspx page shows this:
This ASP.NET tutorial explains how to render a password type textbox in ASP.NET.
You can render the TextBox control to as password type by setting its TextMode property to Password. The next test .aspx page shows this:
<%@ Page Language=”vb” AutoEventWireup=”false” CodeBehind=”TextBoxAsPassword.aspx.vb”
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<title>Password type […]
This ASP.NET tutorial explains how to indent text with CSS.
Sometimes you need to indent text in your web page. In this case you can apply a rule to the container that sets a padding-left value. You can use the next two files to test this:
<!DOCTYPE html PUBLIC “-//W3C//DTD […]
This ASP.NET tutorial explains how to specify horizontal rule style with CSS.
When your web site includes horizontal rules you can use CSS code to change their color, height and width. In this case for example the CSS code is the following: