0
votes

Need help adding a pre render event to repeater control to change a value of a text box which is placed inside that repeater control.

how to write code behind for this? I started like this

protected void rptServices_PreRender(object sender, EventArgs e) { } how to access the text box with in that repeater control and assign a new value to it

1

1 Answers

0
votes

You can add this to your event to loop the items in the repeater finding the textbox you need and making the edits needed.

foreach (RepeaterItem item in rptServices.Items)
{
    if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
    {
       var textbox = (TextBox)item.FindControl("tbx");

       //Do something with your textbox
       textbox.Text = "Test";
    }
}