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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:33:33+00:00 2026-06-04T03:33:33+00:00

I’m trying to write a basic ASP.NET form (using Visual Studio 2010) to submit

  • 0

I’m trying to write a basic ASP.NET form (using Visual Studio 2010) to submit numbers to a database. Because this is a very early attempt for me to use ASP.NET, I wrote it very simply at first and now I am trying to add the remaining features. Originally, everything was all inline code. Now I am trying to switch it to use a codebehind page, but I cannot get it to resolve the names of my textboxes from within my codebehind file. I built these pages while following some tutorials, and have looked at several other sources to try to fix this, but everything I’ve seen so far seems to indicate that I have it all set for a codebehind, yet it doesn’t work. VS gives errors during compile, stating the textbox names do not exist in the current context. When I remove all references to the textboxes, the page works and my button event fires. For grins I added references to the textboxes in the codebehind, like so protected TextBox XcoordTextbox; (like I believe you would in ASP.NET 1.0) but then I get a runtime error CS0102: The type 'ManualEntry.default_aspx' already contains a definition for 'XcoordTextbox'
Below are the significant portions of my code. Can you help explain why this doesn’t work?

ASPX file

<%@ Page    Language="C#" CodeFile="default.aspx.cs" Inherits="ManualEntry.default_aspx" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"></head>
<body>
    <form id="HtmlForm" runat="server">
        <div>
            X Coord&nbsp;
            <asp:TextBox ID="XcoordTextbox" runat="server"></asp:TextBox>
            <br />
            Y Coord&nbsp;
            <asp:TextBox ID="YcoordTextbox" runat="server"></asp:TextBox>
            <asp:Button ID="SubmitButton" runat="server" onclick="SubmitButton_Click" Text="Submit" />
        </div>
    </form>
</body>
</html>

Codebehind file

using System;
using System.Web.UI;

namespace ManualEntry
{
    public partial class default_aspx : Page
    {
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            var Xcoord = XcoordTextbox.Text;
            var Ycoord = YcoordTextbox.Text;
            //More Code Here
        }
    }
}
  • 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-04T03:33:34+00:00Added an answer on June 4, 2026 at 3:33 am

    go to Microsfot.NET[.NET version]\Temporary ASP.NET Files. and delete temparary files for your web site.

    e.g for .net 4.0

    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
    

    if you use CodeFile directive then compiled files goes to Temporary ASP.NET Files

    And also delete bin and object folders from your solution and rebuild the web application.

    EDIT

    your default.aspx.designer.cs should look like below, don’t add controls to this page manually.

    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated by a tool.
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated. 
    // </auto-generated>
    //------------------------------------------------------------------------------
    
    namespace ManualEntry {
    
    
        public partial class default_aspx {
    
            /// <summary>
            /// Head1 control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
    
            /// <summary>
            /// HtmlForm control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.HtmlControls.HtmlForm HtmlForm;
    
            /// <summary>
            /// XcoordTextbox control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.WebControls.TextBox XcoordTextbox;
    
            /// <summary>
            /// YcoordTextbox control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.WebControls.TextBox YcoordTextbox;
    
            /// <summary>
            /// SubmitButton control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.WebControls.Button SubmitButton;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a program with Visual Basic 2010. The problem is
I am trying to write a Windows Form and ASP.NET C# front-end and MSAccess
I am trying to write a program in Visual Basic (with VS 2010) that
I'm basically trying to write a basic converter in visual studio 2008, and I
I'm trying to write a basic drawing widget using the Tkinter library. The very
I have a c# app and I'm trying to write a basic login form
I am trying to write a simple C calculator script, using only the basic
I am trying to write a basic camera app using the auto-focus feature to
I am trying to write a very basic registration module for blueimp.net's AjaxChat. I
I am trying to write an excel visual basic macro. My Problem is that

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.