Programmatically adding Control in GridView Cell (Controls.Add)
Author: DevASP Team
Download Source Code : 708_GridViewControl.zip
In this article I will try to explain you how you can add control in gridview cell programmatically.
Often as developer we face scenario like need of new control while running the application or developer wants to display record set in gridview cell by retrieving data from database. In aspx drop a gridview control and label control. The page will be like as follows:
On page load bind the gridview control with arraylist. So that gridview will display on your web form.
The trick to adding the control to cell is on button click event the code for adding the control is as follows:
In above sample I have simply uses the Controls.Add property which adds the control in cell.