I have a series of controls 4 controls. 3 of which I need to disable onPageLoad not on PostBack.
Basically I need to cast the "object sender" onPageLoad and drill down to the the controls and set the
controlId.Visible = False;
I have tried many alternatives and I can't seem to figure out a way to disable them. I would use Javascript. Though that would introduce other facets that I don't want to deal with at the moment, as time is of the essence...
I want to do something similar to this, I do this on a btnAddToCart_Click Event
- protected void AddToCart_Click(object sender, CommandEventArgs e) {
-
-
//some other code...
-
-
-
LinkButton ctrl = (LinkButton)sender;
-
RepeaterItem rpItem = ctrl.NamingContainer as RepeaterItem;
-
if (rpItem != null) {
-
LinkButton btn = (LinkButton)rpItem.FindControl("btnRemoveFromCart");
-
btn.Visible = true;
-
btn = (LinkButton)rpItem.FindControl("btnAddToCart");
-
btn.Visible = false;
-
Image img = (Image)rpItem.FindControl("imgAdded");
-
img.Visible = true;
-
}
-
-
I would appreciate if someone would advise me on how to cast the sender into an object that I can work with and that has the references to the controls on the page that need to be altered (changing the img.Visibility = false)