Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Passing Values from Repeater

Status
Not open for further replies.

jgd123456

Programmer
Nov 3, 2006
19
GB
Hi, i have a Repeater control within a FormView. What i need to do is when you insert a record pass the values from the TextBox (id is txtControl) within each row of the Repeater to my insert method. I have the following event handler for my ObjectDataSource's OnInserting event:

Code:
protected void objDocument_Inserting(object sender, System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs e)
{
    Hashtable values = new Hashtable();
    Repeater rptAttributes = (Repeater)fvwDocument.FindControl("rptAttributes");
    List<AttributesItem> attributes = this.GetAttributes();

    for (int i = 0; i <= attributes.Count - 1; i++)
    {
        values.Add(attributes[i].AttributeName, ((TextBox)rptAttributes.Items[i].FindControl("txtControl")).Text);
        }
    }

    e.InputParameters.Add("values", values);
}

The problem i have is that the Text property of txtControl keeps returning empty. The funny thing is that i had this working a while back but made some changes and now it no long works. Appreciate if someone could help. Thanks
 
Problem solved turns out it wasn't an error just me being stupid.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top