//------------------------------------------------------------------------------------------- private void AddControl(Random rnd) { int x = rnd.Next(10000); //EntityDataSource eds = new EntityDataSource(); //eds.ID = "DetailsDataSource" + x.ToString(); //eds.EnableUpdate = true; //eds.EntityTypeFilter = table.EntityType.Name; ////eds.EntitySetName = "Accounting_Accounts"; ////eds.ContextTypeName = "WeavverEntityContext"; ////eds.Where = "it.id = @id"; ////eds.WhereParameters.Add("id", DbType.Guid, "3d322c57-2b4a-4b27-8187-2094931eb2ca"); //AddedControls.Controls.Add(eds); //DynamicDataManager ddm = new DynamicDataManager(); //ddm.ID = "DynamicDataManager3"; //ddm.AutoLoadForeignKeys = true; //DataControlReference ddr = new DataControlReference(); //ddr.ControlID = "FormView3"; //ddm.DataControls.Add(ddr); //AddedControls.Controls.Add(ddm); FormView fv = new FormView(); fv.ID = "FormView" + x.ToString(); fv.DataSourceID = "GridDataSource"; YourTemplate yt = new YourTemplate(); fv.ItemTemplate = yt; //fv.ItemTemplate.Controls.Add(de); AddedControls.Controls.Add(fv); DynamicDataManager1.RegisterControl(fv); EntityControls.Update(); }