Search code examples
c#htmlasp.netcode-behind

How to hide Literal in Codebehind within a ListView


I currently have a panel within a listview, displaying a bunch of literals. There is a column I need to hide in the codebehind of the page. How would I go about this? The panel that contains these literal fields has UpdateMode on always.

                    <div class="col-md-2 col-sm-3 col-sm-offset-0 col-xs-4 col-xs-offset-0 col-md-offset-0 text-truncate ">
                        <p class="key">
                            <asp:Literal ID="Literal4" runat="server" Text='' />
                        </p>
                        <p class="text-truncate">
                            <asp:Literal ID="Literal7" runat="server" Text=' <%# Eval("Status") %>' />
                        </p>
                    </div>


Solution

  • If you are aiming to hide them from the view, you can use the code behind as displayed in this answer

    Literal4.Visible = false;