I have a multiline textbox on my form. It is filled on load with content from a database. The user then manipulates this data, and it needs to be updated on the database. I have everything working except for getting the changed value of the textbox.

In the on_click event i try to get the value of the textbox like:

variable = txtbxName.Text;

when I do this it returns only the value it was pre-loaded with and not the value with the user updates.

I have tried setting autopostback to true and tried to databind() the controls, neither of these is the solution to my problem. I think I am missing a key piece of information, please help (c# native if possible).

Recommended Answers

All 3 Replies

I really feel like i'm missing something here... Here's what I have

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string qryString = Request.QueryString["id"];

                fillContents(qryString);
            }
        }

so i fetch my querystring and use my method which fills my textbox.
Then...

protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string title = txtBxTitle.Text;
            string content = txtBxContent.Text.Replace(Environment.NewLine, "<br />");
...more fun stuff
        }

at this point, im expecting content and title to be filled with the current value of boxes, yet it still gives me the original filled value. I'm going nuts, please help...

This is 32nd Post of thacravedawg. The sun isn't up yet - Wake up and format the code

I really feel like i'm missing something here... Here's what I have

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string qryString = Request.QueryString["id"];
                fillContents(qryString);
            }
        }

so i fetch my querystring and use my method which fills my textbox.
Then...

protected void btnSubmit_Click(object sender, EventArgs e)
 {
     string title = txtBxTitle.Text;
    string content = txtBxContent.Text.Replace  (Environment.NewLine, "<br />");
...more fun stuff
  }

at this point, im expecting content and title to be filled with the current value of boxes, yet it still gives me the original filled value. I'm going nuts, please help...

ViewState may be causing the problem. If this continues to occur, consider placing hidden input control and copy the value of the textbox to that hidden upon the page posting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.