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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing for a particular control within a Repeater Footer

Status
Not open for further replies.

DJVisuaL

Programmer
May 31, 2000
52
US
How can I test for a certain control within a repeater footer to change one of its attributes? here is what I tryed and it didn't work:

Code:
    protected void Repeater1_ItemCreated(object sender, RepeaterItemEventArgs e)
    {
if (e.Item.ItemType == ListItemType.Footer)
        {
            if (e.Item.ID == "ListMinusImageButton")
            {
                if ((int)ViewState["ListCount"] > 0)
                {
                    e.Item.Visible = true;
                }
                else
                {
                    e.Item.Visible = false;
                }
            }
            else if (e.Item.ID == "ListAddTextBox")
            {
                TextBox tb = (TextBox)e.Item.FindControl("ListAddTextBox");
                tb.Text = "";
            }
        }
    }
I'm guessing the test e.Item.ID == ... is not right but I have looked for an example and can't find how to test which control has just been created.
 
You can't find which control has just been created. e.Item refers to the row of the repeater. So you will have to use findconrol as you are doing to manipulate the controls you want.
 
OK I was confused with items and controls.
So the item has been created meaning the row so you should be able to access any control on the row in the ItemCreated event.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top