排列动态生成的标签和 aspx 控件,使其看起来像字典,而不使用表格
我想要一个如下所示的页面结构:
Label1 | (CheckBox or DropDown or TextBox etc.)<br>
Label2 | (CheckBox or DropDown or TextBox etc.)<br>
Label3 | (CheckBox or DropDown or TextBox etc.)
使用这个确切的架构,考虑到例如 TextAreas 占用更多空间,同时仍然确保 Label 和相应的 aspx-Control 处于相同的高度。
我不知道会出现哪些控件,因为它绑定到赋予表单的参数。
我正在考虑为标签设置一个 div,为控件设置一个 div,将它们排列在一起,并为 .divLeft span
提供某种固定的高度和边距,以适合我放置的任何控件在右侧。
有什么想法吗?
I'd like to have a Page-Structure like the following:
Label1 | (CheckBox or DropDown or TextBox etc.)<br>
Label2 | (CheckBox or DropDown or TextBox etc.)<br>
Label3 | (CheckBox or DropDown or TextBox etc.)
with this exact schema, considering that e.g. TextAreas take up more space whilst still making sure that Label and corresponding aspx-Control are on the same height.
I cannot know which Controls will appear since this is bound to the Parameters that are given to the form.
I was thinking about having a div for Labels and a div for Controls, arranging them next to each other and giving .divLeft span
some kind of fixed height and margin that'd be appropriate for whatever Controls I put on the right side.
Any Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您可以使用带有一两个模板列的网格,并在 RowDataBound 事件或 RowCreated 上添加必要的控件。我正在使用下面的代码来激活 rowdatabound 中的一个控件,
我认为您可以使用它在 rowcreated 事件中添加控件
I think you can use a grid with one or two templates columns, and add the necessary control on RowDataBound event or RowCreated. I'm using the code below to activate one control in rowdatabound
I think you can use to add controls in rowcreated event
最后,我们采用的方法是使用一个 div,在其中添加具有
float:left
和width:50%
的标签、具有相同统计信息的控件,然后添加一个带有float:left
和width:100%
的占位符跨度。它看起来像一张桌子,排列也像一张桌子,但没有实际桌子的缺点。In the end the method we went with was having one div, in which we added Labels having
float:left
andwidth:50%
, controls with the same stats and afterwards a placeholder-span withfloat:left
andwidth:100%
. It looks like a table and is arranged like one, but doesn't have the disadvantages of actual tables.