Solved

detailsview show cancel button not working

Posted on 2007-11-30
6
1,109 Views
Last Modified: 2010-05-18
I have a detailsview (see attached code) if i show the delete button, the cancel button does not appear even if is set to true; if I disable the delete button, then the cancel button appears again.

how to have the 3 button on the same row ?
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"

        DataKeyNames="PhotoId" DataSourceID="ObjectDataSourceDetailsView" HorizontalAlign="Center" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" Width="500px" meta:resourcekey="DetailsView1Resource1">

        <Fields>

            <asp:BoundField DataField="PhotoId" HeaderText="PhotoId" InsertVisible="False"

                ReadOnly="True" SortExpression="PhotoId" meta:resourcekey="BoundFieldResource1" />

            <asp:ImageField DataImageUrlField="Percorso" HeaderText="Photo" ReadOnly="True" meta:resourcekey="ImageFieldResource1">

                <ControlStyle Height="20%" Width="20%" />

            </asp:ImageField>

            <asp:BoundField DataField="Categoria" HeaderText="Categoria" SortExpression="Categoria" meta:resourcekey="BoundFieldResource2" />

            <asp:BoundField DataField="Percorso" HeaderText="Percorso" ReadOnly="True"

                SortExpression="Percorso" Visible="False" meta:resourcekey="BoundFieldResource3" />

            <asp:BoundField DataField="Titolo" HeaderText="Titolo" SortExpression="Titolo" meta:resourcekey="BoundFieldResource4" />

            <asp:BoundField DataField="Descrizione" HeaderText="Descrizione" SortExpression="Descrizione" meta:resourcekey="BoundFieldResource5" />

            <asp:BoundField DataField="PhotoDate" DataFormatString="{0:dd/MM/yyyy}"

                HeaderText="PhotoDate" SortExpression="PhotoDate" HtmlEncode="False" ApplyFormatInEditMode="True" ReadOnly="True" meta:resourcekey="BoundFieldResource6" />

            <asp:CommandField ButtonType="Button" ShowEditButton="True" ShowCancelButton="True" ShowDeleteButton="True" meta:resourcekey="CommandFieldResource1" >             

            </asp:CommandField>

        </Fields>

        <RowStyle HorizontalAlign="Left" VerticalAlign="Middle" BackColor="#EEEEEE" ForeColor="Black" />

        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />

        <EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />

        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />

        <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />

        <AlternatingRowStyle BackColor="Gainsboro" />

    </asp:DetailsView>

Open in new window

0
Comment
Question by:brillox
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:digitalZo
Comment Utility
I haven't used DetailsView but if I'm not mistaken, the Cancel button will show up in EDIT mode when used along with Delete button.

If you want to show three buttons in a row, you can use the button field.
0
 

Author Comment

by:brillox
Comment Utility
yes exactly, but in my case does not show up
0
 

Author Comment

by:brillox
Comment Utility
I tried the button field and it works fine, but it render onto another row (<tr>)
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Accepted Solution

by:
digitalZo earned 250 total points
Comment Utility
You can use button field for all the three buttons. And set the default ones as False. but ofcourse this doesnt solve the problem of why the default ones are working properly.
0
 

Author Closing Comment

by:brillox
Comment Utility
I had the insertbutton set to true but the showedit button set to false; I set the insertbutton property to false as I do not need to insert and now it works fine, the cancel button appears again in edit mode
0
 
LVL 10

Expert Comment

by:digitalZo
Comment Utility
Glad you worked it out. :)

There's a typo in my previous post. It should be: why the default ones are NOT working properly. lol ;)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to Popup 37 78
varchar (max) 5 28
ASP.net GridView with totals at the bottom 2 22
Asp/Net Validation date Issue 9 36
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now