If my cookie is set like this: Response.Cookies("Employees")("UserID") = 43
How do I get this value from within an ObjectDataSource SelectParameters CookieParameter?
<asp:ObjectDataSource ID="odsProducts" runat="server" TypeName="MyCompany.Products" SelectMethod="GetAll">
<SelectParameters>
<asp:CookieParameter CookieName="????" Name="UserID" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
I'm assuming that I would need to do something like this?
<asp:ObjectDataSource ID="odsProducts" runat="server" TypeName="MyCompany.Products" SelectMethod="GetAll">
<SelectParameters>
<asp:CookieParameter CookieName="Employees.UserID" Name="UserID" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
You can create custom control to solve this problem. Kevin Isom's blog has a blog entry.
Custom Parameter for a DataSource
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With