j4rey89 j4rey89 - 2 months ago 18x
ASP.NET (C#) Question

How to check if Literal exists in server side?

I have 2 aspx pages that uses the same aspx.cs file using CodeFile

I have on one aspx page but not on the other aspx page.

On runtime I want to check if the Literal exist then set the value if it doesn't do nothing.


Did you try using FindControl method?

Literal l = FindControl("control id");

if(l != null)
    //do your processing