user776676
user776676

Reputation: 4385

LinqDataSource: How to assign values to where parameters in code?

I have the following WhereParameters for LinqDataSource1 in my .aspx file:

<WhereParameters>
    <asp:Parameter Name="key1" Type="String" />
    <asp:Parameter Name="key2" Type="String" />
    </WhereParameters>

How do I assign values to these parameters in my code behind? Thanks.

Upvotes: 0

Views: 3254

Answers (1)

Tim
Tim

Reputation: 28530

You can assign them in the code behind like this:

LinqDataSource1.WhereParameters["Key1"].DefaultValue = "1";
LinqDataSource1.WhereParameters["Key2"].DefaultValue = "2";

Hope this helps.

Upvotes: 2

Related Questions