Tag Archives: ASP.NET 4.0

How to change type of chart of a Chart control in ASP.NET 4.0 programmatically

Introduction In this article I will explain how to change CharType of a Chart control in ASP.NET 4.0 dynamically at runtime Description Type of a Chart control can be changed by changing the ChartType property of the Series component inside the Series collection. ChartType property is set to SeriesChartType enum. Example: [sourcecode language=”csharp”] chartProducts.Series[“ProductSeries”].ChartType =… Read More »

How to create charts in ASP.NET 4.0 using built-in Chart control

Introduction In this article I will explain how to create charts in ASP.NET 4.0 using the Chart control introduced in ASP.NET 4.0 Description ASP.NET 4.0 introduced a new data control “Chart” with Visual Studio 2010. Chart control can be used to create around 35 types of interactive charts. Data in the chart control can be… Read More »

RegularExpressionValidator in ASP.NET

RegularExpressionValidator validation control in ASP.NET validates a control according to the regular expression (RegEx) set to its ValidationExpression property. Using this validation control we can specify a format of data that a control should accept using a RegEx. For example, we can validate a Phone number, Email, Zip Code etc using a RegularExpressionValidator control. Properties… Read More »

Validating list controls in ASP.NET using RequiredFieldValidator

RequiredFieldValidator control can be used to validate ASP.NET list controls like DropDownList, ListBox and RadioButtonList so that they cannot be left blank. Users must select a value from these list controls when validation has been applied. To validate a list control, we need to set InitialValue property of the RequiredFieldValidator along with other properties. Let… Read More »

How to avoid space occupied by an inactive validation control in ASP.NET

A validation control occupies space even if it is not showing any error. This is because by default Display property of the validation control is set to Static. For example, if we take two validation controls, one RequiredFieldValidator and one RangeValidator and if any of the validation fails, both the validation controls will consume their… Read More »

RangeValidator control in ASP.NET

RangeValidator validation control in ASP.NET is used to validate whether the value of a control is in a given range. It can validate Currency, Date, Double, Integer and String value. Properties of RangeValidator control Property Uses ControlToValidate It takes ID of the control you want to validate Type It specifies the type of data you… Read More »

CompareValidator control in ASP.NET

CompareValidator validation control in ASP.NET is used to validate an input control’s value by comparing it with another control’s value or a constant value. For example, we can use CompareValidator to validate controls if we want user to enter same value in two different controls, to compare value of a control with another control, to… Read More »

Validation controls in ASP.NET

Data validation is very important while accepting input from user. There may be different business logic for validating data. Some basic validation would be to validate a field to accept only numbers or a valid email address or phone number of a country in a specific pattern etc. ASP.NET provides some built-in controls for this… Read More »

Using single event handler for multiple control’s event in Windows Forms and ASP.NET using C#, VB.NET

Introduction: In this post I will explain how to use single event handler for click event of multiple Button controls in Windows Forms and ASP.NET using C# and VB.NET Description: Event handling in Windows Forms Create a new Windows Forms application and four buttons on the form, “btnAdd”, “btnSubtract”, “btnMultiply” and “btnDivide”. Write following event… Read More »

Changing UICulture of master and content pages on button click in ASP.NET using C#, VB.NET

Download Source Code Introduction In this article I will explain how to change UICulture of master and content pages on button click in ASP.NET. This will enable users to select a language to view contents of a page/site. When user selects a language, UICulture of the page is set to that specific language and page… Read More »