Text values within a Repeater

D

Dan

Hi, I have a repeater, and on post-back when I try to access the Text
properties of <asp:label>'s in the repeater, they are all String.Empty
(which they are not when the page is rendered.)

Anyone know why this would be? I would expect the repeater to persist
itself and it's controls into the viewstate...

Thanks much!
Dan

Here's my code (note that the "Checked" property of the checkbox is
persisted to the viewstate correctly):

// loop through all of the rows in the repeater
foreach (RepeaterItem ri in _rptrColumns.Items) {
// if the row is checked, add it to the DataTable
bool isChecked = ((CheckBox)ri.FindControl("_cbxColumnsIsIncluded")).Checked;
if (isChecked) {
userColumns.Rows.Add(new object[] {
((Label)ri.FindControl("_lblColumnsInternalName")).Text,
((Label)ri.FindControl("_lblColumnsUIValue")).Text,
ConvertEx.SafeToInt32(
((DropDownList)ri.FindControl("_lstColumnsOrder")).SelectedItem.Value)
});
}
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top