0
<blink>in condition i want to call div from html , which contains background image only, and I      need to call it on just few pages

with same metadata. So how will i call that div, i tried few ways but nothing helped me.

 if (cMeta != null && cMeta.Name == "background")
        {
            if (cMeta.Text == "Yes")
            { 
                Display(Div)
            }
        }

Thanks

1 Answer 1

3

Set runat="server" to div markup.

<div id="myDiv" runat="server"></div>

Now in code behind you can access the myDiv

private void DisplayDiv(bool isShow)
{
   myDiv.Visible = isShow;
}

Now when you want to show it then just call this function with true value

DisplayDiv(true);

otherwise just call it with false ,if you don't want to show it.

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

1 Comment

could you write down code pls ? And i getting error when i put runat in div markup

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.