Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Asp

Dynamically Changing Web Themes In Asp.Net

Example Pages with Web Themes settings

When we start this example website, it first displays the home page. We can select a product and submit it to move to the Order Confirmation page. The order confirmation page has labels to provide order confirmation and the same page also has a link called ‘Home’ to navigate back to the homepage. From the homepage, we can navigate to the Web Admin Page where we can set the theme for the entire website. We can select a theme in the web admin page and apply that theme to the whole site (In our case it contains only three pages) by clicking the ‘apply’ button. From the web admin page, we can go to the main web page by using the home link.

All three pages use two themes named Ocean and Desert. By default, when we launch the site for the first time, we do not apply any theme. So we should go to the web admin page and from there we can apply a theme. The code behind in the web admin page uses the session variable for demo purpose. You should use application variables for real websites.

Continue Reading →

Hooking CustomValidator Control & Javascript

CustomValidator & Java-script Scripting

Validation controls are useful to perform the validation on the web forms. The asp.net framework provides validation controls like RequiredFieldValidator, RangeValidator and CompareValidator, etc. Sometimes, these validation controls are not fair to do the special validations. In those cases, we will go for the CustomValidator Control. In this example we will walk through the usage of the CustomValidator Control and learn how to link the java script function as the validation function.

Continue Reading →

FormView Control & SQLDataSource in ASP.Net

About The FormView Control Example

In this example, we will see how to make use of FormView Control of ‘Asp.Net to retrieve the data from the database. We will use SQLDataSource Control to supply the data for it. We will also look at modifying its Templates. This Control allows us to place the data-bound controls wherever we want. It is just like designing the form for calculating the Electricity Bill based on unit consumption. Now think of getting the table columns from the database and placing that freely on the web page wherever we want. This is achieved by the FormView Control.

Continue Reading →

Dynamically Changing ASP.Net Web Config File

The Dynamic ASP.Net Web Config Update Example

The Web.config file supplies the Website settings required for the ASP.Net web sites. These settings are like connection strings, how many users allowed, etc. Sometimes the situation arises where we need to add or remove the configuration settings without re-starting the server. This is to avoid website’s down-time. In this article, we will see a demo of how to change web config file when the site is running. Imagine that web admin of the site will access the page which we will create in this example. The goal is to add an extra web setting dynamically, and in the meantime, the server must function as usual with no re-start.

Continue Reading →