dynamically adding controls into a datagrid

is there a way to dynamically add a control, especially a custom third party control into an empty datagrid?  

i have tried the following:

    protected void DataBoundHandler(Object objSender, DataGridItemEventArgs e)
        LinkButton link = new LinkButton();
        link.Text = "dsadaa";
        link.Parent = this.MyDataGrid;

during ItemDataBound event, but didn't work

i also tried:


also didn't work, please help.  thanks.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


In this example they did quite extreem modifications on the grid.... http://msdn2.microsoft.com/en-us/library/bb498013.aspx 

The idea is to override the Render, reference the table the gridview over there (Table gridTable = (Table)grid1.Controls[0];), create new new GridViewRow, TableCell and afterwards add it to the gridTable...

It is definetely working and I have done that mysefl, but it is rather extreem... If your do not need to have different controls depending on sort(as in example), I would create those controls in the grid with visible false. And in the _RowDataBound get those controls with something like this:
Label lbl1 = (Label)e.Row.FindControl("myLabel1"); and set the visibility to true and if required change the style, content or anything else you want...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.