Help With textBox in a web Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yonatan1234
    New Member
    • Jul 2010
    • 5

    #1

    Help With textBox in a web Form

    Hello Everyone!

    I am trying to make a simple form that is positioned within a contentHolder.

    The "CommitChan ge" Function should do a simple action - update a message to the data in the textBoxes in the form. However, though I change the text through input (writing in the textBox txtEmail "yonatan@yahoo. com" for instance), the values stay the same as they were when the page loaded. Why Does the page not update the values in the textBoxes?


    Here is the function:
    Code:
    protected void CommitChange(object sender, EventArgs e)
        {
            
            ContactMessage messageToUpdate = new ContactMessage(
                idToEdit,txtName.Text,txtEmail.Text,txtPhone.Text,txtMsg.Text,DateTime.Now.ToShortDateString(),
                int.Parse(DdlStatus.SelectedValue),int.Parse(DdlSubject.SelectedValue),txtAddress.Text,txtCity.Text,
                txtMobile.Text,txtInnerText.Text);
            BLLContactMessage.updateMessage(messageToUpdate);
            lblOutput.Text = "Message Updated";
            lblOutput.Visible = true;
        }
    Thank you to everyone,

    Johnathan.
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    make sure your textbox is not readonly and the editable property is NOT set to false. You may also want to make sure viewstate is not disabled for the textbox.

    Comment

    • yonatan1234
      New Member
      • Jul 2010
      • 5

      #3
      Thanks a lot!

      That really helped. My Mistake was not putting the FillFields() function in th if (!isPostBack) on the loading finction. By Checking the properties I suddenly noticed that.

      Comment

      Working...