Basically i'm reflecting a class which is an objectdatasource and I need to be able to create the parameters on the fly. But I have no idea of how to actually add those to the Propertyinfo of Parameters. The aspx method will not work because this is all done on the fly.
This is what I have but it errors when you try to add the Collection Object
var dataSourceType = typeof(DataSource).Assembly.GetType("DataSource", true);
var datafield = Activator.CreateInstance(dataSourceType);
PropertyInfo pinfo = datafield.GetType().GetProperty("Parameters");
ParameterCollection parmCollection = new ParameterCollection();
QueryStringParameter myParm = new QueryStringParameter("ber", DbType.String, "ber");
parmCollection.Add(myParm);
pinfo.SetValue(pinfo, parmCollection, null);
So yeah I basically want to create the datasource and then attached my parameter collection and then when a grid or other control loads it can do the databind on the source.