HtmlTextArea viewstate can not be disabled?

Discussion in 'ASP .Net' started by Ryan Liu, Jul 12, 2009.

  1. Ryan Liu

    Ryan Liu Guest

    Hi,

    I have a HtmlTexTArea inside update panel

    <SR:UpdatePanel runat="server" ID="upnDetail" ChildrenAsTriggers="false"
    UpdateMode="Conditional" EnableViewState="false">
    <ContentTemplate>

    <SR:placeHolder ID="phNetwork" runat="server"
    Visible="false" EnableViewState="false">
    <asp:Label runat="server"
    ID="lblNetworkName"></asp:Label>
    <textarea runat="server" readonly="readonly"
    id="tarNetworkOverview" cols="60" rows="10"
    enableviewstate="false"></textarea>
    ............

    Codebehind I do call
    if( ...)
    {
    lblNetworkName = "llll";
    tarNetworkOverview.Value = "text";
    }

    //otherwise do not set their values

    //update the updatepanel
    this.upDetail.Update();


    -------

    But I am surprised to see after post back, I still see text in the text area
    which was set previously when if (true).

    But The asp:Label works as expected, it will be clean up or set.

    Seems the server side textarea's view state is always enabled ?!

    Thanks!
    Ryan
    Ryan Liu, Jul 12, 2009
    #1
    1. Advertising

  2. Ryan Liu

    bruce barker Guest

    with textarea's viewstate is only used to detect onchange, as the
    browser posts the textarea value. labels are not posted back.

    in general if you write your code correctly, you can disable viewstate
    in web config, and cut down page sizes.

    -- bruce (sqlwork.com)

    Ryan Liu wrote:
    > Hi,
    >
    > I have a HtmlTexTArea inside update panel
    >
    > <SR:UpdatePanel runat="server" ID="upnDetail" ChildrenAsTriggers="false"
    > UpdateMode="Conditional" EnableViewState="false">
    > <ContentTemplate>
    >
    > <SR:placeHolder ID="phNetwork" runat="server"
    > Visible="false" EnableViewState="false">
    > <asp:Label runat="server"
    > ID="lblNetworkName"></asp:Label>
    > <textarea runat="server" readonly="readonly"
    > id="tarNetworkOverview" cols="60" rows="10"
    > enableviewstate="false"></textarea>
    > ...........
    >
    > Codebehind I do call
    > if( ...)
    > {
    > lblNetworkName = "llll";
    > tarNetworkOverview.Value = "text";
    > }
    >
    > //otherwise do not set their values
    >
    > //update the updatepanel
    > this.upDetail.Update();
    >
    >
    > -------
    >
    > But I am surprised to see after post back, I still see text in the text
    > area which was set previously when if (true).
    >
    > But The asp:Label works as expected, it will be clean up or set.
    >
    > Seems the server side textarea's view state is always enabled ?!
    >
    > Thanks!
    > Ryan
    bruce barker, Jul 13, 2009
    #2
    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. Will T

    Referencing HTMLTextArea

    Will T, Oct 22, 2003, in forum: ASP .Net
    Replies:
    10
    Views:
    908
    Kevin Spencer
    Oct 24, 2003
  2. =?Utf-8?B?TWljaGFlbCBTTA==?=

    Make HtmlTextArea Readonly on the fly

    =?Utf-8?B?TWljaGFlbCBTTA==?=, Feb 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    4,115
    =?Utf-8?B?TWljaGFlbCBTTA==?=
    Feb 18, 2004
  3. Ken Varn
    Replies:
    4
    Views:
    460
    Ken Varn
    Nov 9, 2004
  4. Alejandro Penate-Diaz

    if (control.visible == false) viewstate disabled?

    Alejandro Penate-Diaz, Mar 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,460
    Alejandro Penate-Diaz
    Mar 4, 2005
  5. ae
    Replies:
    2
    Views:
    113
    venuprs
    Apr 8, 2005
Loading...

Share This Page