图像按钮在更新面板内部无效 [英] image button not working inside update panel

查看:69
本文介绍了图像按钮在更新面板内部无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下代码中,如果图像按钮不在更新面板内,则可以使用。如果在更新面板中保留

以避免页面刷新目的,则会抛出如下错误:不包含DataItem的定义,并且没有扩展方法DataItem接受System.Web.UI类型的第一个参数。可以找到控件(你是否错过了使用指令或汇编引用?)





In the following code if the image button is not inside an update panel it works. If it is kept
inside update panel to avoid page refresh purpose it throws an error like:does not contain a definition for DataItem and no extension method DataItem accepting a first argument of type System.Web.UI.Control could be found (are you missing a using directive or an assembly reference?)


<asp:UpdatePanel ID="popp" runat="server" >
    <ContentTemplate>
    <asp:ImageButton ID="ImageButton1" Height="200px" Width="254px"  runat="server" CommandName="myeventDetails"  ImageUrl='<%#DataBinder.Eval(Container.DataItem,"PicturePath") %>' />
 </ContentTemplate>
 </asp:UpdatePanel>

推荐答案

尝试并注册您的图片按钮以获得完整的回发




Try and register your imagebutton for full postback


ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(btnid);


这篇关于图像按钮在更新面板内部无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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