Home > DeveloperSection > Forums > Calling div from code behind c#
Jayden Bell
Jayden Bell

Total Post:105

Posted on    February-09-2014 11:13 PM

 C# C# 

 1 Reply(s)
 3143  View(s)
Rate this:

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")





Pravesh Singh

Total Post:411

Posted on    February-09-2014 11:43 PM

Hi Jayden,

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


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

Don't want to miss updates? Please click the below button!

Follow MindStick