Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi , i have a asp web page and want to insert the data that is entered into a textbox to be inserted into a datagrid on the same page when a button is clicked.:confused:

Thanks in advance.
Posted

protected void Button1_Click(object sender, EventArgs e)
{
// code to insert the textbox value.
   DataGrid1.DataBind();
}


This may help you
check here[^]
 
Share this answer
 
v2
Server side:
1. On button click event, get the data of textbox.
2. Save in DB
3. Get data for Grid (this should now contain the entered data)
4. Use the new data as datasource
Downside: A round trip, but data persisted and saved.

Client Side:
1. On button onclientclick event, get the data of textbox in Javascript method.
2. Get the grid & grid row in JS method
3. Access the cell that you want to edit. Replace the value from textbox one.
Downside: Data not sent to server and thus not saved. Though it's fast.
 
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