Updating dataset with values from TextBox control

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Updating dataset with values from TextBox control

    Hi
    I have built a very simple page, which takes data via TextBox controls, and
    updates to a Dataset.

    I've used the Data Access Blocks (v2), to help with functionality, and to
    build a DAL.

    Part of my code takes the form:

    ds.tables(0).rows(0)("FirstName") = Firstname.Text


    There is only one record in the dataset, so this updates the record with the
    value the user entered in the TextBox.
    However, it doesn't.....

    When I debug, the value of Firstname.Text is the value it was when the page
    opened, and not the value that is Currently in it.

    I have changed the code to :

    ds.tables(0).rows(0)("FirstName") = "Test Value"

    And this gets wrote out successfully.

    It appears that my textbox does not update its value, when the user changes
    its value.
    Seems strange.... Am I doing something wrong?

    Thanks


    Paul


    Paul Aspinall Guest

  2. Similar Questions and Discussions

    1. updating dataset component with actionscript
      I'm trying to update text from the fields of a dataset object. I can easily reference and change using _root.dataset.currentItem.FieldName. But...
    2. updating dataset from xml file
      Hello, I am new in developing with Dataset, XML, Web Services ... I want to load a xml file into a dataset and update the database with new and...
    3. sending values in textbox
      Hi I want to be able to send the vlaues that a user enters in a couple of input fields. However, my register_globals is set to off. So how do I...
    4. VERY STRANGE BUG? Adding a textbox control causes other textbox control to fail???
      I've had this happen a few times too. I'm still not positive of what exactly causes it but all that's happening is the control that no longer...
    5. updating a typed dataset (newbie question?)
      I created a DataGrid and bound a DataView of a typed DataSet to it (i tried with the DataSet as well but i'd rather use the DataView as i'm using it...
  3. #2

    Default Re: Updating dataset with values from TextBox control

    Paul,

    I think your text box is overwriting itself when the page posts back. If you
    are setting a value in the text box when the page is loaded up you need to
    do that only the first time the page is loaded.

    use:

    If Not IsPostBack Then
    '---Set you text box here.
    End If

    This will keep the text box's data from being overwritten on post back.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche


    "Paul Aspinall" <paul@nospamaspy.co.uk> wrote in message
    news:u8jq4P4XDHA.3248@tk2msftngp13.phx.gbl...
    > Hi
    > I have built a very simple page, which takes data via TextBox controls,
    and
    > updates to a Dataset.
    >
    > I've used the Data Access Blocks (v2), to help with functionality, and to
    > build a DAL.
    >
    > Part of my code takes the form:
    >
    > ds.tables(0).rows(0)("FirstName") = Firstname.Text
    >
    >
    > There is only one record in the dataset, so this updates the record with
    the
    > value the user entered in the TextBox.
    > However, it doesn't.....
    >
    > When I debug, the value of Firstname.Text is the value it was when the
    page
    > opened, and not the value that is Currently in it.
    >
    > I have changed the code to :
    >
    > ds.tables(0).rows(0)("FirstName") = "Test Value"
    >
    > And this gets wrote out successfully.
    >
    > It appears that my textbox does not update its value, when the user
    changes
    > its value.
    > Seems strange.... Am I doing something wrong?
    >
    > Thanks
    >
    >
    > Paul
    >
    >

    S. Justin Gengo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139