我的活动均不会触发(已解决) [英] None Of My Events Will Fire (SOLVED)

查看:48
本文介绍了我的活动均不会触发(已解决)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已找到解决方案:

如果重要的话,网页使用Master.

显然,重要,如果所讨论的母版页(从上面强制执行)包含自己的形式.嘘.

尽管下面的说明说让我们努力帮助开发人员,而不是让他们感到愚蠢,但有些事情却因敲打开发人员的面孔而大声喊叫.在我之后重复一遍:如果页面上有两个窗体, ASP.NET不喜欢它. *

*是的,可以.但是它们不能嵌套,只有一个可以设置"runat = server".

[如果其他人也遇到同样的情况,问题将保留不变.]

无论如何,我的活动均未触发.

如果在页面上放置一个Button,则可以双击它,它将在.cs文件中创建Button_Click骨架.

我可以进入.cs文件,并让intellisense让我从相应的.aspx页中选择Button(或其他按钮),以便它们似乎相互连接.设计器页面也具有所有正确的声明.

但是在运行时(本地调试),无论我多么努力地单击按钮,事件都不会触发.或删除下拉列表.还是什么.

这是aspx页面的顶部:

The solution has been found:

The web pages use a Master, if that matters.

Apparently, it does matter, if the MasterPage in question (mandated from above) contains a form of its own. Sheesh.

Despite the instructions below which say Let''s work to help developers, not make them feel stupid, some things just cry out for slapping the developer in the face a few times. Repeat after me: ASP.NET doesn''t like it if there are two Forms on the page.*

*Well, yes, you can. But they can''t be nested, and only one can have the "runat=server" set.

[Question left intact in case anyone else finds themselves in the same situation.]

Anyway, NONE of my events fire.

If I drop a Button on the page, I can double-click it and it will create the Button_Click skeleton in the .cs file, no problem.

I can go into the .cs file and have intellisense let me pick the Buttons (or whatever) from the corresponding .aspx page, so they seem to be connected to each other. The Designer page has all the correct declarations, too.

But at run time (local debug), the events never get fired no matter how hard I click the buttons. Or drop the dropdowns. Or whatever.

Here''s the top of the aspx page:

<%@ Page Title="" Language="C#" MasterPageFile="~/OPPE.Master" AutoEventWireup="true" CodeBehind="Focused_Reviews.aspx.cs" Inherits="OPPE.AcuteMedClinicians.Focused_Reviews" %>



这是后面的代码:



and here''s the code behind:

namespace OPPE.AcuteMedClinicians
{
  public partial class Focused_Reviews : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
etc...



有什么明显的我想念的吗?这些子目录是否需要对它们进行某种魔术处理?只是本地调试卡西尼号只能处理一个简单的名称空间,但是IIS会(还没有尝试部署)吗?

今天下午在Mudville没事.



Anything obvious I''m missing? Do those subdirs need some sort of magic done to them? Is it just the local debug cassini can''t handle anything but a straightforward namespace, but IIS will (haven''t tried deploying yet)?

No joy in Mudville this afternoon.

推荐答案

0)组合框需要AutoPostBack="true"

1)我已将AutoEventWireup设置为"false",并且我的按钮事件也可以正常触发.
0) Combo boxes need AutoPostBack="true"

1) I have AutoEventWireup set to "false", and my button events fire just fine.


很显然,如果所涉及的母版页包含自己的形式,这确实很重要.嘘.

尽管下面的说明说让我们努力帮助开发人员,而不是让他们感到愚蠢,但有些事情却因打败开发人员几次而大声疾呼.跟我重复一次:如果页面上有两个表单,ASP.NET不喜欢它.*


*是的,可以.但是它们不能嵌套,只有一个可以设置"runat = server".

这个广告在顶部横幅中有一个小搜索框,具有自己的形式.我将其移至页面的真实"表单上方.
Apparently, it does matter, if the MasterPage in question contains a form of its own. Sheesh.

Despite the instructions below which say Let''s work to help developers, not make them feel stupid, some things just cry out for slapping the developer in the face a few times. Repeat after me: ASP.NET doesn''t like it if there are two Forms on the page.*


*Well, yes, you can. But they can''t be nested, and only one can have the "runat=server" set.

This one had a little search box in the top banner, with it''s own form. I moved it above the "real" Form for the page.


这篇关于我的活动均不会触发(已解决)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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