Problem with MultiLine TextBox

Discussion in 'ASP .Net' started by Joel Finkel, Nov 8, 2003.

  1. Joel Finkel

    Joel Finkel Guest

    Folks,

    I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry.

    The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the SingleLine TextBoxes have been saved in the ViewState and are redisplayed correctly. The original data are re-displayed in the MultiLine TextBoxes.

    Examination of the HTML code shows that the only difference in the declaration is the addition of these attributes:

    Rows="4" TextMode="MultiLine"

    I wonder if other people have run into the same problem or have any suggestions as to how to solve this problem.

    Thanks in advance.

    Joel Finkel
     
    Joel Finkel, Nov 8, 2003
    #1
    1. Advertising

  2. Joel Finkel

    Jj Guest

    Post your code please (html). Are you missing runat=server in the multiline text box ?

    Jianjun

    "Joel Finkel" <> wrote in message news:...
    Folks,

    I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry.

    The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the SingleLine TextBoxes have been saved in the ViewState and are redisplayed correctly. The original data are re-displayed in the MultiLine TextBoxes.

    Examination of the HTML code shows that the only difference in the declaration is the addition of these attributes:

    Rows="4" TextMode="MultiLine"

    I wonder if other people have run into the same problem or have any suggestions as to how to solve this problem.

    Thanks in advance.

    Joel Finkel
     
    Jj, Nov 9, 2003
    #2
    1. Advertising

  3. Joel Finkel

    Joel Finkel Guest

    Sure, here is the HTML code for the TextBoxes that are MultiLine.

    <asp:TextBox id="tbHowIHeard" style="Z-INDEX: 110; LEFT: 136px; POSITION: absolute; TOP: 522px" runat="server" Width="466px" Height="90px" CssClass="textBoxData" Rows="4" TextMode="MultiLine"></asp:TextBox>

    <asp:TextBox id="tbActivities" style="Z-INDEX: 112; LEFT: 136px; POSITION: absolute; TOP: 636px" runat="server" Width="466px" Height="90px" CssClass="textBoxData" Rows="4" TextMode="MultiLine"></asp:TextBox>

    <asp:TextBox id="tbVolunteer" style="Z-INDEX: 114; LEFT: 136px; POSITION: absolute; TOP: 752px" runat="server" Width="466px" Height="90px" CssClass="textBoxData" Rows="4" TextMode="MultiLine"></asp:TextBox>

    /Joel Finkel


    "Jj" <> wrote in message news:...
    Post your code please (html). Are you missing runat=server in the multiline text box ?

    Jianjun

    "Joel Finkel" <> wrote in message news:...
    Folks,

    I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry.

    The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the SingleLine TextBoxes have been saved in the ViewState and are redisplayed correctly. The original data are re-displayed in the MultiLine TextBoxes.

    Examination of the HTML code shows that the only difference in the declaration is the addition of these attributes:

    Rows="4" TextMode="MultiLine"

    I wonder if other people have run into the same problem or have any suggestions as to how to solve this problem.

    Thanks in advance.

    Joel Finkel
     
    Joel Finkel, Nov 9, 2003
    #3
  4. Joel Finkel

    Jj Guest

    Sorry, could you please post the code behinde too? How are you initializing the original text in the code behind?

    Jianjun
    "Joel Finkel" <> wrote in message news:e$$...
    Sure, here is the HTML code for the TextBoxes that are MultiLine.

    <asp:TextBox id="tbHowIHeard" style="Z-INDEX: 110; LEFT: 136px; POSITION: absolute; TOP: 522px" runat="server" Width="466px" Height="90px" CssClass="textBoxData" Rows="4" TextMode="MultiLine"></asp:TextBox>

    <asp:TextBox id="tbActivities" style="Z-INDEX: 112; LEFT: 136px; POSITION: absolute; TOP: 636px" runat="server" Width="466px" Height="90px" CssClass="textBoxData" Rows="4" TextMode="MultiLine"></asp:TextBox>

    <asp:TextBox id="tbVolunteer" style="Z-INDEX: 114; LEFT: 136px; POSITION: absolute; TOP: 752px" runat="server" Width="466px" Height="90px" CssClass="textBoxData" Rows="4" TextMode="MultiLine"></asp:TextBox>

    /Joel Finkel


    "Jj" <> wrote in message news:...
    Post your code please (html). Are you missing runat=server in the multiline text box ?

    Jianjun

    "Joel Finkel" <> wrote in message news:...
    Folks,

    I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry.

    The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the SingleLine TextBoxes have been saved in the ViewState and are redisplayed correctly. The original data are re-displayed in the MultiLine TextBoxes.

    Examination of the HTML code shows that the only difference in the declaration is the addition of these attributes:

    Rows="4" TextMode="MultiLine"

    I wonder if other people have run into the same problem or have any suggestions as to how to solve this problem.

    Thanks in advance.

    Joel Finkel
     
    Jj, Nov 9, 2003
    #4
  5. Joel Finkel

    Anon Guest

    Try a simpler example and see if you get the same behavior. I just created a form with a multiline textbox, initialized it with data, ran it, caused a postback, initial data still there, changed the text, caused a postback, and the changed data is coming back with the new text as expected. I have also used multiline textbox in database applications and have never seen the behavior you are stating.


    "Joel Finkel" <> wrote in message news:...
    Folks,

    I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry.

    The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the SingleLine TextBoxes have been saved in the ViewState and are redisplayed correctly. The original data are re-displayed in the MultiLine TextBoxes.

    Examination of the HTML code shows that the only difference in the declaration is the addition of these attributes:

    Rows="4" TextMode="MultiLine"

    I wonder if other people have run into the same problem or have any suggestions as to how to solve this problem.

    Thanks in advance.

    Joel Finkel
     
    Anon, Nov 9, 2003
    #5
  6. Joel Finkel

    Joel Finkel Guest

    Jianjun,

    Here is some of the code. It is very simple. It is identical to code that is used for SingleLine TextBoxes.

    /Joel

    // declare the variable
    protected System.Web.UI.WebControls.TextBox tbHowIHeard;



    Inside of the Page_Load event handler:

    // load the variable from the DataSource
    tbHowIHeard.Text = drMember["HOW_I_HEARD", DataRowVersion.Original].ToString();



    Inside of the bntSave_Click event hander:

    // store the modified data
    sqlUpdateCommand1.Parameters["@HOW_I_HEARD"].Value = tbHowIHeard.Text;



    "Jj" <> wrote in message news:...
    Sorry, could you please post the code behinde too? How are you initializing the original text in the code behind?

    Jianjun
    "Joel Finkel" <> wrote in message news:e$$...
    Sure, here is the HTML code for the TextBoxes that are MultiLine.

    <asp:TextBox id="tbHowIHeard" style="Z-INDEX: 110; LEFT: 136px; POSITION: absolute; TOP: 522px" runat="server" Width="466px" Height="90px" CssClass="textBoxData" Rows="4" TextMode="MultiLine"></asp:TextBox>

    <asp:TextBox id="tbActivities" style="Z-INDEX: 112; LEFT: 136px; POSITION: absolute; TOP: 636px" runat="server" Width="466px" Height="90px" CssClass="textBoxData" Rows="4" TextMode="MultiLine"></asp:TextBox>

    <asp:TextBox id="tbVolunteer" style="Z-INDEX: 114; LEFT: 136px; POSITION: absolute; TOP: 752px" runat="server" Width="466px" Height="90px" CssClass="textBoxData" Rows="4" TextMode="MultiLine"></asp:TextBox>

    /Joel Finkel


    "Jj" <> wrote in message news:...
    Post your code please (html). Are you missing runat=server in the multiline text box ?

    Jianjun

    "Joel Finkel" <> wrote in message news:...
    Folks,

    I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry.

    The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the SingleLine TextBoxes have been saved in the ViewState and are redisplayed correctly. The original data are re-displayed in the MultiLine TextBoxes.

    Examination of the HTML code shows that the only difference in the declaration is the addition of these attributes:

    Rows="4" TextMode="MultiLine"

    I wonder if other people have run into the same problem or have any suggestions as to how to solve this problem.

    Thanks in advance.

    Joel Finkel
     
    Joel Finkel, Nov 11, 2003
    #6
  7. Joel Finkel

    Joel Finkel Guest

    Indeed, a simple form with two TextBoxes, one SingleLine and one MultiLine, works fine.

    Joel Finkel


    "Anon" <> wrote in message news:v4yrb.115701$ao4.350501@attbi_s51...
    Try a simpler example and see if you get the same behavior. I just created a form with a multiline textbox, initialized it with data, ran it, caused a postback, initial data still there, changed the text, caused a postback, and the changed data is coming back with the new text as expected. I have also used multiline textbox in database applications and have never seen the behavior you are stating.


    "Joel Finkel" <> wrote in message news:...
    Folks,

    I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry.

    The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the SingleLine TextBoxes have been saved in the ViewState and are redisplayed correctly. The original data are re-displayed in the MultiLine TextBoxes.

    Examination of the HTML code shows that the only difference in the declaration is the addition of these attributes:

    Rows="4" TextMode="MultiLine"

    I wonder if other people have run into the same problem or have any suggestions as to how to solve this problem.

    Thanks in advance.

    Joel Finkel
     
    Joel Finkel, Nov 11, 2003
    #7
  8. Joel Finkel

    Joel Finkel Guest

    Re: Problem with MultiLine TextBox [CLOSED]

    Folks,

    Pilot error. The problem was that I was cloberring the results in the Page_Load event handler by misplacing code outside the if !IsPostBack check. Like most bugs, it was hard to find and easy to fix. THanks for your time.

    Joel Finkel




    "Joel Finkel" <> wrote in message news:...
    Folks,

    I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry.

    The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the SingleLine TextBoxes have been saved in the ViewState and are redisplayed correctly. The original data are re-displayed in the MultiLine TextBoxes.

    Examination of the HTML code shows that the only difference in the declaration is the addition of these attributes:

    Rows="4" TextMode="MultiLine"

    I wonder if other people have run into the same problem or have any suggestions as to how to solve this problem.

    Thanks in advance.

    Joel Finkel
     
    Joel Finkel, Nov 11, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Middlemiss
    Replies:
    2
    Views:
    5,268
    Jacob Yang [MSFT]
    Nov 10, 2003
  2. Mark Sandfox
    Replies:
    2
    Views:
    616
    Nicole Calinoiu
    Feb 11, 2004
  3. hardcoded

    maxlength on multiline textbox

    hardcoded, May 5, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    19,099
    cnicol
    Sep 26, 2007
  4. =?Utf-8?B?RW56byBNYXJpbmVsbGk=?=

    Bug? - RegularExpressionValidator on a MultiLine TextBox

    =?Utf-8?B?RW56byBNYXJpbmVsbGk=?=, May 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,466
    Martin Dechev
    May 6, 2004
  5. dale zhang
    Replies:
    8
    Views:
    458
    Tintin
    Nov 30, 2004
Loading...

Share This Page