Reputation: 5343
i have a link button to remove the selected value in the user control. If we are adding value to the control means i have to make this link button visible. so i am passing the client id of the link button to the user control and saving that id in a hidden control in the User control. and one i select the value in the user control im making the link button visible.
Problem:
If the link button visibility false means unable to access the control.
var removeUser = document.getElementById(elementRemoveUser.value); returns null. if the control is visible means it is working fine.
var elementRemoveUser = document.getElementById("<%=hdnRemoveUser.ClientID %>");
if (elementRemoveUser.value != '') {
var removeUser = document.getElementById(elementRemoveUser.value);
if (removeUser != null) {
removeUser.style.visibility = "visible";
}
}
Upvotes: 0
Views: 3172
Reputation: 13813
You should use style="display:none;
property instead of making the control invisible by Visible = False
Using display:none
hides the element, but the HTML element is still there in the source so you will have access to the control. But, Visible = False
removes the HTML element altogether.
Upvotes: 3