How to programmatically set the TextBox value and get the TextBox value in ASP.NET in C#

This ASP.NET tutorial explains how to programmatically set the TextBox value and get the TextBox value in ASP.NET in C#.

The next example uses a test.aspx page named SetAndGetTextBox.aspx which has two asp:Label controls and one asp:TextBox control. In the code behind the local string variable value is use to read in it the system [...]

How to apply CSS style in the Label control from code-behind in ASP.NET in C#

This ASP.NET tutorial explains how to apply CSS style in the Label control from code-behind in ASP.NET in C#.

You can apply CSS style from code behind by accessing the properties of the control with the help of its Id. Most of the CSS styles can be applied using the Font property and its [...]

How to change the text of the Label control from the code-behind in C#

This ASP.NET tutorial explains how to change the text of the Label control from the code-behind in C#.

 

TestPage (.aspx)

<%@ Page Language=”C#” AutoEventWireup=”false” CodeBehind=”TestPage.aspx.cs” Inherits=”TestChange.TestPage” %>

<!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>Change the text of the Label control from the code-behind</title>

</head>

<body>

<form id=”form1″ runat=”server”>

<div>

<asp:Label ID=”LabelTest” runat=”server” Text=”My test label”></asp:Label>

How to transfer information between pages in ASP.NET using a query string in C#

This APS.NET tutorial explains how to transfer information between pages in ASP.NET using a query string in C#.

Software developer can use this approach for information that don’t need to be hidden or made tamper-prof. Unlike view state information passed through the query string is clearly visible and unencrypted. The query string is the portion of the [...]

How to transfer information between pages in ASP.NET using cross-page posting in C#

This APS.NET tutorial explains how to transfer information between pages in ASP.NET using cross-page posting in C#.

Software developer can transfer information between pages with technique named cross-page posting. If he wants to do use it he has to define specific, limited methods that extract just the information he need it.   Let’s for example he have a [...]

How to store custom objects in a View state using C#

This ASP.NET tutorial explains how to store custom objects in a view state using C#.

Software developer can store custom objects in a view state just as easily as regular types. However, to store an item in a view state, ASP.NET must be able to convert it into a stream of bytes. This process is called serialization. [...]

How to set focus on control in C#

This ASP.NET tutorial explains how to set focus on control in C#.

You can put the focus on the following types of ASP.NET controls: Button, LinkButton, and ImageButton controls, CheckBox control, DropDownList control, FileUpload control, HyperLink control, ListBox control, RadioButton control, TextBox control.

The following C# code example shows how to set the focus on the control with the [...]

How to preserve member variables for an ASP.NET page in C#

This ASP.NET tutorial explains how to preserve member variables for an ASP.NET page in C#

Software developers can follow the next basic principle. They can save all member variables to View state when the Page.PreRender event occurs and retrieve them when the Page.Load event occurs. The Page.Load event happens every time the page is created. In [...]

How to use ViewState in C#

This ASP.NET tutorial explains how to use ViewState in C#.

You as software developer can use code to add information directly to the view state collection of the containing page and recover it later after the page is posted back. The type of information you can store includes not only the simple data types, but your custom [...]

How to convert string to int in C#

This ASP.NET tutorial explains how to convert string to int in C#.

1. You could call the ToInt32 method to convert an input string to an int:

int numberVar = Convert.ToInt32(“37″);

2.You could also convert a string to an int through the Parse method of the System.Int32 struct:

int numberVar [...]