页面上的所有活动都停止了射击 [英] All events on a page have stopped firing

查看:203
本文介绍了页面上的所有活动都停止了射击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在绝望的高度在这里。我走了度假2周的一个工作项目几乎释放点,我已经回来了问题。

使用Visual Studio 2010,C#为一个.net(3.5)Web项目。

我有2个形式(几乎相同)


  1. 创建的文档和存储在数据库中的数据

  2. 的数据被从数据库加载和被操纵

这两种形式都包含一些事件(code供给下文)

有与用于火以下对象的一些表格上的事件


  • 文本框tbPartNumber - OnTextChanged

  • 列表框lstbEmailSelectFrom - OnSelectedIndexChanged

  • 列表框lstbEmailSelected - OnSelectedIndexChanged

背后的code所有事件的存在,我知道没有改变。

我知道他们解雇我检查了一遍又一遍,并展示了该项目所涉及的团队的领队。

我有一个很好的休息回来后到办公室,没有休息时间的将闪光。第二种形式仍然运行按预期。

我不记得之前,我去了,所以我很茫然做任何更改。

我想今早添加一个新对象的形式,它不火或者

 < ASP:DropDownList的ID =ddlItemList
                  =服务器
                  边框样式=无
                  BORDERCOLOR =白
                  HEIGHT =99%
                  WIDTH =48%
                  的AutoPostBack =真
                  onselectedindexchanged =ddlItemList_SelectedIndexChanged>
< / ASP:DropDownList的>

背后

在code

 保护无效ddlItemList_SelectedIndexChanged(对象发件人,EventArgs的发送)
  {
  OleDbConnection的CON =新的OleDbConnection(odbcString);
  OleDbCommand的CMD =新的OleDbCommand();  。字符串theLanguage =会话[语言]的ToString();  如果(会话[USEREMAIL] == NULL)
    {//会话超时以便让用户重新登录
    ........
    }
  其他
    {//还有会话数据
      //获取项目列表的项目框    尝试
      {
      ......
      } //尝试
    赶上(异常前)
     {
     ......
     } //捕捉
    }
  }

有没有人任何想法?我想AP preciate任何帮助,我可以得到的。


 <%@页面语言=C#
         AutoEventWireup =真
         codeBehind =ConcessionDocument.aspx.cs
         继承=XXXXXXXXQualityPortal.ConcessionDocument%GT;<%@注册大会=AjaxControlToolkit
             命名空间=AjaxControlToolkit
             标签preFIX =ASP%GT;!< D​​OCTYPE HTML PUBLIC - // W3C // DTD XHTML 1.0过渡// ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><%@注册大会=AjaxControlToolkit
             命名空间=AjaxControlToolkit
             标签preFIX =ASP%GT;< HTML的xmlns =htt​​p://www.w3.org/1999/xhtml>
  <头ID =头像1
        =服务器>
    <标题>
      Tokheim质量门户:租界文档
    < /标题>
  < /头>
  <身体GT;
    <表ID =form1的
          =服务器
          defaultfocus =tbPartNumber>
      < D​​IV>        <中心及GT;
          < ASP:表ID =tblConcession
                     =服务器
                     WIDTH =85%
                     边框宽度=1
                     网格线=两者>
            < ASP:&的TableRow GT;
              < ASP:TableCell的Horizo​​ntalAlign =左
                             背景色=#E6E0F8>
                < ASP:标签ID =lblPartNumber
                           =服务器
                           文本=型号>
                < / ASP:标签>
              < / ASP:TableCell的>
              < ASP:TableCell的Horizo​​ntalAlign =左>                <! - ********************************************* ******************* - >
                <! - 问题与此事件 - >
                <! - ********************************************* ******************* - >                < ASP:DropDownList的ID =ddlItemList
                                  =服务器
                                  边框样式=无
                                  BORDERCOLOR =白
                                  HEIGHT =99%
                                  WIDTH =48%
                                  的AutoPostBack =真
                                  onselectedindexchanged =ddlItemList_SelectedIndexChanged>
                < / ASP:DropDownList的>                &安培; NBSP;
                < ASP:文本框ID =tbPartNumber
                             =服务器
                             的AutoPostBack =真
                             OnTextChanged =tbPartNumber_TextChanged
                             HEIGHT =99%
                             WIDTH =48%>
                < / ASP:文本框>
                &安培; NBSP;
                < ASP:标签ID =lblPartDescription
                           =服务器
                           文本=
                           HEIGHT =99%>
                < / ASP:标签>              < / ASP:TableCell的>              < ASP:TableCell的Horizo​​ntalAlign =左
                             背景色=#E6E0F8>
                < ASP:标签ID =lblQuantity
                           =服务器
                           文本=数量>
                < / ASP:标签>
              < / ASP:TableCell的>
              < ASP:TableCell的Horizo​​ntalAlign =左>
                < ASP:文本框ID =tbQuantity
                             边框样式=无
                             BORDERCOLOR =白
                             =服务器
                             HEIGHT =99%
                             WIDTH =99%>
                < / ASP:文本框>
              < / ASP:TableCell的>              < ASP:TableCell的Horizo​​ntalAlign =左
                             背景色=#E6E0F8>
                < ASP:标签ID =lblItemrevision
                           =服务器
                           文本=项目修订>
                < / ASP:标签>
              < / ASP:TableCell的>
              < ASP:TableCell的Horizo​​ntalAlign =左>
                < ASP:文本框ID =tbItemrevision
                             边框样式=无
                             BORDERCOLOR =白
                             =服务器
                             HEIGHT =99%
                             WIDTH =99%>
                < / ASP:文本框>
              < / ASP:TableCell的>
            < / ASP:&的TableRow GT;            < ASP:&的TableRow GT;
              < ASP:TableCell的ColumnSpan =6
                             Horizo​​ntalAlign =中心>                < ASP:表ID =tblEmailBoxes
                           =服务器
                           WIDTH =99%
                           边框宽度=0
                           网格线=无>
                  < ASP:&的TableRow GT;                    < ASP:TableCell的Horizo​​ntalAlign =中心
                                   WIDTH =45%>
                      < ASP:标签ID =lblSelectEmailAddress
                                 =服务器
                                 字体粗体=真
                                 文本=选择电子邮件地址,通讯组列表>
                      < / ASP:标签>                  <! - ********************************************* ******************* - >
                      <! - 问题与此事件 - >
                      <! - ********************************************* ******************* - >                      < ASP:列表框ID =lstbEmailSelectFrom
                                   =服务器
                                   的AutoPostBack =真
                                   OnSelectedIndexChanged =MoveToListBox2
                                   的SelectionMode =多
                                   WIDTH =99%>
                      < / ASP:列表框>                    < / ASP:TableCell的>
                    < ASP:TableCell的Horizo​​ntalAlign =中心
                                   宽度=10%>
                      < ASP:按钮的ID =btnMoveRight
                                  =服务器
                                  文本=>中
                                  可见=假
                                  的onclick =btnMoveRight_Click/>
                      < BR />
                      < ASP:按钮的ID =btnMoveLeft
                                  可见=假
                                  =服务器
                                  文本=下; />
                    < / ASP:TableCell的>
                    < ASP:TableCell的Horizo​​ntalAlign =中心
                                   WIDTH =45%>
                      < ASP:标签ID =lblEmailAddressesSelected
                                 =服务器
                                 字体粗体=真
                                 文本=电子邮件地址选定的通讯组列表>
                      < / ASP:标签>                  <! - ********************************************* ******************* - >
                      <! - 问题与此事件 - >
                      <! - ********************************************* ******************* - >                      < ASP:列表框ID =lstbEmailSelected
                                   =服务器
                                   的AutoPostBack =真
                                   OnSelectedIndexChanged =MoveToListBox1
                                   的SelectionMode =多
                                   WIDTH =99%>
                      < / ASP:列表框>
                    < / ASP:TableCell的>
                   < / ASP:&的TableRow GT;                  < ASP:&的TableRow GT;
                    < ASP:TableCell的Horizo​​ntalAlign =中心
                                   WIDTH =45%
                                   ColumnSpan =3>
                      <中心及GT;
                        < ASP:按钮的ID =btnSubmit按钮
                                    =服务器
                                    文字=提交
                                    的OnClick =btnSubmit_Clicked/>                      < /中心及GT;
                    < / ASP:TableCell的>
                   < / ASP:&的TableRow GT;
                  < / ASP:表>
              < / ASP:TableCell的>
            < / ASP:&的TableRow GT;
          < / ASP:表>          <中心及GT;                < ASP:文件上传ID =FileUpload1
                                =服务器
                                HEIGHT =35px
                                WIDTH =406px/>
                &安培; NBSP;
                < ASP:按钮的ID =btnFileLoadPostback
                            =服务器
                            文本=加载文件
                            的onclick =btnFileLoadPostback_ClickHEIGHT =35pxWIDTH =131px/>              < BR />
              < ASP:图片ID =图片7
                         的ImageUrl =〜/图片/ indicator3.png
                         风格=显示:无
                         =服务器/>          < /中心及GT;          < ASP:标签ID =theFileList
                     =服务器
                     文本=
                     可见=假>
          < / ASP:标签>        < /中心及GT;
      < / DIV>
    < /表及GT;
  < /身体GT;
< / HTML>


解决方案

我找到了问题的根源。

我又增加了一个注册关闭一个窗口,看来这已禁用表上的所有事件。如果我删除其所有的作品(从窗户外不关闭)

 保护无效的Page_Load(对象发件人,EventArgs的发送)
  {
  如果(!的IsPostBack)
    {
    Page.ClientScript.RegisterOnSubmitStatement(typeof运算(页),closePage,window.onunload = CloseWindow(););
    }
  }

删除了登记和一切运作良好。

At the height of despair here. I went away on holiday for 2 weeks with a working project almost at the point of release and I have come back to a problem.

Using Visual Studio 2010, C# for a .Net (3.5) Web project.

I have 2 forms (almost identical)

  1. The document is created and the data stored in a database
  2. The data is loaded from the database and is manipulated

Both forms contain a number of events (Code supplied below)

There are a number of events on the form that used to fire for the following objects

  • Text Box tbPartNumber - OnTextChanged
  • List Box lstbEmailSelectFrom - OnSelectedIndexChanged
  • List Box lstbEmailSelected - OnSelectedIndexChanged

The Code behind for all events exists and I know have not been changed.

I know they fired as I checked them over and over and demonstrated the project to the team leader of the team involved.

I have come back into the office after a nice break and none of the breaks will fire. The second form still operates as intended.

I cannot remember making any changes before I went off so I am at a loss.

I tried adding a new object to the form this morning and it does not fire either

<asp:DropDownList ID = "ddlItemList"
                  runat                  = "server"
                  BorderStyle            = "None"
                  BorderColor            = "White"
                  Height                 = "99%"
                  Width                  = "48%"
                  AutoPostBack           = "true"
                  onselectedindexchanged = "ddlItemList_SelectedIndexChanged" >
</asp:DropDownList>

with the code behind

protected void ddlItemList_SelectedIndexChanged(object sender, EventArgs e)
  {
  OleDbConnection con = new OleDbConnection(odbcString);
  OleDbCommand cmd = new OleDbCommand();

  string theLanguage = Session["Language"].ToString();

  if (Session["UserEmail"] == null)
    { // Session has timed out so get the user to log back in
    ........
    }
  else
    { // Still have the session data
      // Get the list of items for the item box

    try
      {
      ......
      }  // Try
    catch (Exception ex)
     {
     ......
     }  // Catch
    }
  }

Has anyone any Ideas ? I would appreciate any help I can get.


<%@ Page Language="C#" 
         AutoEventWireup="true" 
         CodeBehind="ConcessionDocument.aspx.cs" 
         Inherits="XXXXXXXXQualityPortal.ConcessionDocument" %>

<%@ Register Assembly="AjaxControlToolkit" 
             Namespace="AjaxControlToolkit" 
             TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Register Assembly="AjaxControlToolkit" 
             Namespace="AjaxControlToolkit" 
             TagPrefix="asp" %>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head id="Head1" 
        runat="server">
    <title>
      Tokheim Quality Portal : Concession Document
    </title>
  </head>
  <body>
    <form id="form1" 
          runat="server"
          defaultfocus="tbPartNumber" >
      <div>

        <center>
          <asp:Table ID = "tblConcession"
                     runat = "server"
                     width = "85%"
                     BorderWidth = "1"
                     GridLines="Both">


            <asp:TableRow>
              <asp:TableCell HorizontalAlign = "Left"
                             BackColor       = "#E6E0F8">
                <asp:Label ID    = "lblPartNumber"
                           runat = "server"
                           Text  = "Part Number">
                </asp:Label>
              </asp:TableCell>




              <asp:TableCell HorizontalAlign = "Left">

                <!-- **************************************************************** -->
                <!--                      Problem With this event                     -->
                <!-- **************************************************************** -->

                <asp:DropDownList ID                     = "ddlItemList"
                                  runat                  = "server"
                                  BorderStyle            = "None"
                                  BorderColor            = "White"
                                  Height                 = "99%"
                                  Width                  = "48%"
                                  AutoPostBack           = "true"
                                  onselectedindexchanged = "ddlItemList_SelectedIndexChanged" >
                </asp:DropDownList>





                &nbsp;
                <asp:Textbox ID              = "tbPartNumber"
                             runat           = "server"
                             AutoPostBack    = "true"
                             OnTextChanged   = "tbPartNumber_TextChanged"
                             Height          = "99%"
                             Width           = "48%">
                </asp:Textbox>
                &nbsp;
                <asp:Label ID     = "lblPartDescription"
                           runat  = "server"
                           Text   = ""
                           Height = "99%">
                </asp:Label>

              </asp:TableCell>

              <asp:TableCell HorizontalAlign = "Left"
                             BackColor       = "#E6E0F8">
                <asp:Label ID    = "lblQuantity"
                           runat = "server"
                           Text  = "Quantity">
                </asp:Label>
              </asp:TableCell>
              <asp:TableCell HorizontalAlign = "Left">
                <asp:Textbox ID              = "tbQuantity"
                             BorderStyle     = "None"
                             BorderColor     = "White"
                             runat           = "server"
                             Height          = "99%"
                             Width           = "99%">
                </asp:Textbox>
              </asp:TableCell>

              <asp:TableCell HorizontalAlign = "Left"
                             BackColor="#E6E0F8">
                <asp:Label ID    = "lblItemrevision"
                           runat = "server"
                           Text  = "Item Revision">
                </asp:Label>
              </asp:TableCell>
              <asp:TableCell HorizontalAlign = "Left">
                <asp:Textbox ID = "tbItemrevision"
                             BorderStyle = "None"
                             BorderColor = "White"
                             runat = "server"
                             Height = "99%"
                             Width = "99%">
                </asp:Textbox>
              </asp:TableCell>
            </asp:TableRow>



            <asp:TableRow>
              <asp:tableCell ColumnSpan = "6"
                             HorizontalAlign="Center" >

                <asp:Table ID = "tblEmailBoxes"
                           runat = "server"
                           width = "99%"
                           BorderWidth = "0"
                           GridLines="None">
                  <asp:TableRow>

                    <asp:TableCell HorizontalAlign="Center"
                                   width = "45%">
                      <asp:Label ID    = "lblSelectEmailAddress"
                                 runat = "server"
                                 Font-Bold = "true"
                                 Text  = "Select An Email Address For The Distribution List">
                      </asp:Label>

                  <!-- **************************************************************** -->
                      <!--                      Problem With this event                     -->
                      <!-- **************************************************************** -->

                      <asp:ListBox ID = "lstbEmailSelectFrom"
                                   runat = "server"
                                   AutoPostBack = "true"
                                   OnSelectedIndexChanged="MoveToListBox2"
                                   SelectionMode = "Multiple"
                                   width = "99%">
                      </asp:ListBox>



                    </asp:TableCell>
                    <asp:TableCell HorizontalAlign="Center"
                                   width = "10%">
                      <asp:Button ID = "btnMoveRight"
                                  runat = "Server"
                                  Text = ">" 
                                  visible = "false"
                                  onclick="btnMoveRight_Click" />
                      <br />
                      <asp:Button ID = "btnMoveLeft"
                                  visible = "false"
                                  runat = "Server"
                                  Text = "<" />
                    </asp:TableCell>
                    <asp:TableCell HorizontalAlign="Center"
                                   width = "45%">
                      <asp:Label ID    = "lblEmailAddressesSelected"
                                 runat = "server"
                                 Font-Bold = "true"
                                 Text  = "Email Addresses Selected For The Distribution List">
                      </asp:Label>

                  <!-- **************************************************************** -->
                      <!--                      Problem With this event                     -->
                      <!-- **************************************************************** -->

                      <asp:ListBox ID = "lstbEmailSelected"
                                   runat = "server"
                                   AutoPostBack = "true"
                                   OnSelectedIndexChanged="MoveToListBox1"
                                   SelectionMode = "Multiple"
                                   width = "99%">
                      </asp:ListBox>
                    </asp:TableCell>
                   </asp:TableRow>

                  <asp:TableRow>
                    <asp:TableCell HorizontalAlign="Center"
                                   width = "45%"
                                   ColumnSpan = "3" >
                      <center>
                        <asp:Button ID = "btnSubmit"
                                    runat = "server" 
                                    text = "Submit"
                                    OnClick="btnSubmit_Clicked"/>

                      </center>
                    </asp:TableCell>
                   </asp:TableRow>


                  </asp:Table>


              </asp:tableCell>
            </asp:TableRow>
          </asp:Table>        

          <center>

                <asp:FileUpload ID="FileUpload1" 
                                runat="server" 
                                Height="35px" 
                                Width="406px" />
                &nbsp;
                <asp:Button ID="btnFileLoadPostback" 
                            runat="server" 
                            Text="Load File" 
                            onclick="btnFileLoadPostback_Click" Height="35px" Width="131px" />

              <br />
              <asp:Image id       = "Image7"
                         ImageUrl = "~/Images/indicator3.png"
                         Style    = "display:None"
                         runat    = "server" />

          </center>



          <asp:Label ID    = "theFileList"
                     runat = "server"
                     Text  = ""
                     visible = "false">
          </asp:Label>

        </center>
      </div>
    </form>
  </body>
</html>

解决方案

I found the source of the problem.

I had added a registration to close a window and it appears that this has disabled all events on the form. If I remove it all works (apart from the window not closing)

protected void Page_Load(object sender, EventArgs e) 
  { 
  if (!IsPostBack) 
    { 
    Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();"); 
    }
  } 

Removed the registration and all works well

这篇关于页面上的所有活动都停止了射击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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