gruber
gruber

Reputation: 29729

Make ID field invisible in detailsView

I would like to know how can I easily customize my detailsView that when it is in Create mode ID field should be invisible

I can rememebr that it was sth like visible = <% code here ... (IsCreated ??)

here is an example:

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="myDS"
    Width="50%" DataKeyNames="MyId">
    <Fields>
        <asp:TemplateField HeaderText="Id" SortExpression="MyId">
            <ItemTemplate>
                <asp:Label ID="xxx" runat="server"  Text='<%# Bind("MyId") visible=" **(if create mode than invisible else visible)** %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
    </Fields>
</asp:DetailsView>

thanks for help

Upvotes: 0

Views: 388

Answers (1)

Kamran Khan
Kamran Khan

Reputation: 9986

Try:

Visible="<%# this.IsCreated %>"

Upvotes: 2

Related Questions