[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

=?Utf-8?B?cm9kY2hhcg==?=

2/18/2004 1:11:00 AM

H

I have a user control that contains textBoxes and it works fine when placed on an aspx page
However, when the user control is placed within a repeater, I am unable to get the values from the textBoxes
My code to obtain the textBox values is

Repeater rptr = myUserControl.FindControl("UserControlRepeater") as Repeater;
if (rptr != null

for (int idx = 0; idx < rptr.Items.Count; idx++

RepeaterItem item = rptr.Items[idx]
TextBox txtNum = rptr.Controls[idx].FindControl("myTxtBox") as TextBox
if (txtNum != null
this.errLabel.Text += "Value: " + txtNum.Text + "<br>"


This works when the user control is placed on a page
When the User control is placed in a repeater, I get the user control like this

// get the page repeate
Repeater rptr = this.FindControl("myPageRepeater") as Repeater;
if (rptr != null

for (int idx = 0; idx < rptr.Items.Count; idx++

RepeaterItem item = rptr.Items[idx]
// get the user contro
MyUserControl myUserControl = rptr.Controls[idx].FindControl("myUserControl") as MyUserControl
// now get the user control repeater and textbox values as shown abov



The code doesn't cause a crash as there are no null references. It seems like ViewState is being lost when a repeater is used
Anybody have any idea what's going on

Thanks very muc
Graha