locked
Show column in grid, but not in detailsview RRS feed

  • Question

  • User1980140492 posted

    The question is no more, no less than the title states :)

    How To:
    Show a certain column in the gridview, but not in the detailsview ( formview ).

    Thanks in advance,
    - Yannick

    Wednesday, July 20, 2011 6:11 AM

Answers

  • User-330204900 posted

    Hi Yannick try this

    /// <summary>
    /// Determines whether the specified column is hidden.
    /// </summary>
    /// <param name="column">The column.</param>
    /// <param name="currentPage">The current page.</param>
    /// <returns>
    /// 	<c>true</c> if the specified column is hidden; otherwise, <c>false</c>.
    /// </returns>
    public static Boolean IsHidden(this MetaColumn column, PageTemplate currentPage, ContainerType containerType)
    {
        var hideIn = column.GetAttribute<HideColumnInAttribute>();
        if (hideIn != null && (hideIn.PageTemplate & currentPage) == currentPage)
        {
            if ((hideIn.PageTemplate & currentPage) == PageTemplate.List &&
                containerType == ContainerType.Item)
                return false;
            else
                return true;
        }
        else
            return false;
    }

     I'll send you the sample also directly.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, July 30, 2011 8:13 AM

All replies

  • User-1360095595 posted

    Include it in the field list of the grid, but not the detailsview.

    Wednesday, July 20, 2011 7:01 AM
  • User-330204900 posted

    Hi Yannick, is this for List and Details page or are we talking about ListDetails page?

    Wednesday, July 20, 2011 9:34 AM
  • User1980140492 posted

    Listdetails

    Wednesday, July 20, 2011 9:42 AM
  • User-330204900 posted

    OK I'll see if I can do a modification on my HideColumnIn sample for you

    Wednesday, July 20, 2011 11:42 AM
  • User3866881 posted

    Hello OP:)

    Maybe I think you can also use js or jQuery to hide the whole column and its' cells of DetailsView.

    Thx

    Monday, July 25, 2011 9:58 PM
  • User1980140492 posted

    Hey Stephen,

    Don't want to stress you or something :D , but I was wondering if you happen to have an update on this matter?
    It's one of those things on my requirement list which are a big questionmark for me :)

    Anyway, thanks in advance as always!

    Best regards,
    - Yannick

    Friday, July 29, 2011 6:28 AM
  • User-330204900 posted

    Hi Yannick, sorry I forgot to add a reminder on this one I will look at it this morning it should only be a small tweak.

    Saturday, July 30, 2011 7:41 AM
  • User-330204900 posted

    Hi Yannick try this

    /// <summary>
    /// Determines whether the specified column is hidden.
    /// </summary>
    /// <param name="column">The column.</param>
    /// <param name="currentPage">The current page.</param>
    /// <returns>
    /// 	<c>true</c> if the specified column is hidden; otherwise, <c>false</c>.
    /// </returns>
    public static Boolean IsHidden(this MetaColumn column, PageTemplate currentPage, ContainerType containerType)
    {
        var hideIn = column.GetAttribute<HideColumnInAttribute>();
        if (hideIn != null && (hideIn.PageTemplate & currentPage) == currentPage)
        {
            if ((hideIn.PageTemplate & currentPage) == PageTemplate.List &&
                containerType == ContainerType.Item)
                return false;
            else
                return true;
        }
        else
            return false;
    }

     I'll send you the sample also directly.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, July 30, 2011 8:13 AM