Hide Panel as soon as button is clicked.

T

TheDude5B

Hi,

I have one .net page which processes a form and then displays the
result. The coding which takes place in order to process the form
takes a while so I want to have some sort of display to the user.

So what I want is that as soon as the button has been clicked, the
Panel holding the form is hidden and then another panel is shown with
a gif image that looks like a loading image.

Just now when I want to do this, the code has to complete before the
Panel is hidden.

Thanks
 
G

Guest

Howdy,

Example:

<asp:panel runat="server" ID="processingPanel" Style="position:absolute;
width:300px;display:none">
Processing...<img />
</asp:panel>

<asp:panel runat="server" ID="formPanel">
<asp:TextBox runat="server" ID="txtSomeData"/>
<asp:Button runat="server" ID="btnProcess"
OnClientClick="ShowProcessingPanel()"
Text="Process" OnClick="btnProcess_Click"/>
</asp:panel>

<script type="text/javascript">
<!--
function ShowProcessingPanel()
{
var formPanel = document.getElementById('<%=formPanel.ClientID %>');
var processingPanel = document.getElementById('<%=processingPanel.ClientID
%>');

formPanel.style.display = 'none';
processingPanel.style.display = 'block';

return true;
}
//-->
</script>

<script runat="server">
protected void btnProcess_Click(object sender, EventArgs e)
{
// simulate long processing on the server
System.Threading.Thread.Sleep(500);
}
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top