textbox doesn't detect change in itself


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: textbox doesn't detect change in itself

  1. #1
    sander Guest

    textbox doesn't detect change in itself


    i have a textbox that is populated by select stateemnt from the table
    textbox1.text=.....select from...
    which contains the string hello
    i keyed in the new text "bye" into the textbox
    and try to update the table
    but upon clicking on the "update" button which i created..the value that
    is updared into the table is still "hello"
    i tried setting autopostbacl to true and false but both didn't work

  2. #2
    Duray AKAR Guest

    Re: textbox doesn't detect change in itself


    Sander,

    You need to have EnableViewState to be true. But it is true by default and
    i think it will be true when you check it

    But the problem is which event of datagrid do you use and how are you updating
    the data.

    pls send the details, or the code maybe, i would be glad to help...

    Have Fun.

    Duray AKAR

    "My grandfather once told me that
    there are two kinds of people:
    those who work and
    those who take the credit.
    He told me to try to be in the first group,
    there was less competition there"
    (Gandhi)


    "sander" <palesaints@hotmail.com> wrote:
    >
    >i have a textbox that is populated by select stateemnt from the table
    >textbox1.text=.....select from...
    >which contains the string hello
    >i keyed in the new text "bye" into the textbox
    >and try to update the table
    >but upon clicking on the "update" button which i created..the value that
    >is updared into the table is still "hello"
    >i tried setting autopostbacl to true and false but both didn't work



  3. #3
    David Sumner Guest

    Re: textbox doesn't detect change in itself


    Hello Sander,
    I was having the same problem you are having while trying to use In-Place
    Editing with a datagrid. If the value of the textbox was populated by setting
    the .text property during page load or if it was databound. The glitch is
    when you load the page the text is placed in the textbox, usually on the
    pages PageLoad() method. If you postback the form and try to access the text
    propery of the textbox, guess what, the pages PageLoad() event is fired and
    the text for the textbox is loaded again from your datasource, after which
    your update method is using the text from the textbox and updating the database.
    See, before you are accessing the new value it is being set back to the original.
    Here is what you need to do to prevent this:

    In the pages PageLoad() method, surround however you are populating the textbox
    with this if statement

    if(!this.IsPostBack){

    [insert your code for populating the textbox]

    }

    What that will do is only set the value of the textbox the first time you
    access the page. When you postback and run the Update method for saving the
    new value to the database you will be able to access the new value you entered
    into the textbox.


    "sander" <palesaints@hotmail.com> wrote:
    >
    >i have a textbox that is populated by select stateemnt from the table
    >textbox1.text=.....select from...
    >which contains the string hello
    >i keyed in the new text "bye" into the textbox
    >and try to update the table
    >but upon clicking on the "update" button which i created..the value that
    >is updared into the table is still "hello"
    >i tried setting autopostbacl to true and false but both didn't work



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center