Getting Settings from web.config at design time
Elion at the Asp.net forums provides a very neat way of pulling settings from web.config at design time.
To get access to configuration at design time, use the IWebApplication service. From your control's designer, do something like this:
IWebApplication webApp = (IWebApplication)GetService(typeof(IWebApplication));
if (webApp != null) {
Configuration config = webApp.OpenWebConfiguration(true);
string appSettingsValue = config.AppSettings.Settings["SomeKey"].Value;
}
This is basically what SqlDataSource does in a few places, though it does it with the ConnectionStrings section instead of AppSettings.
Thanks,
Eilon
Last Updated:Thursday, September 02, 2010By:alferoSource#
with your OpenID.
If you do not know what OpenID is,