SqlDataSource set SelectCommand dynamically
问题 I'm using a SqlDataSource and to avoid writing long queries directly in my code I thought I could make a Query class that returns the query I want as a string. I tried the code below but I just get "Server tags cannot contain <% ... %> constructs." Before I was using stored procedures but my webhosting doesn't allow that, so thats when I thought about the Query class solution. I also need to add that I don't want to do databinding in codebehind. Is there a way of doing this? <asp