English 中文(简体)
复式控制箱和核对箱
原标题:Repeater Control and Check box alignment
  • 时间:2012-05-08 09:39:21
  •  标签:
  • c#

I am doing a asp.net web application in c#.I need an alignment as shown below: enter image description here

这种协调意味着要使用重复控制。 我使用了以下文字:

页: 1

 <table cellspacing="0" cellpadding="0" border="0" width="80%" align="center">
        <tr>
          <td>
          </td>
      <asp:Repeater ID="rptroutebind" runat="server">
        <ItemTemplate>
            <td>                                                                                   <asp:Label ID="lblRouteName" runat="server" Text= <%# Eval("ROUTENAME") %>  Width="100"></asp:Label>
           </td>
         </ItemTemplate>
      </asp:Repeater>
      </tr>
   <asp:Repeater ID="rptbindoutlet" runat="server">
     <ItemTemplate>
         <tr>
            <td>                                                                                <asp:Label ID="lblOutName" runat="server" Text= <%# Eval("RONAME") %>  Width="100"></asp:Label>
            </td>
                </tr>
         <tr>
        <td style="height: 10px">
        </td>
        </tr>
     </ItemTemplate>
    </asp:Repeater>
  </table>

然后,我在没有检查箱子的情况下接手以下。 任何人都能够说明如何安置这些检查箱。

http://www.un.org。 我试图这样做。

c 网页:

protected void rptbindoutlet_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            CheckBox chk;
            foreach (RepeaterItem item in rptbindoutlet.Items)
            {
                for (int i = 1; i <= chkno; i++)
                {
                    chk = new CheckBox();
                    chk.ID = "check" + i;
                    rptbindoutlet.Controls.Add(chk);
                }
            }
        }

i am getting check boxes but not aligning correctly.I am getting like this: enter image description here

http://www.ohchr.org。

 protected void rptbindoutlet_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            CheckBox chk;
            foreach (RepeaterItem item in rptbindoutlet.Items)
            {
                TableRow tr = new TableRow();
                for (int i = 1; i <= chkno; i++)
                {
                    TableCell tc = new TableCell();
                    chk = new CheckBox();
                    chk.ID = "check" + i;
                    tc.Controls.Add(chk); 
                }
                rptbindoutlet.Controls.Add(tr);
            }
        }

引言

“entergraph

问题回答

根据您的代码,你通过使用c#代码而不是表格结构添加了一个新的<代码>ItemTemplate。 页: 1 页: 1 因此,请提供一张表Row和表Cell,在本表C中,根据上级表格结构,在运行时间增加新的支票Box。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签