0
Reply

Gridview bind without using database

Pramod Kumar Nandagiri

Pramod Kumar Nandagiri

May 3 2009 10:02 AM
4.3k

Hi

My code is

//in global.asax

void Session_Start(object sender, EventArgs e)

{

// Code that runs when a new session is started

ArrayList al = new ArrayList();

Session["List"] = al;

}

 

protected void Button1_Click(object sender, EventArgs e)

{

ArrayList al = (ArrayList)Session["List"];

al.Add(TextBox1.Text);

al.Add("Kumar");

GridView1.DataSource = al;

GridView1.DataBind();

TextBox1.Text = "";

}

 

it is working fine but it binds only first row  first column every time i want to use two text boxes such that

the first textbox value shoud appear in gridview firsr row firset cell

and second textbox value should appear in gridview first row second column

plase help me on this