Hello, I have a repeater that has multiple controls in them such as checkboxes, dropdownlists and textboxes. In my case I have a repeater with two items in it. The first items list works fine, but the second has two textboxes returning the initial value that was bound on page load while other controls in the the second repeater item works fine.

I've been searching for an answer for countless hours and have been unable to find an answer, if anyone can help that would be greatly appreciated.

I do not have the code on hand but its very similar to below:

void Page_Load(object sender, EventArgs e)
{
    ... // code that resets controls not related to the repeater

    ... // code that checks a value on each repeater item

    if(!IsPostBack)
    {
        binddata();
    }
} 

protected void btnSave_OnClick(object sender, EventArgs e)
{
    List<CLASS> myList = new List<CLASS>();

    RepeaterItemCollection items = myRepeater.Items;
    for(int i = 0; i < items.count; i++)
    {
        CLASS myClass = new CLASS();
        // Get controls
        TextBox myWorkingTextBox = (TextBox)items[i].FindControl("txtFirstName");
        TextBox myBrokenTextBox = (TextBox)items[i].FindControl("txtLastName");
        ...
        ... // other controls
        ...

        // add control values to a class object
        myClass.FirstName = myWorkingTextBox.Text.ToString(); // returns entered value
        myClass.LastName = myBrokenTextBox.Text.ToString(); // returns inital value, not entered
        ...
        ... // other controls
        ...

        // add class object to list
        myList.Add(myClass)
    }

    for(int i = 0; i < items.count; i++)
    {
        // save to DB code
    }
}

It would be easier to help you if you pasted your actual code in the aspx and code behind file. If you can provide these I will take another look.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.