Hello guys i have to dynamically add multiple gridview in asp.net. There are no of gridview are genereated on the basis of selection.
If I have not understood wrong from title that add multiple grid view dynamically means want to add grid view from code behind at run time.
As GridView is a class in ASP.NET C# and we can create object of it and set its properties just like other class object like follows:
GridView objGV = new GridView();
objGV .AutoGenerateColumns = false;
and can add columns of different type like BoundField and TemplateField from code Like follows:
BoundField field = new BoundField();
field.HeaderText = "Column Header";
field.DataField = Value;
objGV .Columns.Add(field);
and finally can add this grid view object on .aspx under any container control like panel.
PanelId.Controls.Add(objGV );
For adding multiple grid instance just iterate above code in loop like:
for(int i=0;i
Hope I understood your requirement correctly and my explanation will be helpful for you.