按钮单击事件不执行对IIS [英] Button Click Event not Executing on IIS

查看:87
本文介绍了按钮单击事件不执行对IIS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是很奇怪!下面code正常运行时F5'ed在VS2010但是当我IIS7的服务器上运行按钮单击事件不火!我不能为我的生活想出解决办法!这里的code:

This is very strange! The below code runs correctly when F5'ed in VS2010 but when I run it on the IIS7 server the button click event doesn't fire! I can't for the life of me figure this out! Here's the code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="_default" %>

<!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">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <div>
        Hi World!<br />
        <br />
        <br />
        <asp:Button ID="button1" Text="Click Here" runat="server" OnClick="button1_Click" />
        <br />
        <br />
        <asp:Button ID="Button3" runat="server" onclick="Button3_Click" Text="Button" />
        <br />
        <br />
        <asp:TextBox ID="results" runat="server" TextMode="MultiLine" Height="350px" Width="500px"></asp:TextBox>
    </div>
    </form>
</body>
</html>

这里的codeFILE:

Here's the CodeFile:

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

public partial class _default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.results.Text += "In Page_Load ";
    }

    protected void button1_Click(object sender, EventArgs e)
    {


        this.results.Text += "Hello! ";

        return;
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        this.button1_Click(sender, e);
        return;
    }
}

的Page_Load()不运行,但不是的button1_Click()。谢谢你在前进。

Page_Load() does run, but not button1_Click(). Thank you in advance.

推荐答案

您可能还需要删除您 web.config中的 runAllManagedModulesForAllRequests 设置如果您有它(或将其设置为false)。

You may also need to remove the runAllManagedModulesForAllRequests setting from your web.config if you have it (or set it to false).

这篇关于按钮单击事件不执行对IIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆