Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET ObjectDataSource SelectParameters CookieParameter question

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>
like image 756
RichC Avatar asked May 19 '26 00:05

RichC


1 Answers

You can create custom control to solve this problem. Kevin Isom's blog has a blog entry.
Custom Parameter for a DataSource

like image 136
Ender Özcan Avatar answered May 21 '26 14:05

Ender Özcan