Results 1 to 6 of 6

Thread: txtbox not updating

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    txtbox not updating

    On the page load I use a datareader to populate the textboxes on my page. I let the user make changes then on a save click event I run an update. The value stays the same in the txtbox, even though I made changes to it. I debug thru and the value is indeed the same. Has anyone come across this problem?

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Even though you are running an update command to update the boxes, did you then re-read the data and re-populate the boxes?

    And does the database show your new values in it?
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  3. #3

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    if I comment out the datareader field and keep the txtbox empty, I can update it with different data. But , if I get the data from the data reader, then make an update, the same data that was placed into the txtbox is then updated to the database. The new value that I put in is not being stored in the txtbox.

    what do you mean by re-reading the data. You mean I have to run the datareader again during the click event, where I will be updating?

  4. #4
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Your description of what is going on is eluding me.

    I think I need code.

    As for the updated data. Yes, you have to re-create the reader and re-bind the data (at least from my experience) because the datareader once populated becomes static.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  5. #5

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    this is how I fill my textboxs on the page_load

    Code:
    Do While objDataReader.Read = True
                    txtBidId.Text = objDataReader("Bid_ID")
                    txtBuyerName.Text = objDataReader("Buyer_Name")
                    txtIntDisStartDate.Text = objDataReader("display_start_date")
                    txtBidOpenDate.Text = objDataReader("bid_date")
                    txtBidDesc.Text = objDataReader("bid_schedule_desc")
                    txtIntDisEndDate.Text = objDataReader("display_end_date")
    then the user makes any changes they need and then on the save click event I have my update.

    Code:
    sqlCmd = "update pbss.pbss_bid_schedule "
            sqlCmd = sqlCmd & "set bid_date= to_date('" & txtBidOpenDate.Text & "','MM/DD/YYYY')"
            sqlCmd = sqlCmd & ",bid_status_code='" & Bid_Status & "'"
            sqlCmd = sqlCmd & ",pre_bid_ind=0,bid_schedule_desc='" & txtBidDesc.Text & "'"

    the problem I'm having is the textbox values are still holding the same values from when the datareader filled them up, even after changes have been made. I can see this when I debug

  6. #6

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    ok, now I see that when I click the save button my page is reloading and is going back to the page_load event, this is where I have my datareader to fill the page, then it goes to the click event, where my update is. I used a If Not me.IsPostBack to check if it's being posted back. Now I have to click twice to do a update.

    How come the click event goes to the page load and then click event. Is there a way to stop it from reloading?

Posting Permissions

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



Click Here to Expand Forum to Full Width