While Loop execute the code body until it meets the specified condition.
Like if statement the while statement evaluates the expression, which must return a boolean value. If the expression evaluates to true, the while statement executes the statement(s) in the while block. The while statement continues testing the expression and executing its block until the expression evaluates to false.
The following ASP.NET program counting a number from 1 to 10 using while loop.
Click the following links to see full source code