Since the cookie support on DataSource controls for cookies is completely crap, my understanding is it is supposed to pull off the whole cookie(which is no use), if you need to pull of subkey values then doesnt work and it simply passes null.
To add this correctly, put the code in the page_load, this should hit the datasource before it has been rendered to the page.
This is the fastest in the way of 1 line.
Example:
NewsDataSource.WhereParameters.Add(new Parameter("RandomKey", DbType.String, Request.Cookies["CookieName"]["Key"]));
Note: When debugging things along these lines to see what value is passed to the database use sql profiler.
No comments:
Post a Comment