How to tell when in a DetailsView

Posted by Community Admin on 04-Aug-2018 08:36

How to tell when in a DetailsView

All Replies

Posted by Community Admin on 05-Mar-2012 00:00
Hi,

Hopefully a simple question:  I have a control that is unrelated to a custom module I've created, and it sits on the same page as the public view of the module.  But I'd like to hide this control when the page is in a details view...how can I tell when the page is displaying the details view?  If I was in the context of the module public control, I'd do something like:

this.Parent.Parent as MyCustomModule.Web.UI.Public.DetailsView

Thanks in advance,
Mike

Posted by Community Admin on 05-Mar-2012 00:00
Oh,  heck, that turned out to be easy...in my particular case, all I needed was this:

if (this.Page.RouteData.Values.ContainsKey("Params"))

That tells me I'm on a DetailView, since my other control uses Query RouteData.  Dunno why I didn't think of that right away.  :)

Regards,
Mike
This thread is closed