Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:16:54+00:00 2026-06-04T19:16:54+00:00

I have a DetailsView in Insert mode: <asp:CommandField ShowInsertButton=True ButtonType=Button ControlStyle-CssClass=myButton InsertText=My Insert text

  • 0

I have a DetailsView in Insert mode:

<asp:CommandField ShowInsertButton="True" ButtonType="Button" ControlStyle-CssClass="myButton" InsertText="My Insert text" />

Both buttons Insert/Cancel get the same style, of course.

Is it possible to style these two separately to be one Blue and one Yellow?

In FormView you can define the buttons separately like this:

<asp:Button CommandName="Insert" Text="Insert" class="myButtonStyle1"  ID="myButtonID1" runat="server" CausesValidation="True" />

<asp:Button CommandName="Cancel" Text="Cancel" class="myButtonStyle2"  ID="myButtonID2" runat="server" CausesValidation="False" />

Is there anything similar for DetailsView?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:16:56+00:00Added an answer on June 4, 2026 at 7:16 pm

    The easiest solution would be to convert your “New, Insert, Cancel” CommandField into a TemplateField. If you using the WYSIWYG editor, there is a button for this above the OK button. This will generate the following (censored) code that you can easy style.

            <asp:TemplateField ShowHeader="False">
                <InsertItemTemplate>
                    <asp:Button ID="LinkButton1" runat="server" CssClass="insertButton" CausesValidation="True" CommandName="Insert" Text="Insert" />
                    &nbsp;<asp:Button ID="LinkButton2" runat="server" CssClass="cancelButton" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                </InsertItemTemplate>
            </asp:TemplateField>
    

    NOTE: I added the CssClass attribute to the Buttons below with the CSS class names “insertButton, cancelButton”, that can all be configured in your style sheet.

    More notes:

    1. When buttons are needed (NOT linkButtons) do not use the closing tag
      (</asp:button>) – replace it with an inline / mark. Otherwise, it won’t work.

    2. When using Insert only mode, the censored ItemTemplate is not
      needed — remove it.

    3. Avoid having a ControlStyle control, otherwise it may cause class overrule.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so i have a DetailsView like so... <asp:DetailsView DataSourceID=sqldsNewItem CssClass=marginLeftRightBottom10px DefaultMode=Insert FieldHeaderStyle-CssClass=dwHeader GridLines=None
I have a DetailsView like this: <asp:DetailsView ID=detailsView1 runat=server DataSourceID=edsdetailsView AutoGenerateRows=False CssClass=pretty-table> <Fields> <asp:TemplateField
<asp:DetailsView ID=DetailsView1 runat=server DataSourceID=SqlDataSource1 AutoGenerateRows=False DataKeyNames=ID DefaultMode=Insert > ... <asp:TextBox ID=ShortExcerptTextBox runat=server Text='<%#Bind(ShortExcerpt) %>'
I have a control that look something like this: <asp:DetailsView ID=dvUsers runat=server DataSourceID=odsData DataKeyNames=Id>
For ASP.NET, I'm using a DetailsView for insert and edit of a record. For
Am using VS2008 ASP.Net Web Forms have a detailsview, databound to web service reference
I have 2 DetailsView. The first one is hidden (display:none) with DefaultMode=Insert, has RequiredFieldValidator
I have the following detailsview in my asp.net web application. What it should show
My problem is like this: In ASP DetailsView component we have three different EventArgs
In my asp.net application,I want to use the detailsview to show/insert/update data in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.