Text values within a Repeater

Discussion in 'ASP .Net' started by Dan, Jul 13, 2003.

  1. Dan

    Dan Guest

    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)
    });
    }
    }
     
    Dan, Jul 13, 2003
    #1
    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. Darren Smith
    Replies:
    5
    Views:
    5,559
    dsmith
    May 10, 2004
  2. Kevin Cunningham

    Label within repeater losing text on post back

    Kevin Cunningham, Jan 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    6,365
    Eliyahu Goldin
    Jan 20, 2005
  3. Replies:
    0
    Views:
    905
  4. Replies:
    0
    Views:
    2,938
  5. Abe
    Replies:
    2
    Views:
    187
Loading...

Share This Page