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 8945439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:14:44+00:00 2026-06-15T12:14:44+00:00

We are working with an ASP.Net DetailsView with a VB.Net code-behind file. We are

  • 0

We are working with an ASP.Net DetailsView with a VB.Net code-behind file. We are trying to allow the user to edit and save changes in the DetailsView by allowing the user to click the Edit button and then click the Update button.

Nothing happens when the user clicks the Edit button so we added an OnClick handler for the Edit button. The DetailsView will go into edit mode but only if the user clicks the Edit button twice. (Maybe an ASP.Net bug?)

Once the DetailsView is in Edit mode the Update and Cancel buttons are displayed as expected but nothing happens when the user clicks either of those buttons. We placed an OnClick on the Update button in an attempt to force the DetailsView to Update but the only choices for .ChangeMode(DetailsViewMode. are Edit, Insert, ReadOnly.

I also thought DetailsViews did not need additional OnClicks unless we needed to perform special handling.

Here is the markup for the DetailsView:

<asp:DetailsView 
    ID="DetailsView" 
    runat="server" 
    Height="50px" 
    Width="218px" AutoGenerateRows="False">

    <Fields>

        <asp:TemplateField ShowHeader="False">

            <EditItemTemplate>
                <asp:Button ID="ButtonUpdate" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" OnClick="ButtonUpdate_Click"  />
                &nbsp;<asp:Button ID="ButtonCancelUpdate" runat="server" CausesValidation="False" 
                    CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>

            <ItemTemplate>
                <asp:Button ID="ButtonEdit" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Edit" OnClick="ButtonEdit_Click"/>
            </ItemTemplate>
        </asp:TemplateField>

        <asp:BoundField DataField="Forename" HeaderText="First Name:" />
    </Fields>
</asp:DetailsView>

Here is the coding in the code-behind file:

Public Class StudentDetailsMaintenance
    Inherits System.Web.UI.Page

    Dim theTableAdapter As New DataSetSingleStudentTableAdapters.StudentsMaintenanceTableAdapter

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ' Load the data from the database into the DetailsView.
        '------------------------------------------------------
        DetailsView.DataSource = theTableAdapter.GetDataByStudentID(StudentMaintenance.IntStudentID)
        DetailsView.DataBind()
    End Sub

    Protected Sub ButtonEdit_Click(sender As Object, e As EventArgs)

        ' Place the DetailsView into Edit mode.
        '--------------------------------------
        DetailsView.ChangeMode(DetailsViewMode.Edit)
    End Sub

    Protected Sub ButtonUpdate_Click(sender As Object, e As EventArgs)

        ' Place the DetailsView into Update mode.
        '----------------------------------------
        DetailsView.ChangeMode(DetailsViewMode.)
    End Sub
End Class

The ButtonUpdate_Click routine is incomplete because we don’t know how to get the DetailsView to do the update.

Addional Note:
This is the first time we are trying to do a DetailsView by not setting up a DataSource in the markup. Instead of doing that we are using the data from a DataSet TableAdapter created in the DataSet designer.

If we did the DetailsView along with the DataSource all in the markup then the Edit and Update buttons work without any problem. We were also doing this in an attempt to eliminate extra coding if possible.

  • 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-15T12:14:45+00:00Added an answer on June 15, 2026 at 12:14 pm

    Well, looking real briefly, try wrapping your Page_Load databind in an If Not Page.IsPostback.

    Postback wreaks havoc on databound controls.

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

Sidebar

Related Questions

I have an asp.net page with a c# code-behind. I am trying to have
working with: ASP.net using VB.net connecting to MS SQL Server What I'm trying to
I´m working with ASP.NET MVC and went through some code and the syntax below
I just began working with ASP.NET and I'm trying to bring with me some
Working with asp.net, and I am trying to find a way to change default
While working with ASP.NET using Visual Studio (2008) I have discomfort issue: source code
I am working on ASP.NET application where I am reusing a user control. The
I am working with ASP.NET MVC. I need local time depending on user IP
I am working in asp.net vb and I am trying to get a variable
I am working with ASP.net. I am trying to call a method that exists

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.