More in this section

Forums / Developing with Sitefinity / How to tell when in a DetailsView

How to tell when in a DetailsView

2 posts, 0 answered
  1. Mike
    Mike avatar
    208 posts
    Registered:
    10 Dec 2007
    05 Mar 2012
    Link to this post
    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

  2. Mike
    Mike avatar
    208 posts
    Registered:
    10 Dec 2007
    05 Mar 2012
    Link to this post
    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
2 posts, 0 answered