Apr 13, 2010, 5:42 AM
How to dynamically show Checkboxes using C#?
I wanna show some checkboxes in my Asp.net page
but when running the page is blank .
Are there some wrong in the following code:
but when running the page is blank .
Are there some wrong in the following code:
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<script runat="server">
public string outstr;
protected void Page_Load(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
int count = 10;
for (int i = 0; i < count; i++)
sb.Append("<ext:Checkbox ID='").Append(i).Append("'").Append(" runat='server' AutoWidth='true' />");
outstr = sb.ToString();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>hello</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server"/>
<% = outstr %>
</form>
</body>
</html>