0
LinkButton lnkBtnRemove = (LinkButton)Repeater1.Items[0].FindControl("lnkRemove");

            lnkBtnRemove.Visible = false;

i used above code to make visible false of a link button i have placed in a repeater control.but it gives me a error of

"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"

i'm trying use this code in Page_Load.Pls help....

4
Contributors
4
Replies
9
Views
7 Years
Discussion Span
Last Post by arun1123
0
LinkButton lnkBtnRemove = (LinkButton)Repeater1.Items[0].FindControl("lnkRemove");

            lnkBtnRemove.Visible = false;

i used above code to make visible false of a link button i have placed in a repeater control.but it gives me a error of

"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"

i'm trying use this code in Page_Load.Pls help....

I think, the issue can be that none has been found. So the lnkBtnRemove is not initialized.

0

You can find more easily in repeater control

For TextBox write this
string str1 = ((TextBox)e.Item.FindControl("TextBox1")).Text;

and for label write this
((Label)e.Item.FindControl("Label1")).Visible = true;

for link write this
((LinkButton)e.Item.FindControl("LinkEdit")).Visible = true;

use it it will definitively work and to view more detail on repeater control see here

Edited by Ezzaral: Snipped promotion link.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.