add textbox and command button on the datagrid

G

Grey

my idea is want to add textbox on the datagrid. the data of the textbox was extract from DB. use can change the value on the textbox anytime. after the change, user just click the button on the datagrid to save to DB. Is it possible to do that??? and how to ??


Million Thanks..
 
A

Ashish M Bhonkiya

Hi Grey,

you can do this by creating template comulns in the datagrid. Add textboxes to the template column and set the text property of this textbox to DataBinder.Eval("myDatasource" , FieldName) , thus you will be able to populate the values from the datasource to the textbox, when you call this code in the page load method of the page.

Datagrid1.datasource = myDatasource;
Datagrid1.DataBind();
now to update the values you need to write the code in the DataGrid1's ItemCommand. write the appropriate logic to retrieve all the items in the datagrid and call the logic to update the values to your datasource.

HTH
Cheers
Ashish M Bhonkiya



my idea is want to add textbox on the datagrid. the data of the textbox was extract from DB. use can change the value on the textbox anytime. after the change, user just click the button on the datagrid to save to DB. Is it possible to do that??? and how to ??

Million Thanks..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top