C# 后台生成HMLT按钮并赋予onclick属性

           声明 table 格

            TableCell cell0 = new TableCell();

           此生成的Button会导致页面回发
            //HtmlButton btn = new HtmlButton();

           此为html按钮
            HtmlInputButton btn = new HtmlInputButton();
            btn.Value = "测试按钮";
            btn.ID = "2";
            给html按钮添加onclick属性
            btn.Attributes.Add("onclick","openwindows();");

            将此按钮搁到table格中
            cell0.Controls.Add(btn);

原文地址:https://www.cnblogs.com/Jack_G/p/2728666.html