giligatech
asked on
FindControl() Doesn't work
Hi, I have 3 buttons:
<asp:Button runat="server" ID="btnSiteDiscount1" onclick="btnSiteDiscount1_ Click" />
<asp:Button runat="server" ID="btnSiteDiscount2" onclick="btnSiteDiscount2_ Click" />
<asp:Button runat="server" ID="btnSiteDiscount3" onclick="btnSiteDiscount3_ Click" />
On my PageLoad() i have this code:
int count = 0;
foreach (x in y)
{
count++;
Button btn = (Button)this.FindControl(" btnSiteDis count" + count);
btn.Text = "xxxxxxx";
}
The problem is that btn == null! why is that and how do I fix it?
Thanks
<asp:Button runat="server" ID="btnSiteDiscount1" onclick="btnSiteDiscount1_
<asp:Button runat="server" ID="btnSiteDiscount2" onclick="btnSiteDiscount2_
<asp:Button runat="server" ID="btnSiteDiscount3" onclick="btnSiteDiscount3_
On my PageLoad() i have this code:
int count = 0;
foreach (x in y)
{
count++;
Button btn = (Button)this.FindControl("
btn.Text = "xxxxxxx";
}
The problem is that btn == null! why is that and how do I fix it?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.