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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:03:33+00:00 2026-05-23T17:03:33+00:00

<asp:FormView ID=FormView1 runat=server AllowPaging=True DataSourceID=SqlDataSource1 OnModeChanging=FormView1_ModeChanging> <EditItemTemplate> ID : <asp:Label ID=Label1 runat=server Text=Label></asp:Label> <br

  • 0
<asp:FormView ID="FormView1" runat="server" AllowPaging="True" 
        DataSourceID="SqlDataSource1" OnModeChanging="FormView1_ModeChanging">
        <EditItemTemplate>
            ID :
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            <br />
            CpuName :
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <br />
            Status :
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        </EditItemTemplate>
        <EmptyDataTemplate>
            There is no data.
        </EmptyDataTemplate>
    <ItemTemplate>
     <table>
      <tr>
        <td align="right"><b>ID: </b></td>       
        <td><%# Eval("Id") %></td>
      </tr>
      <tr>
        <td align="right"><b>CPUName:</b></td>     
        <td><%# Eval("cpuname") %></td>
      </tr>
      <tr>
        <td align="right"><b>Status</b></td>      
        <td><%# Eval("status") %></td>
      </tr>

    </table>        
    <asp:LinkButton CommandName="Edit" runat="server">Edit</asp:LinkButton>
    <asp:LinkButton CommandName="Insert" runat="server">Insert</asp:LinkButton>
    </ItemTemplate>
    <InsertItemTemplate>
     <table>
      <tr>
        <td align="right"><b>ID: </b></td>       
        <td>
            <asp:TextBox ID="txtFVID" runat="server"></asp:TextBox></td>
      </tr>
      <tr>
        <td align="right"><b>CPUName:</b></td>     
        <td>
            <asp:TextBox ID="txtFVName" runat="server"></asp:TextBox></td>
      </tr>
      <tr>
        <td align="right"><b>Status</b></td>      
        <td>
            <asp:TextBox ID="txtFVStatus" runat="server"></asp:TextBox></td>
      </tr>

    </table>        

    </InsertItemTemplate>
    </asp:FormView>

protected void FormView1_ModeChanging(object sender, FormViewModeEventArgs e)
    {
            if (e.NewMode == FormViewMode.Edit)
            {
                FormView1.ChangeMode(FormViewMode.Edit);
            }
            if (e.NewMode == FormViewMode.Insert)
            {
                FormView1.ChangeMode(FormViewMode.Insert);
            }

    }

I get the following error:-
FormView ‘FormView1’ must be in insert mode to insert a new record.

  • 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-05-23T17:03:34+00:00Added an answer on May 23, 2026 at 5:03 pm

    Add

    <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                    CommandName="New" Text="New" />
    

    into your <ItemTemplate>.

    And move your

    <asp:LinkButton CommandName="Insert" runat="server">Insert</asp:LinkButton>
        </ItemTemplate>
    

    to <InsertItemTemplate> where it belongs to.

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

Sidebar

Related Questions

I have this HTML. <asp:FormView ID=FormView1 runat=server DataSourceID=SqlDataSource1> <asp:FormView ID=FormView2 runat=server DefaultMode=Insert DataSourceID=SqlDataSource2> <asp:TextBox
I have FormView: <asp:FormView ID=fvReport runat=server AllowPaging=false OnModeChanging=fvReport_ModeChanging OnItemUpdating=fvReport_ItemUpdating DataKeyNames=id DataSourceID=ObjectReport> <ItemTemplate> <asp:LinkButton ID=lbEdit
I have FormView in my page markup: <asp:FormView ruanat=server ID=FormView1 DataSourceID=SqlDataSource1 OnDataBinding=FormView1_DataBinding OnDataBound=FormView1_DataBound> <InsertItemTemplate>
I have FormView: <asp:FormView ID=fvReport runat=server DefaultMode=ReadOnly AllowPaging=false OnModeChanging=fvReport_ModeChanging DataKeyNames=id> protected void fvReport_ModeChanging(Object sender,
I have the following code: <asp:FormView ID=PhotoFormView runat=server DataKeyNames=PhotoID DataSourceID=PhotoDataSource> <EmptyDataTemplate> No photo here.
<asp:UpdatePanel runat=server> <ContentTemplate> <div style=padding: 0px 45px 0px 45px> <asp:FormView ID=fvAccounts runat=server DataKeyNames=AccountId DataSourceID=edsAccounts
By default the FormView control creates html like : ID <asp:TextBox ID=IdTextBox runat=server Text='<%#
Greetings! I have a Repeater control that's using an XmlDataSource control. <asp:FormView id=myFormView runat=server
I've a link button: <asp:LinkButton ID=LinkButton2 runat=server CausesValidation=False Text=View PostBackUrl='<%# Eval(Name, ../Image/Uploaded/{0}) %>'> The
Is something like this possible? <asp:FormView ID=myFormView runat=server> <ItemTemplate> <p><%# XPath(Root/Path/Item[@id=<%=this.m_myId%>]/HelloWorld)%></p> </ItemTemplate> </asp:FormView> m_myId

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.