objectdatasource parameter value from application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone tell me is there an easy way to get a value into an
objectdatasource select parameter from Application Variables? Obviously its
easy from cookies, session etc... but what about Application? Or is there an
easy way to get a value into an objectdatasource parameter from the
web.config? Kind of like how we get the connection string from web.config
into a datasource object, like:

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$
ConnectionStrings:spg_portalsConnectionString %>"

Can I do:

<SelectParameters>
<asp:Parameter Name="dept_id" DefaultValue="<%$ AppSettings:dept %>
</SelectParameters>
 
I didn't try what you have mentioned, but I tried to set parameter value from
code
like this:
ObjectDataSource1.SelectParameters["Param1"].DefaultValue =variable;
I used to do that in Page_Load event and it works fine.
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
 
Back
Top