I have a DataList which is bound to a SqlDataSource, Ive got a LINQ query which the users can use to narrow down the data, I'm making the DataSource = the LINQ on the click event of a button.
I get an error as the list has a DataSourceID and now I'm giving it a DataSource.
Think this would work if i removed the datasourceid first with code before binding to 开发者_高级运维the new LINQ? If so, any hints on how to do this?
Thanks.
BaseDataBoundControl
, BaseDataList
, etc has 2 options how data can be bound to:
DataSource
(like LINQ result)DataSourceId
(like SqlDataSource)
Use one of them, or null first before assigning second.
精彩评论