User304384516 posted
I have a custom server control derived from SqlDataSource. It is in a dll. I reference the dll in a web site. In the ctor, I want to get a connection string from web.config. I have tried
ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
When I drop an instance of the control on a web form, I get the error "Object reference not set to an instance of an object.". I seems like the control can't read web.config.
How can I read a connection string from web.config in a custom server control at design time?
Bill