I have one Telerik grid and one button on my page. Clicking on button I want to add one row in grid and row will have combobox, textbox etc controls. Users can click multiple times on button and on every click I want to add extra row with controls in grid. And I also want to capture events of these dynamic loaded controls.
Please provide me the code to add new row in grid with other requirements.
3 Answers, 1 is accepted
You can create a new DataTable and add columns to it in the PageLoad event. Then in the NeedDataSource event of the grid add rows to the DataTable and save it in a session variable which should be bound to the grid. Then on button click you can add more rows to the DataTable and rebind the grid to the new DataTable. The following code should help you understand better :
I am able to add row in Datatable and that row I can see in the grid also. But It does not retain the values entered in the grid.
I would like to add row and from front-end whatever the value user gonna entered that has to remain. after adding second row..
Any time I add new row it lost the previous changes on the grid. Grid changes has to remains.
Is there any wat I can get back the Grid value back and store in datatable.
OR do u have client side add row feture
do u have bydefulat inline edit grid row.
Please replay me asap.
You can try out the following code to set the Grid in InsertMode by default:
You can also refer to the following online demo which demonstrates on how to add insert fields on clicking a button. You can use insertForms and alter the logic in the demo to meet your requirements.
MultiInsert in RadGrid using RadToolTip