How to replace \n line breaks with HTML <br /> line breaks in GridView

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 [...]

How to compare strings in ASP.NET

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 [...]

How to Create a Custom Control in ASP.NET

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 [...]

How to connect to MySQL database using ASP.NET hosting

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 [...]

How to disable a button after click in 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 [...]

How to make the TextBox readonly or disabled in ASP.NET

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:

ReadOnlyTextBox.aspx

<%@ [...]

How to render a password type textbox in ASP.NET

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:

TextBoxAsPassword.aspx

<%@ Page Language=”vb” AutoEventWireup=”false” CodeBehind=”TextBoxAsPassword.aspx.vb”

Inherits=”TextBoxSamplesVB.TextBoxAsPassword” %>

<!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>Password type [...]

How to indent text with CSS

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:

 

File test.css

.indent {

padding-left: 40px;

}

 

File test.html

<!DOCTYPE html PUBLIC “-//W3C//DTD [...]

How to specify horizontal rule style with CSS

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:

File test.css

hr {

border: none;

background-color: #E6E6E6;

color: #000000;

height: [...]

How to change bullets on list items with CSS

This ASP.NET tutorial explains how to change bullets on list items with CSS.

You can use the CSS list-style-type property when you need to specify the style of bullets used in your lists. In the next test file one of the possible options is used.

File test.css

ul {

list-style-type: circle;

}

Note: You can use also one of the [...]