---
title: "Calling div from code behind c#"  
description: "Calling div from code behind c#"  
author: "Jayden Bell"  
published: 2014-02-09  
updated: 2014-02-09  
canonical: https://www.mindstick.com/forum/1962/calling-div-from-code-behind-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Calling div from code behind c#

I want to call div from [html](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript) , which contains [background image](https://www.mindstick.com/forum/539/css-background-image-properties-not-work-in-outlook) 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](https://www.mindstick.com/forum/33922/how-to-use-null-coalescing-operator-in-c-sharp) &[amp](https://www.mindstick.com/forum/156207/what-is-amp);& cMeta.Name == "background")

{

if (cMeta.Text == "[Yes](https://www.mindstick.com/forum/157763/how-to-return-yes-no-based-on-date-comparison-in-sql)")

{

Display(Div)

}

}

## Replies

### Reply by Pravesh Singh

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

DisplayDiv(true);

otherwise just call it with false ,if you don't want to show it.


---

Original Source: https://www.mindstick.com/forum/1962/calling-div-from-code-behind-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
