views:

39

answers:

2

Hi all,

I have used a label box to render a "please wait" message when the user clicks "Save" button. Once the processing gets over, the output gets displayed. My goal is to hide the label once the output is displayed. How do i achieve this.

My code is as follows,

 <label id="embedLabel" class="hide" runat="server" visible="false">Please Wait
 </label>  
 <div id="ChannelDIv" class="hide">  
 <textarea id="channellinkCode" runat="server" >  
 </textarea>  
 </div>

My goal is to hide the embedLabel label once the embedLabel is displayed. Am using javascript function on the click event of "save" button to show the embedLabel div. Any help would be deeply appreciated.

+1  A: 

If you're not using AJAX then when the output gets displayed the whole page will refresh (postback). So as long as the default state of your embedLabel is hidden (display:none or visibility:hidden) when this happens it will be hidden.

I can see that you have assigned it the css class hide, but you've also set visible="false" which means it'll never make it to the client at all.

I think you need to remove runat="server" and keep this as a client side label which you only manipulate through JavaScript and CSS (with default hidden) this should solve your problem.

m.edmondson
A: 

You can write code that change css class assigned to message label in javascript onLoad() event handler, so after your page is completly rendered it will hide message label.

edit:

<body onload = "hideMessage()" >

<script type="text/javascript" language="JavaScript">

function hideMessage() {
     document.getElementById('embedLabel').style.display = 'none'
} 

</script>

that's what was on my mind when i posted answer, but i agree with Eddy556 that you dont really need it. I missunderstanding yours question initially.

zgorawski
can u elaborate your suggestion zgorawski?
jithin
Instead of doing that why not just set it as hidden - no need to do anything on page load.
m.edmondson