c# - check the url of current page in if statement -


Then I have this button that appears on many pages which are the leaders for all parents. But now - I'm still showing the button when I reach the parent page. When I want to hide / hide the button on the parent page

Is it possible that I can see my current page URL and to see if this is the original page?

  & lt; An id = "element" href = "/ pages / @ViewBag.ElementId" class = "btn" & gt; & Lt; I & gt; Home and lt; / I & gt; & Lt; / A & gt;  

Consider using an I statement around the tag

If you wanted to check your code in the code behind the page, you can always execute the code below during the page load event.

  if (Path.GetFileName (Request.Url.LocalPath) == "ParentPage .aspx") {element.visible = false; } And {element.visible = true; }  

Comments