01.
protected
void
Button1_Click(
object
sender, EventArgs e)
02.
{
03.
ListBox1.Items.Add(TextBox1.Text);
04.
TextBox1.Text =
""
;
05.
}
06.
07.
protected
void
Button2_Click(
object
sender, EventArgs e)
08.
{
09.
DataTable dt =
new
DataTable();
10.
DataColumn dc =
new
DataColumn();
11.
12.
if
(dt.Columns.Count == 0)
13.
{
14.
dt.Columns.Add(
"PayScale"
,
typeof
(
string
));
15.
dt.Columns.Add(
"IncrementAmt"
,
typeof
(
string
));
16.
dt.Columns.Add(
"Period"
,
typeof
(
string
));
17.
}
18.
for
(
int
i = 0; i < ListBox1.Items.Count - 1; i++)
19.
{
20.
DataRow NewRow = dt.NewRow();
21.
NewRow[0] = ListBox1.Items[i].Value;
22.
NewRow[1] = ListBox1.Items[i].Value +
"TOR "
+ i;
23.
dt.Rows.Add(NewRow);
24.
}
25.
26.
27.
28.
GridView1.DataSource = dt;
29.
GridView1.DataBind();
30.
}