Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI
How to insert data in gridview on runtime ?


thank's:rose:
Posted
Comments
demouser743 2-Nov-10 4:03am    
Can you explain more about your problem

To insert a new row of data @ runtime then follow Mohd's post.




Populating the GridView with new data - use DataSource then DataBind.

To update or refresh your current datasource then just DataBind again.

GridView1.DataSource = "DataObject"
GridView1.DataBind()





If you wanting to add a new GridView at runtime then the best way would be to have a PlaceHolder control available.

var gridView = new GridView();
gridView.DataSource = "DataObject";
gridView.DataBind();

Placeholder1.Controls.Add(gridView);
 
Share this answer
 
Comments
raheleh_es 2-Nov-10 4:57am    
I didn't read data from database .

I was read data from button
raheleh_es 2-Nov-10 5:05am    
and I was add cell to row grid view

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