textboxes retaining original value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JC

    textboxes retaining original value

    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
  • Justin Rogers

    #2
    Re: textboxes retaining original value

    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.
    }


    --
    Justin Rogers
    DigiTec Web Consultants, LLC.

    "JC" <james_crane@bt internet.com> wrote in message
    news:d73038d8.0 309010526.5d2ab bd3@posting.goo gle.com...[color=blue]
    > 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[/color]


    Comment

    • Oscar Thornell

      #3
      Re: textboxes retaining original value

      ....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

      "JC" <james_crane@bt internet.com> wrote in message
      news:d73038d8.0 309010526.5d2ab bd3@posting.goo gle.com...[color=blue]
      > 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[/color]


      Comment

      Working...