记录成长点滴
posted on 2006-11-21 22:18 思无邪 阅读(2453) 评论(8) 编辑 收藏 网摘
有些地方挺值得参考. 回复 引用 查看
肯定是你在后台代码中处理了Row_Command和Row Deleting事件了,因为Image Button有OnCommand方法,然后CommandName参数名又是Delete,所以会执行 Row Command和Deleting事件 回复 引用 查看
是的,ImageButton、GridView等,就算不设置事件但如果CommandName设置成New、Delete等系统默认的一些,也会触发事件的,注意一下就可以避免 回复 引用 查看
@RicCC 应该和commandname没有关系吧?我都仔细检查了代码。 回复 引用 查看
@God Blue Shadow 没有用这些事件代码精简到只有rowcommand事件了 你说的可能指这中情况: 1、Correct behavior: as in the sample to the right. The AutoEventWireUp is set to true and the events are all set declaratively within the HTML markup 2、Correct behavior: as in the 2nd demo (link below) where the AutoEventWireUp is set to false and the event wireup is done programmatically by overriding the OnInit method 3、Incorrect behavior: as in 3rd demo (link below) where both the AutoEventWireUp and the overriding of the OnInit method are done to the same page. This causes the evnets to fire up twice. 其中第三种会触发两次,但是我遇到的说只有buttontype是image时才会触发两次 http://www.webswapp.com/codesamples/aspnet20/autoeventwireup/default.aspx 上面有详细的demo 回复 引用 查看
这问题我也碰到了,并不是每次都发生的,但是用了一个自己写的继承自GridView后就每次都发生了,不是rowcommand执行两次,而是页面彻底跑了两遍。我用的是IE6。 现在是这样解决的, <asp:ButtonField CommandName="dt" HeaderText="Delete" Text="<img src="../../Images/delete.gif" border="0" title="delete" onclick='return delete_click()' />"> <HeaderStyle Width="45px" /> </asp:ButtonField> 回复 引用
我最近也遇到这个问题,我在imageurl设了个路径,第一次点击imagebutton不能触发图片页面的Page_Load,第二次点击就可以了,不知道应如何解决 回复 引用
Powered by: 博客园 Copyright © 思无邪