小编juh*_*uhi的帖子

动态图像按钮点击事件没有被触发

动态图像按钮点击事件没有被触发请帮助我在 asp.net oninit 方法中创建了动态按钮

protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
 ImageButton img = new ImageButton();
        img.ID = "first_button";
        img.Click += new ImageClickEventHandler(first_Click);
        img.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "ClassLibrary1.image.first.gif");
        img.Attributes.Add("onmouseover", "onmousehand(this,'over')");
        img.Attributes.Add("onmouseout", "onmousehand(this,'out')");
        p1.Controls.Add(img);
        img.Dispose();
        img = new ImageButton();
        img.ID = "previous_button";
        img.Click += new ImageClickEventHandler(previous_Click);
        img.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "ClassLibrary1.image.previous.gif");
        img.Attributes.Add("onmouseover", "onmousehand(this,'over')");
        img.Attributes.Add("onmouseout", "onmousehand(this,'out')");
        p1.Controls.Add(img);
        img.Dispose();

        t1.Attributes.Add("style", "color:#666666;");
        // t1.Text = "Page " + current_page + " of " + total_pages;
        t1.ID = "text_box1";
        t1.Attributes.Add("onclick", "textbox_enable('" + t1.ClientID + "')");
        p1.Controls.Add(t1);
        img …
Run Code Online (Sandbox Code Playgroud)

c# asp.net events dynamic

5
推荐指数
1
解决办法
8149
查看次数

标签 统计

asp.net ×1

c# ×1

dynamic ×1

events ×1