title: How can I pass a session value into a Parameter Collection?
body: <p>I'd like to be able to pass in a session value into my parameter collection.  </p>
  
  <pre><code>&lt;asp:ObjectDataSource ID="dataApplications" runat="server"
      OldValuesParameterFormatString="original_{0}"  SelectMethod="GetSubList"
      TypeName="MApplication"&gt;
      &lt;SelectParameters&gt;
          &lt;asp:Parameter Name="UserName" Type="String" DefaultValue="&lt;%= DirectCast(Session("Profile"), PCommon).UserName %&gt;"/&gt;
           ...
      &lt;/SelectParameters&gt;
  &lt;/asp:ObjectDataSource&gt;
  </code></pre>
  
  <p>I'm getting this Error Message:    </p>
  
  <pre><code>Error   158 Literal content ('&lt;asp:Parameter Name="UserName" Type="String" DefaultValue="') is not allowed within a 'System.Web.UI.WebControls.ParameterCollection'.    C:\TFS\pro\OApp\default.aspx    165
  </code></pre>
  
  <p>Is there a way to do this?</p>