Various Styles for HTML List

HTML list is a very simple and light wight control, which can be used to easily display a list of data. A normal Unordered List can be displayed using the <ul> HTML tag.

A list of various styles for HTML list and it’s code is displayed below:

HTML List Styles

HTML List Styles

How to make a text blink in asp.net or html

Often we need to put emphasis on certain part of the page’s content, to distinguish it from the rest of the content on the page, in order to be able to grab the user’s attention. One of the easiest and most commonly used technique to emphasize a particular part of content is to make it blink.

We can make a particular object blink by setting the style’s attribute “text-decoration” for that object to “blink”. The code below demonstrates how to create a simple blinking text on an HTML page.

Database Operations and DataGridView Bind in .net desktop application

In this article we will learn how we can build a simple desktop application to perform various operations on the data of the database, like insert, update, delete,display etc.

To understand this, I am creating a simple application, where I will have a form to enter the countries into the database, and the records of that database will be displayed in a datagridview, and these records can also be edited and deleted.

Below is the database table “COUNTRY_TBL”

ID NAME STATUS
1 India 1
2 USA 1
3 England 1
4 Germany 1
5 France 1
6 Italy 1

The code for desktop applications are almost similar to the code for websites/web applications with a just a few differences, like desktop applications contain forms instead of pages, and hence events like Form_Load instead of Page_Load, there is no concept of Page postback in desktop applications, so you will not see Page.IsPostBack in the Form_Load even of a desktop application. The Gridview control in a desktop application is known as DataGridView.

Below is the screenshot of how our application will look like:

Database Operations using Desktop Application

Database Operations using Desktop Application

1. First we will drag a textbox control on our form and we will name it “txtname”, we will put a label before this textbox and set it’s text property to “Name”.
2. Then we will put a GroupBox control and set its Text property to “Status”.
3. We will drag 2 radiobuttons inside this groupbox. For one radio button, we will set the name property to “rbtntrue” and text property to “True” and for the other radiobutton, we will set the name property to “rbtnfalse” and text property to “False”. We will set the checked property for one of the radiobutton, let’s say rbtntrue to “True”.
4. Then we will drag two Button controls on the form and set their properties as shown below:
(1) Button1 => Text = “Add” and Name = “btnaddupdate”
(2) Button2 => Text = “Cancel” and Name = “btncancel”
5. Then we will drag a DataGridView control on the form and we will set it’s Name property to “grdcountry”.
6. Click on the small arrow on the top right of the DataGridView and click on Edit Columns, as shown below:

DB Operations Edit Columns

DB Operations Edit Columns


7. You will see another screen where you can add columns in the DataGridview, add 2 columns, one with HeaderText and Text as “Edit” and other with HeaderText and Text as “Delete”. And then click OK.
8. Now we will write code to do the following tasks:
(1) Bind DataGridview through GrdBind() function.
(2) Insert Update data on the click on “btnaddupdate” button.
(3) ClearForm() function to clear the form after performing the operations.
(4) grdcountry_CellContentClick event, that will handle Edit and Delete operations of the Gridview, based on whether and Edit column is clicked or Delete column is clicked.
(5) Cancel button Click event, that will call the ClearForm() function to clearn the controls values.

In this article, you have learned how you can create a desktop application to perform various operations on the data of the database like Insert, Update, Delete, Display etc.

How to create a vertical marquee moving down from top in HTML or Asp.Net

As we already discussed, a traditional marquee makes a text or an image or any other object move horizontally, from right to left.

In order to make an object move down vertically, from top to bottom, through marquee, we need to specify the “direction” attribute of the marquee. In this example, we have set the direction of the marquee to “down”. This will make the object move vertically from top to bottom.

The code to perform this is shown below:

How to create a horizontal marquee moving right from left in HTML or Asp.Net

In order to make an object move horizontally, from left to right, through marquee, we need to specify the “direction” attribute of the marquee to “right”. In this example, we have set the direction of the marquee to “right”. This will make the object move horizontally from left to right, contrary to a default marquee, which makes the element move from right to left.

The code below shows this in action:

How to create a vertical marquee moving up from bottom in HTML or Asp.Net

We all know, that a traditional marquee makes a text or an image or any other object move horizontally, from right to left.

In order to make an object move vertically, from bottom to up, through marquee, we need to specify the “direction” attribute of the marquee. In this example, we have set the direction of the marquee to “up”. This will make the object move vertically from bottom to up.

The code to perform this is shown below:

How to display repeater inside datalist in asp.net

In this article, we will learn how to display repeater inside datalist in asp.net. The logic is again same. First we will bind the outer datalist. Then in the ItemDataBound event of the Datalist, we will find the inner repeater and bind it based on the DataKey for the outer datalist.

We will again be using the same database tables, that we used in our previous articles, as shown below:
Country Table (COUNTRY_TBL)

ID NAME
1 India
2 USA
3 England

State Table (STATE_TBL)

ID NAME POPULATION COUNTRYID
1 Haryana 5000000 1
2 Punjab 8000000 1
3 Chandigarh 100000 1
4 California 2500000 2
5 Arizona 100000 2
6 Florida 90000 2
7 Oxfordshire 40000 3
8 Lancashire 55000 3
9 Northamptonshire 150000 3

The below image shows the result of binding a repeater inside datalist:

Repeater Inside Datalist

Repeater Inside Datalist

Now that we have discussed the logic and seen how the result should look, let’s get into the coding part of this and see how we can bind a repeater inside datalist through coding.

RepeaterInsideDatalist.aspx

RepeaterInsideDatalist.aspx.cs

RepeaterInsideDatalist.aspx.vb

How to display repeater inside gridview in asp.net

In this article, we will learn how to display repeater inside gridview in asp.net. The logic is again same. First we will bind the outer gridview. Then in the RowDataBound event of the Gridview, we will find the inner repeater and bind it based on the DataKey for the outer Gridview.

We will again be using the same database tables, that we used in our previous articles, as shown below:
Country Table (COUNTRY_TBL)

ID NAME
1 India
2 USA
3 England

State Table (STATE_TBL)

ID NAME POPULATION COUNTRYID
1 Haryana 5000000 1
2 Punjab 8000000 1
3 Chandigarh 100000 1
4 California 2500000 2
5 Arizona 100000 2
6 Florida 90000 2
7 Oxfordshire 40000 3
8 Lancashire 55000 3
9 Northamptonshire 150000 3

The below image shows the result of binding a repeater inside gridview:

Repeater Inside Gridview

Repeater Inside Gridview

Now that we have discussed the logic and seen how the result should look, let’s get into the coding part of this and see how we can bind a repeater inside gridview through coding.

RepeaterInsideGridview.aspx

RepeaterInsideGridview.aspx.cs

RepeaterInsideGridview.aspx.vb

How to display datalist inside datalist i.e nested datalist in asp.net

Now we will see how we can bind a datalist inside another datalist i.e nested datalist in asp.net. The logic is again same. First we will bind the outer datalist. Then in the ItemDataBound event of the datalist, we will find the inner datalist and bind it based on the DataKey for the outer datalist.

Let’s use the same database tables, that we used in our previous articles, as shown below:
Country Table (COUNTRY_TBL)

ID NAME
1 India
2 USA
3 England

State Table (STATE_TBL)

ID NAME POPULATION COUNTRYID
1 Haryana 5000000 1
2 Punjab 8000000 1
3 Chandigarh 100000 1
4 California 2500000 2
5 Arizona 100000 2
6 Florida 90000 2
7 Oxfordshire 40000 3
8 Lancashire 55000 3
9 Northamptonshire 150000 3

The below image shows the result of binding a datalist inside another datalist:

Datalist Inside Datalist

Datalist Inside Datalist

Now that we have discussed the logic and seen how the result should look, let’s get into the code and see how we can bind a datalist inside another datalist through coding.

DatalistInsideDatalist.aspx

DatalistInsideDatalist.aspx.cs

DatalistInsideDatalist.aspx.vb

How to display gridview inside datalist in asp.net

Now we will see how we can display a gridview inside a datalist. The logic is again same. First we will bind the outer datalist. Then in the ItemDataBound event of the datalist, we will find the gridview and bind it based on the DataKey for the outer datalist.

Let’s use the same database tables, that we used in our previous articles, as shown below:
Country Table (COUNTRY_TBL)

ID NAME
1 India
2 USA
3 England

State Table (STATE_TBL)

ID NAME POPULATION COUNTRYID
1 Haryana 5000000 1
2 Punjab 8000000 1
3 Chandigarh 100000 1
4 California 2500000 2
5 Arizona 100000 2
6 Florida 90000 2
7 Oxfordshire 40000 3
8 Lancashire 55000 3
9 Northamptonshire 150000 3

The below image shows the result of binding the Gridview inside Datalist:

Gridview Inside Datalist

Gridview Inside Datalist

Now that we have discussed the logic and seen how the result should look, let’s get into the code and see how it will be done in coding.

GridviewInsideDatalist.aspx

GridviewInsideDatalist.aspx.cs