I have a usercontrol that contains a datalist, and I want to set the datasource of the datalist to different things depending on what page the usercontrol is on.
So, I think what I need to do is expose a public property of the datalist that will get the datasource and set it, like so:
public datasource UserDataSource
{
get { return DataList1.DataSource; }
set { DataList1.DataSource = value; }
}
but the above obviously doesn't work. I'd then call it like this:
MyUserControl.UserDataSource = datasourcename;
and then somehow databind the datalist inside the usercontrol.
Obviously I'm kind of out of my element here, but hopefully I can get this working. Thanks for any help.