Click here to Skip to main content
14,876,231 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
How to add events for dynamic grid view?
Posted

Below is the sample code snippet that will do your work. You have to make sure where are you adding the control and also need to add event handler to peroform operation like RowDataBound, Edit, delete etc based on your requirments.

GridView gridView = new GridView();
    gridView.ID = "gridViewDynamic";
    gridView.AutoGenerateColumn=false;
    gridView.DataSource = mydatasource;
    gridView.DataBind();
    Pages.Controls.Add(gridView);
   
Comments
Abhijit Jana 30-Jan-11 23:57pm
   
I guess I missunderstood the question. OP was looking for Adding Event. I will update it soon !

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