How to display the number in sequential order in asp.net?


Hi
we can display the no in sequential order of 10 like this.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Program_NumberDisplay : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
int n = Convert.ToInt32(TextBox1.Text);
int count = 0;
for ( int i = 1; i <=n; i++)
{
Label1.Text += i+" " ;
count = count + 1;
//This is used for counting the no and if 10 will come,then it will break it.
if (count == 10)
{
Label1.Text += "<br/>";
count = 0;
}

}

}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: