By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,636 Members | 1,693 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,636 IT Pros & Developers. It's quick & easy.

textbox inside a repeater control

P: n/a
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
Jan 26 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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" <aj****@blueyonder.co.uk> wrote in message
news:eE**************@TK2MSFTNGP14.phx.gbl...
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

Jan 26 '06 #2

P: n/a
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

Jan 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.