Thread: Filtering data
View Single Post
  #5 (permalink)  
Old June 6th, 2013, 07:36 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Ah, I thought you were using an EntityDataSource control. In that case, the correct link is:

http://msdn.microsoft.com/en-us/libr...selecting.aspx

The "Parameter" type maps to None in the drop down list. When you set up a new parameter and choose None, you get this in the Markup:

<asp:Parameter Name="ColumnName" Type="Int32" />

where ColumnName is the name of the column you associated with the Where clause.

You can then do something like this in the Code Behind (C#):

Code:
protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
  e.Command.Parameters["@ColumnName"].Value = YourCalculatedValue;
}
Hope this helps.

Groeten,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote