动态图像按钮事件处理程序 [英] Dynamic Image Button Event Handler

查看:133
本文介绍了动态图像按钮事件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,带有编辑图像按钮的动态htmltable是从后面的代码构建的。 htmltable位于更新面板中。问题是事件处理程序未触发,但页面正在回发。任何帮助....

A dynamic htmltable with edit image button is built from code behind. the htmltable is in a update panel.Problem is the event handler is not firing, but the page is posting back. any help....

dataCell = new HtmlTableCell();
ImageButton imgEdit = new ImageButton();
imgEdit.ID = "imgButtonEdit" + serialNo;
imgEdit.Click += new ImageClickEventHandler(imgEdit_Click);
ScriptManager.GetCurrent(this).RegisterPostBackControl(imgEdit);
dataCell.Controls.Add(imgEdit);
dataRow.Cells.Add(dataCell);

protected void imgEdit_Click(object sender, ImageClickEventArgs e)
{
//do stuff here
}







表格中有多个图像按钮




There are multiple image buttons in the table

推荐答案

通常如果在asp.net中创建动态控件,这个控件就无法在页面回发中保持状态。

用于维护动态的状态asp.net中的控件做一个人认为每当页面发布后重新创建 Page_Init 事件中的动态控件
Normally if create dynamic control in asp.net this controls are not able to maintain there state on page postback .
for maintaining the state of the dynamic control in asp.net do one think whenever page is getting post recreate those dynamic controls in Page_Init Event


这篇关于动态图像按钮事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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