Hide a column in ASP.NET Dynamic Data

前端 未结 2 718
情书的邮戳
情书的邮戳 2020-12-17 17:02

Is there any way to apply an attribute to a model file in ASP.NET Dynamic Data to hide the column?

For instance, I can currently set the display name of a column lik

相关标签:
2条回答
  • 2020-12-17 17:29

    A much, much easier method: If you want to only show certain columns in the List page, but all or others in the Details, etc. pages, see How do I hide a column only on the list page in ASP.NET Dynamic Data?

    Simply set AutoGenerateColumns="false" in the GridView control, then define exactly the columns you want:

    <Columns>
    ...
    <asp:DynamicField DataField="FirstName" HeaderText="First Name" />
    <asp:DynamicField DataField="LastName" HeaderText="Last Name" />
    </Columns>

    0 讨论(0)
  • 2020-12-17 17:38

    Had no idea what ASP.NET Dynamic Data was so you promted me to so some research :)

    Looks like the property you are looking for is

    [ScaffoldColumn(false)]
    

    There is also a similar property for tables

    [ScaffoldTable(false)]
    

    source

    0 讨论(0)
提交回复
热议问题