textbox inside a repeater control

Discussion in 'ASP .Net' started by Andy Fish, Jan 26, 2006.

  1. Andy Fish

    Andy Fish Guest

    Hi,

    I have a forrm with viewstate disabled (to try and optimize network
    performance). I have come a bit unstuck though when I use a repeater with a
    textbox inside it

    Obivously with viewstate disabled, the repeater contains no items on
    postback unless I databind it. however, this causes the posted textbox
    values to be overwritten with the databound ones.

    is there any way to do the databind before the posted values are applied, or
    do I have to enable viewstate for this form after all?

    TIA

    Andy
    Andy Fish, Jan 26, 2006
    #1
    1. Advertising

  2. Hi Andy,
    u should enable viewstate of your repeater. If viewstate is not enabled for
    a control it will be re-constructed. that will cause to lose its state as u
    have experienced. Enabling only repeater's viewstate is enough for your
    case.

    --
    HTH

    Thanks,
    Yunus Emre ALPÖZEN
    BSc, MCSD.NET
    Microsoft .NET & Security MVP

    "Andy Fish" <> wrote in message
    news:...
    > Hi,
    >
    > I have a forrm with viewstate disabled (to try and optimize network
    > performance). I have come a bit unstuck though when I use a repeater with
    > a textbox inside it
    >
    > Obivously with viewstate disabled, the repeater contains no items on
    > postback unless I databind it. however, this causes the posted textbox
    > values to be overwritten with the databound ones.
    >
    > is there any way to do the databind before the posted values are applied,
    > or do I have to enable viewstate for this form after all?
    >
    > TIA
    >
    > Andy
    >
    >
    Yunus Emre ALPÖZEN [MVP], Jan 26, 2006
    #2
    1. Advertising

  3. Hi Andy,

    You can have a Page level Arraylist (or Hashtable) for storing values from
    textboxes in the repeater. When postback retrieve values first, the rebind
    the repeater:

    if(IsPostBack)
    {
    list = new ArrayList();
    foreach (RepeaterItem item in repeaterObj.Items)
    {
    TextBox txt = item.FindControl(txt_ID) as TextBox;
    list.Add(txt);
    }
    }

    repeaterObj.DataSource = dataObject;
    repeaterObj.DataBind();


    HTH

    Elton Wang

    "Andy Fish" wrote:

    > Hi,
    >
    > I have a forrm with viewstate disabled (to try and optimize network
    > performance). I have come a bit unstuck though when I use a repeater with a
    > textbox inside it
    >
    > Obivously with viewstate disabled, the repeater contains no items on
    > postback unless I databind it. however, this causes the posted textbox
    > values to be overwritten with the databound ones.
    >
    > is there any way to do the databind before the posted values are applied, or
    > do I have to enable viewstate for this form after all?
    >
    > TIA
    >
    > Andy
    >
    >
    >
    =?Utf-8?B?RWx0b24gVw==?=, Jan 27, 2006
    #3
    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. =?Utf-8?B?QnJ5YW4=?=

    TextBox Validation Inside a Repeater

    =?Utf-8?B?QnJ5YW4=?=, Aug 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,360
  2. Replies:
    1
    Views:
    7,022
    Karl Seguin
    Aug 10, 2005
  3. uncensored
    Replies:
    0
    Views:
    815
    uncensored
    Oct 25, 2006
  4. Ashish Bandi via .NET 247

    Accessing TextBox/Label controls inside a Repeater control

    Ashish Bandi via .NET 247, May 14, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    736
    Scott Mitchell [MVP]
    May 14, 2004
  5. Microsoft

    Repeater inside a Repeater

    Microsoft, Aug 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    207
    Microsoft
    Aug 21, 2006
Loading...

Share This Page