---
title: "Substitution Control in ASP.Net"  
description: "The new  control gives you a placeholder into which you can write dynamic content when using output caching. The  Substitution control lets you create"  
author: "Pushpendra Singh"  
published: 2010-10-28  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/183/substitution-control-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Substitution Control in ASP.Net

The new <asp: substitution> control gives you a [placeholder](https://www.mindstick.com/forum/1519/how-do-i-remove-a-listbox-new-item-placeholder) into which you can write [dynamic content](https://www.mindstick.com/forum/158483/how-does-server-side-caching-interact-with-dynamic-content-or-user-specific-data-on-a-website) when using [output caching](https://answers.mindstick.com/qa/51751/what-is-output-caching-in-web-application). The Substitution control lets you create areas on the page that can be updated dynamically and then [integrated](https://www.mindstick.com/forum/33532/handler-pagehandlerfactory-integrated-has-a-bad-module-managedpipelinehandler-in-its-module-list) into a cached page.\

You can place a Substitution server control at the page [location](https://www.mindstick.com/news/2574/twitter-conveniently-reveals-a-location-sharing-policy-amid-elonjet-controversy) where content should be substituted, and set its MethodName [property](https://www.mindstick.com/articles/198559/an-ownership-of-property-in-hua-hin) to the [callback method](https://www.mindstick.com/forum/215/callback-method-in-jquery).

```
<asp:Substitution ID="Substitution1" runat="server" />
```

![Substitution Control in ASP.Net](https://www.mindstick.com/mindstickarticle/7a65e677-3f67-47b4-88ad-52c50db5ca3a/images/c6c4def6-0d20-4cde-a58a-8e04933a46b2.png)

![Substitution Control in ASP.Net](https://www.mindstick.com/mindstickarticle/7a65e677-3f67-47b4-88ad-52c50db5ca3a/images/8631bfd7-b44e-44c2-a8e2-783ee3258417.png)

```
<asp:Substitution ID="Substitution1" runat="server"    MethodName="GetCurrentDate"></asp:Substitution>  GetCurrentDate is a function.
```

Substitution control is used to call a method that returns a string in an output-cached page.

```
<script runat="server">     static string GetCurrentDate(HttpContext xyz)    {         return DateTime.Now.ToString();    }</script>
```

When we run above code the [current date](https://www.mindstick.com/forum/323/find-the-day-name-and-month-name-from-current-date) time will show on the page

![Substitution Control in ASP.Net](https://www.mindstick.com/mindstickarticle/7a65e677-3f67-47b4-88ad-52c50db5ca3a/images/19f7da05-d47c-4054-b8e7-6c58fb383ad3.png)

---

Original Source: https://www.mindstick.com/articles/183/substitution-control-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
