Click here to Skip to main content
15,908,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to fill Grid view on click button the values in textboxs directly fill into grid.
VB
DataTable dt = new DataTable()
dt.Column.Add("Name");
dt.Column.Add("FName");
dt.Rows.Add("txtName.text" & index, "txtFName.text" & index);

gridmy.DataSource = dt
gridmy.DataBind()



its not working for me.
But How i can fill the Grid on click add button without use database?
Posted

Try this I hope It will help you

C++
DataTable dt = new DataTable();
dt.Columns.Add("Fname");
dt.Columns.Add("LastName");
dt.Rows.Add( txtName.Text, txtFName.Text);

gridmy.DataSource = dt;
gridmy.DataBind();



Keep smiling:):):) happy coding:)
 
Share this answer
 
v2
DataTable dt = new DataTable();
dt.Columns.Add("Name");
dt.Columns.Add("FName");
DataRow row = dt.NewRow();
row["Name"] = txtName.Text;
row["FName"] = txtFname.Text;
dt.Rows.Add(row);
gridmy.DataSource = dt;
gridmy.DataBind();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900