is there a way asp.net to trigger whether to display a fieldset?
I am creating a program with asp.net c#, i am using multiple gridviews to show different criteria of data on 1 page, each of these criteria has a title,
Now, if one of the gridviews happens to have no dat开发者_如何转开发a it will not show, however the title of the gridview will still be there as it is purely html fieldset and legend.
Are there any functions i could use to trigger the visibility of the title from the c# code?
Thanks (screenshot below)
You can add runat="server"
to fieldset and set Visible = true
or false
as usual (of course you need to set an ID, too).
You can surround each grid in an <asp:Panel... with a visibility on the panel set to a server based property (e.g. Visibility=<%# RecordsReturnedGreaterThanZero %>
so that the panel will only render the contents if there are some records returned in your query. Simply provide a property in your codebehind that acts as the boolean operator
精彩评论