English 中文(简体)
无法将用户控制纽顿的点击事件引向另一页
原标题:Not able to call User control button click event when loaded dynamically into another page

我正在撰写一个项目,装上产品清单,然后提供删除产品的选择。 ASP. NET C#

为此建立了用户控制。

The user control has product image, name , and has one button for delete. and this user control is loaded dynamically into a page lets say Products page.

但是,我把一系列用户控制动态装入产品网页。

以下是该守则。

            ProductInfo ib = (ProductInfo)LoadControl("ProductInfo.ascx");
            ProductName = "xyz"; 
            /**and so on*//
            spn_list.Controls.Add(ib);

现在,每个产品都从数据库中显示,每个产品也删除了纽伦。

但是,在点击删除的纽扣吨时,它并不称他的活动。 无。

have also tried to use break Point but it does not reaches there. ?????

审判 实例

Button 浮油 活动不焚烧

但不工作

最佳回答

用户控制必须装在<代码>Page_Init方法上,而不是Page_Load。 如果在“Load”页中做了,那么它就会在“观点”中获胜,从而出现问题。

不仅把首批装载量照旧,还把事件线上。

if(!Page.PostBack) 
{     
    control.EventRaised += new EventHandler(EventResponse) 
}

is wrong——这一活动将在网页重载时消失。 事件发生后,电线会 t。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签