上一个事件持续触发. [英] Previous event is firing continously..

查看:68
本文介绍了上一个事件持续触发.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

下载文件后,单击cellSelectionChanged事件,然后我试图将新记录添加到单击新按钮上,但是仍然触发cellSelectionChanged事件,因此我无法添加新记录..pls,请告诉我正确的解决方案.

下面的代码用于下载文件..



After downloading file clicking on cellSelectionChanged Event then i am trying to add new record to clicking on new button but still firing cellSelectionChanged event so i am not able to add new record ..pls tell me right solution.

Code is Below for downloading file ..

string fileName = this.Controller.Model.SessionDataContext.FileAttachmentRowData.PhysicalFileName;
           byte[] array = this.Controller.Model.SessionDataContext.FileAttachmentRowData.FileContents;

           Response.Clear();
           // Add a HTTP header to the output stream that specifies the default filename
           // for the browser's download dialog
           Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
           // Add a HTTP header to the output stream that contains the
           // content length(File Size). This lets the browser know how much data is being transfered
           Response.AddHeader("Content-Length", array.Length.ToString());
           // Set the HTTP MIME type of the output stream
           Response.ContentType = "application/octet-stream";
           // Write the data out to the client.
           Response.BinaryWrite(array);

           Response.Clear();

推荐答案

如果您不想使用此事件.然后只需删除事件处理程序即可.
If you do not want to use this event. then just remove the event handler.


有时,您可以通过在输入代码时设置一个布尔值来解决此问题.但是,首先您要检查该布尔值是否正确.如果是,请跳过代码.一旦传递了if语句,请将变量设置为true.在退出代码之前,请清除bool.
Sometimes you can deal with this problem by having a bool that you set when you enter the code. However, first you check if this bool is true. If it is, skip the code. Once pass the if statement, set the variable to true. Before you exit the code, clear the bool.


这篇关于上一个事件持续触发.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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