0

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";
            }
        }
3
  • 1
    use 'display : none' instead of 'Visible = false' Commented Jul 2, 2012 at 4:45
  • 3
    Thank Pavankumar. pls make it answer to accept it. Commented Jul 2, 2012 at 5:20
  • Use Backbone.js or another related Javascript framework. It will make your life so much easier. Commented Jul 3, 2012 at 4:45

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.