views:

512

answers:

1

Perhaps this is laziness on my part, but in the same way I can reference a connection string from my web.config using <%$ ConnectionStrings:con %>, I'd like to do similar referencing an Application variable in one of my select parameters. Something like:

<asp:Parameter Name="AppVal" Type="Int32" DefaultValue="<% Application['MyVal'] %>" />

Is this stupid of me? Should I just shut up and set the parameter value in the codebehind? I've been Googling for hours trying to describe the different ways to leverage the angle-bracket-percent-sign style tags in ASP.Net and have only found inline code and code render blocks (<%=), as well as data binding (<%#). What's this <%$ all about, and are there others I'm missing?

A: 

I see now that the <%$ references an ExpressionBuilder. Using some handy code I was able to create my own ApplicationExpressionBuilder and populate the desired value into my control.

Google Custom Session Expression Builder to find code for a similar way to leverage session variables and make the easy switch over to application variables if it suits you.