Losing values of Textboxes after accessing values from web.config

Can someone help with me with this problem.

I am accessing some values from my application's web.config in the AppSettings section and setting the text properties of the text boxes on a settings page with these values. I then edit the value of one of the text boxes. When I click the Save Changes button I lose the values of these text boxes. The code I am using is:

In Page_Load:
txtSMTPServerURL.Text = ConfigurationManager.AppSettings["SMTPServerURL"]

In btnSaveChanges_Click:
string smtpURL = txtSMTPServerURL.Text

Andrew Ling

5/29/2007 7:58:25 AM
asp.net.config-deploy 12495 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 4

Are you checking for a postback (Page.IsPostback) on the page load event?  

Website Design Darlington - http://mdssolutions.co.uk
http://lessthandot.com - Experts, Information, Ideas & Knowledge
http://aspnetlibrary.com - An online resource for professional ASP.NET developers

Please remember to click "Mark as Answer" on this post if it helped you

5/29/2007 9:59:38 AM

I was not checking for a postback. I checked for a postback and this fixed the problem.

 Andrew Ling

5/30/2007 12:14:07 AM

Similar Artilces:

Web.Config/App.config key values
I've got a problem with the app.config file in my application.  I have a separate class library project in my solution, along with a web application.  The web application references the class library to act as the data access component.I want to use the app.config file to store connection strings, appsettings, etc.  However, when I deploy the web application, the data access library tries to use the key values from the web.config file, instead of the app.config file.Some code:Class Library:using System;using System.Collections.Generic;using System.Text;using System.Configurati...

Accessing Web.config values programmatically
Hi All,Can you help me with this bit of code?  I'm trying to get the connection string from my web.config file, which looks something like this:<configuration>  <connectionStrings>    <add name="SiteSqlServer" connectionString="Server=localhost;Database=DNN4_module_dev;uid=secret;pwd=supahdupahsecret;" providerName="System.Data.SqlClient" />  </connectionStrings></configuration>Then I've got this bit of code:Dim configAccess As System.Configuration.Configuration = WebConfigurationManager.OpenWebConfiguration("\")   &n...

can I get value from Web.config and use the value as a parameter?
in my orginal program code        internal static void QueryForExportAgent(ref StringBuilder sb,decimal MasterKey)     {      sb.Append("SELECT * FROM ZT_Detail WHERE ");      sb.Append(fMasterKey);      sb.Append("=");      sb.Append(setParametersValidation(MasterKey));      sb.Append(" AND ");      sb.Append(fTYPE);  ...

how to access web.config values in a js file.
Hi,all             Im using ASP.NET appl with FCKEditor.I have a key value n Web.config as like      <add key="fck" value="0" /> I want to get this value in the fckeditor_ie.js.how will i get it.and to check that value in a javascript.   thanks,  Thanks, The easiest way to accomplish this is to render the value into a script block:  <script> var mySetting = '<%=someServerString%>';  </script>  Now as long as this sc...

programmatic access to web.config customerror values?
Is there any way to access the customerror page values programmatically? For instance, here is my web.config file: <customErrors defaultRedirect="/Error/default.aspx" mode="RemoteOnly"> <error statusCode="404" redirect="/Error/404.aspx"/> <customErrors> And I want to get the "/Error/404.aspx" value based on the 404 statusCode Or alternatively, I want to do a manual redirect if a file does not exist: If Not File.Exists("some_pdf_file.pdf") Then Response.Redirect("404pageFromW...

Accessing web.config file values from a DLL??
Hi Everyone - I have a project that has a DLL included with the website - but the DLL and the web site need to read the connection string from the web.config file..... can the DLL read this file??? Or - do i need an app.config for the DLL?? thanks tony You can read values from web.config: Value = System.Configuration.ConfigurationSettings.AppSettings[Key] Hello - Thanks for the reply except the name of the web.config file is NOT the same as the DLL name, therefore the DLL does not see the web.config file... but it will see t...

Use a Name/value in Machine.config file in the web.config file
Hello. I want/need to access a variable in the machine.config file and use it in the web.config file. My scenario is: Each machine has a machine name, so (I assume this is the best place to put it) I want to create a variable in <appsettings> in the machine.config file called "MachineName".  In my web.config file, I want to use the MachineName variable in the machine.config in the appsettings.   Example: (web.config file)  ... <appSettings> <add key="ServerFileNames" value=\\ISCO1FEGRD\Dotnet_files\OrclIntlList.xml /> Replace the ...

Web Deployment Project - Config Properties
I'm using a Web Deployment Project to compile my web site. In the Property Pages - Configuration Properties - Deployment section, there is an option to 'Enable Web.config file section replacement'. I have this working to replace certain sections of my web.config for each build config (release/staging/dev). I think this makes sense so other developers do not have to remember to change the web.config file. HOWEVER, this only seems to work when replacing parts of web.config; such as appSettings, connectionString, etc. This would require me to have separate config files for each section and bui...

running 2 web.configs in the same website 1 in /web.config and one in /swf/web.config
Im having issues doing this. and when i remove the authentication from the swf/web.config it still doesnt seem to be applying to the child website at all. Whats the proper way to set a child website? Thanks!!  The lower most web.config overrides all previous settings. So if you remove the section from the /swf/web.config whatever settings you have in the web.config in the next higher level will have an effect on the content of the child folder.So instead of removing a section, try giving appropriate settings in the /swf/web.config....

Reading values from system.web section of the web.config file
How do you read a value from from the "system.web" section of the web.config file in asp.net 1.1?ie system.web/machineKey area, then the value assigned to the validation keyAny help would be most appreciatedThanks...

app.config and web.config deployments and installers
I use web deployment projects for changing web.config values based on the configuration build types I have setup (dev/test/stage/prod) and it works excellent for building installers in multiple environments.  Now, I am trying to do the same the Windows Applications.  How can I automate the changing of app.config values based on the build configuration (dev/test/stage/prod)?  Any help would be much appreciated. Thanks,Chris...

Changing a value in web.config
If I have a value stored in the web.config that would change probably only around once a year, how can I change the value programmatically?  Or is it even safe to do this? i would be tempted to just put the value in a database and change that when needed. Otherwise I would manually change the web.config when needed. Otherwise the code you write to change the value could easily crash your whole site. It just takes one accident !Intelligence is a burden.Jagdip Singh AjimalManchester (and yes, I am a Manchester United fan) This is one thing that has really frustrated me about ASP.Net, ...

Encrypt A Value in Web.Config
Hi ,  I want to Encrypt a Single Value in Web.Config File instead of whole section. Please let me know how.  for example : <appSettings><add key="ADUser" value="Test" /> <add key="ADPassword" value="xyz" />   <add key="HelpStartPage" value="http://www.Google.Com"/>    <add key="DateWindow" value="3"/>    <add key="ALExport" value="ApplicationLog"/>    <add key="OLExport" value...

cannot retrieve value from web config, why????
sample test code web.config <?xml version="1.0" encoding="UTF-8" ?> <configuration> <appSettings> <add key="conn" value=""Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\wwwroot\testing\test.mdb"/> </appSettings> and so on.... test.aspx <%@ Page Language="VB" Debug="true" %> <%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matri...

Web resources about - Losing values of Textboxes after accessing values from web.config - asp.net.config-deploy

Notes Plus on the App Store on iTunes
Get Notes Plus on the App Store. See screenshots and ratings, and read customer reviews.

Training - Algodoo
Navigation Home For Fun Algodoo Play Algodoo Physics Scenes Demo Buy For Education Algodoo for Education Lessons User stories Solutions Demo ...

Automated Test Design
... tests along with doing ET. Here's my take on a UI test for Alan's app: Open the page Check that text "Total" exists. Check that the 6 textboxes ...

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 11 Jul 2012

Cyprus By Bus Route Planner - Find your bus journey in Cyprus
Cyprus By Bus route planner for finding the best possible bus route between two bus stops in Cyprus. Based on origin bus stop, destination bus ...

Issues - gwen - GUI system aimed at games - Google Project Hosting
My favorites ▼ - Sign in gwen GUI system aimed at games Project Home Downloads Wiki Issues Source New issue Search Search within: All issues ...

ASP.NET Web Forms DynamicData FieldTemplates for DbGeography Spatial Types
... Those templates are simple. Here's the Edit example. You might say, hang on, this is just a text box! I thought we weren't using TextBoxes? ...

uCan Post WordPress Plugin Demo - Cartpauj & iComNow
This is a demo for the uCan Post WordPress plugin by cartpauj. This plugin lets users create posts and site content without having to access ...

Jennifer Semtner [ Web Designer / Developer ] » CSS
If you're using Grails and the Grails UI plugin's autocomplete feature, you may have noticed all of your textboxes have disappeared in Chrome ...

Resources last updated: 12/14/2015 6:34:28 PM