textboxes retaining original value

  • Thread starter Thread starter JC
  • Start date Start date
J

JC

Hi,

I am a novice at .net and have created a page of text boxes that are
populated from a database. I want the user to be able to change the
values in the box then submit the page and have these value updated to
the databse. However, whenever I post the page it is the old values
that are posted, not the newly entered ones.

I am totally confused - this was SUCH an easy thign to accomplish
using traditional ASP. Your help woudl be appreciated

Yours

JC
 
You are probably overwriting your values with those from the database.
Wherever you initially set the Textboxes you need to put that code inside a
block that checks for postback. That way only the first time you hit the
page (not a post back), will the values be placed into the Textboxes.

if (!IsPostBack) {
// Do db call here and set up textboxes.
}
 
....a little code should help the list answer this...
I suggest that you repost this message into the "aspnet" group and provide
some of your source code..before that check that your ASP.NET controls are
inside a form like this..

<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
....
....
</form>

/Oscar
 
Back
Top