I have to problem in text box and Gridview [Resolved]

Posted by Nuwan under ASP.NET on 4/18/2012 | Points: 10 | Views : 687 | Status : [Member] | Replies : 3
Dear All,

I want to display textbox Value in GridView without using DataBase,
How I do it.......... Please Help me.


Thank You.............

Rathnayake


Responses

Posted by: Sanmukhait.Btech on: 4/18/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
You can use Data table for this like below:
protected void Button1_Click(object sender, EventArgs e)
{
DataTable dt=new DataTable();
DataRow dr;
dt.Columns.Add("Empno");
dt.Columns.Add("Empname");
dt.Columns.Add("Salary");
dr = dt.NewRow();
dr["Empno"] = TextBox1.Text ;
dr["Empname"] = TextBox2.Text;
dr["Salary"] = TextBox3.Text;
dt.Rows.Add(dr);
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();
}
}

sanmukh

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nuwan on: 4/18/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks for the answer...

Rathnayake

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/18/2012 [Member] Silver | Points: 25

Up
0
Down
@sanmukh


its informative..

Regards,
Singaravel M

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response