Check whether you have written connection string in web. config.
something like this.
If your connection string name is myconnectionstring and in the aspx code behind, you have to use same name.
<connectionstrings>
<add name="<b>myConnectionString</b>" connectionstring="server=localhost;database=myDb;uid=myUser;password=myPass;" />
</connectionstrings>
To read the connection string into your code, use the ConfigurationSettings class.
string connStr = ConfigurationManager.ConnectionStrings["
myConnectionString"].ConnectionString;
Can you check in your code whether both matches?