Ada
Ada

Reputation: 13

How to hide AspxTextBox?

On a radio button checked event, I hide the div by

document.getElementById("AltYukleniciDiv").style.visibility = 'hidden';

But, when I use it for an aspxTextBox, it doesn't hide it. Or when I use the ClientInstanceName instead of document.getElementById(" ")

UnvanText.SetVisible(false);    this didn't work either. UnvanText is ClientInsanceName.

javascript crashes there. I put an allert after that and it never shows it. I have to do it because I hide a div, including everything in it, but it still shows the textboxes that has validation. I don't know how it is possible. Can you tell me a way to hide them all? It used to hide the div with all of its contents before I make some validation settings.

Upvotes: 0

Views: 1316

Answers (2)

Ahmed Khalaf
Ahmed Khalaf

Reputation: 1220

you can add a CssClass attribute to that text box then use it to find the element and hide it.

You can consider using jQuery, so you need to write a single line of code:

$(".MyHideClass").hide();

or set attribute style display:none

I can advice using Firebug (FF Extension) for debugging javascript

Upvotes: 0

Oliver
Oliver

Reputation: 11617

It sounds like asp.net is being 'helpful' and changing the IDs of your elements.

Give the text box the attribute ClientIdMode="Static", and it might fix it.

Upvotes: 1

Related Questions