[英]How to wrap output text from multiline textbox (web control) with a pre-configured width?
[英]How to create a limited number of pre-configured DropDownList and Textbox
我正在嘗試在轉發器中創建一個DropDownList和一個TextBox以模擬典型的問題列表
我的問題是,如何使用此下拉列表和文本框在中繼器中創建5行
問:DropDownList1答:TextBox1
問:DropDownList2答:TextBox2
問:DropDownList3答:TextBox3
問:DropDownList4答:TextBox4
問:DropDownList5答:TextBox5
改天,我們可以將問題數量更改為3,因此我的中繼器應綁定3個質量檢查
我該如何動態地做到這一點。
我創建這樣的結構...但是我不知道如何開始Load事件以進行渲染,就像我之前說的那樣。
<asp:Repeater ID="repeater1" runat="server">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:DropDownList ID="ddlQuestion" runat="server" />
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtAnswer" runat="server" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
最簡單的方法可能是將那些低階控件封裝在一個高階控件(即ASCX)中,然后將其添加到循環中的占位符中。 這樣,您將獲得能夠輕松更改ASCX的好處,而不會影響外部循環代碼。
編輯:“添加”是指創建控件,然后將其附加為子控件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.