【问题标题】:CS0115: 'ASP.default_aspx.GetTypeHashCode()': no suitable method found to overrideCS0115:“ASP.default_aspx.GetTypeHashCode()”:找不到合适的方法来覆盖
【发布时间】:2017-03-07 19:54:46
【问题描述】:

我是 .Net 新手,我想创建一个按钮来从一个页面重定向到另一个页面。这是我的 C# 代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Drawing;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, System.EventArgs e)
    {

    }

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
        InitializeComponent();
        base.OnInit(e);
    }

    private void InitializeComponent()
    {

    }
    #endregion

    protected void Button2_Click(object sender, System.EventArgs e)
    {
        Response.Redirect("Default2.aspx", true);
    }
}

这是我的 .net 代码

        <button id="Button 2"  onclick="Button2_Click"  type=" button " runat="server ">   NEW Account</  button>

我的 aspx 文件名是默认值,我的 aspx.cs 文件名也是默认值。 谢谢!

【问题讨论】:

    标签: c# css asp.net


    【解决方案1】:

    在您的 default.aspx 页面中使用 asp 按钮。 &lt;asp:Button ID="Button2" runat="server" Text="New Account" OnClick="Button2_Click" /&gt;.

    【讨论】:

    • 我用过
      当我建立我的网站时,当我单击按钮时它只是刷新页面,它不会重定向到另一个。我必须在第二页上配置一些东西吗?
    猜你喜欢
    • 2019-11-05
    • 1970-01-01
    • 2019-07-07
    • 1970-01-01
    • 2018-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多