
asp.net如何在后台动态生成一个HtmlInputCheckBox控件显示在页面
若以下回答无法解决问题,邀请你更新回答
1个回答
展开全部
.aspx.cs
using System.Web.UI.HtmlControls;
public partial class _Default: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HtmlInputCheckBox chk = new HtmlInputCheckBox();
chk.ID = "chk1";
chk.Value = "1";
chk.Checked = true;
Panel1.Controls.Add(chk);
}
}
.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
</div>
</form>
</body>
</html>
using System.Web.UI.HtmlControls;
public partial class _Default: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HtmlInputCheckBox chk = new HtmlInputCheckBox();
chk.ID = "chk1";
chk.Value = "1";
chk.Checked = true;
Panel1.Controls.Add(chk);
}
}
.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
</div>
</form>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询