0

I have this div which is hidden originally:

<div id="loading" class="window">
    <img src="../Images/test.gif" />
</div>

How can I call this div to be shown while a thread is running

Thread thread = new Thread(test);
thread.Start()

private void test()
{
//code to see div
}

edit: I want the div to appear on top of the page so user wont be able to click on anything else

3 Answers 3

1

add runat="server" attribute inside div. by this div will work like server control and you can access this in code behind and add attribute

private void test()
{
    loading.Attributes.Add("style", "display:block;");
}
Sign up to request clarification or add additional context in comments.

Comments

0

UPDATE

Remove the display:none from the class and replace the div with an ASP.NET control:

<asp:Panel ID="loading" CssClass="window" runat="server" Visible="false">
    <img src="../Images/test.gif" />
</asp:Panel>

Then:

private void test()
{
    loading.Visible = true;
}

2 Comments

Thanks, but I want a div not a panel to be visible on top of everything so that user cannot click on anything else
A Panel will render as a div. There's absolutely no difference between them.
0

add runat="server" to your div, then access it in the code like: this.yourDivId and you can show it like this.yourDivId.Visible = true;

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.