gpt4 book ai didi

c# - 当前上下文中不存在名称 "___"

转载 作者:太空宇宙 更新时间:2023-11-03 18:32:12 24 4
gpt4 key购买 nike

<分区>

我在 Visual Studio 2012 中的项目似乎有问题,我收到 21 个错误,指出名称(ddlstud、hidId、txtName、txtCoverImage、txtReldate、gvVidGame)在当前上下文中不存在。我将我的 default.aspx 文件设置为从我的 default.aspx.cs 文件中读取。

这是我的 default.aspx 文件

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="True" CodeBehind="Default.aspx.cs" Inherits="VideoGameWiki._Default" %>

<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">

</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<asp:GridView ID="gvVidGame" runat="server"></asp:GridView><br />
<asp:Label ID="lblName" runat="server" Text="Name: "></asp:Label>
<asp:TextBox ID="txtName" runat="server"></asp:TextBox><br />
<asp:Label ID="lblStud" runat="server" Text="Studio: "></asp:Label>
<asp:DropDownList ID="ddlStud" runat="server"></asp:DropDownList><br />
<asp:Label ID="lblReldate" runat="server" Text="Release date: "></asp:Label>
<asp:TextBox ID="txtReldate" runat="server"></asp:TextBox><br />
<asp:Label ID="lblCoverImage" runat="server" Text="Cover Image: "></asp:Label>
<asp:TextBox ID="txtCoverImage" runat="server"></asp:TextBox><br />
<asp:Label ID="lblDescr" runat="server" Text="Description: "></asp:Label>
<asp:TextBox ID="txtDescr" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Add" />
<br />
<asp:Button ID="btnNext" runat="server" Text="Next" OnClick="btnNext_Click" />
<input runat="server" id="hidId" type="hidden" />
<asp:Button ID="btnPrev" runat="server" OnClick="btnPrev_Click" Text="Prev" />
<asp:Button ID="Btn_delete" runat="server" Text="Delete" />
</asp:Content>

这是我的 default.aspx.cs 文件

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace VideoGameWiki
{
public partial class _Default : System.Web.UI.Page
{
private VideoGamesWikiContainer entities = new VideoGamesWikiContainer();

private int currentId = 0;
}
}

complete sources here

(编辑)这是我的 designer.cs 文件,因为不幸的是建议的方法不起作用。

 namespace VideoGameWiki {


public partial class _Default : System.Web.UI.Page
{

/// <summary>
/// gvVidGame 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.GridView gvVidGame;

complete sources here

如有任何帮助,我们将不胜感激!

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com