Last post Oct 20, 2010 12:08 PM by BlogDog
Oct 18, 2010 11:28 PM|BlogDog|LINK
I've got a Linq datasource hitched up to a Formview control for clients to edit some data. I'm having trouble setting the where parameters withing the control so it show the right set of data.
Here's the markup:
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="DataClassesDataContext"
<asp:SessionParameter DbType="Guid" Name="userID" SessionField="userGUID" />
<asp:Parameter DefaultValue="1" Name="Product.productCategoryID" Type="Int32" />
<asp:Parameter DefaultValue="True" Name="Product.active" Type="Boolean" />
Upon running right now, it's completely ignoring the where parameters. What am I missing here?
Oct 19, 2010 06:02 PM|BlogDog|LINK
I ended up skinning the cat a different way - stuck with the code behind to create the Linq data entity and then bound it to the gridview.
Oct 20, 2010 12:40 AM|awerealis|LINK
I realise you have solved your problem using code-behind (magic and powerful stuff). Though for the benefit of people searching the web, the answer to your query appears to be simple enough.
The LinqDataSource tag is missing a "Where" attribute to tell it what to do with the arguments in the WhereParameters.
C# e.g. <asp:LinqDataSource Where="userid==@userID" ...
The Where attribute is written in HTML-Encoded Linq syntax.
Oct 20, 2010 12:08 PM|BlogDog|LINK