我有一个中继器。我想在课堂上分发文件。第一列包含学生姓名。在第一行中,为课程定义了书籍。
我想做的是跟踪是否提供了书籍。例如,给出了数学土耳其英语书籍şebneme。他被授予英语和数学。我想在矩阵平面上放置一个复选框。我会保留它的正确或错误。我正在动态创建Checbox,但无法将其放置在转发器中。我该怎么办?
<asp:Panel ID="Panel2" runat="server" Visible="false">
<asp:TextBox ID="txtsayi1" runat="server" Visible="false"></asp:TextBox>
<asp:TextBox ID="txtsayi2" runat="server" Visible="false"></asp:TextBox>
` <table id="mytable3" class="table table-striped table-bordered second" style="width: 98%">`
`<asp:Repeater runat="server" ID="rowRepeater" OnItemDataBound="rowRepeater_ItemBound">`
`<HeaderTemplate>`
` <thead>`
` <tr>`
` <asp:Repeater runat="server" ID="headerRepeater">`
` <ItemTemplate>`
` <th><%# Eval("DokumanAdi") %></th>`
` </ItemTemplate>`
`</asp:Repeater>`
` </tr>`
`</thead>`
` <tbody>`
`</HeaderTemplate>`
` <ItemTemplate>`
` <tr>`
`<td><%# Eval("OgrenciAdi") %></td>`
` <%-- <td>
<asp:CheckBox ID="chkbx" runat="server" /></td>--%>`
`</tr>`
` </ItemTemplate>`
` <FooterTemplate>`
`</FooterTemplate>`
`</asp:Repeater>`
` </tbody>`
` </table>`
` </asp:Panel>`
这是我的前端代码。我有一个按钮单击事件。当我点击按钮
for (int j = 0; j < a; j++)
{
for (int t = 0; t < i; t++)
{
CheckBox cbx = new CheckBox();
` cbx.ID = "cbx" + t;`
` rowRepeater.Controls.Add(cbx);`
` }`
` }`
ItemBound事件,
protected void rowRepeater_ItemBound(object sender, RepeaterItemEventArgs e)
{
` if (e.Item.ItemType == ListItemType.Header) `
` {
` DataTable dt1 = db.Doldur("select * from tblDokumanTuru"); `
` Repeater headerRepeater = e.Item.FindControl("headerRepeater") as Repeater; `
` headerRepeater.DataSource = dt1; `
` headerRepeater.DataBind(); `
` txtsayi2.Text = dt1.Rows.Count.ToString(); `
` } `
` if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) `
` { `
` } `
` } `