我想將子對象添加到TextBox,但此代碼給出錯誤如何將子對象添加到asp.net中的文本框?
我該如何實現這一目標?
<asp:TextBox ID="TextBox2" runat="server">
<asp:Label runat="server" Text="Label"></asp:Label>
</asp:TextBox>`
我想將子對象添加到TextBox,但此代碼給出錯誤如何將子對象添加到asp.net中的文本框?
我該如何實現這一目標?
<asp:TextBox ID="TextBox2" runat="server">
<asp:Label runat="server" Text="Label"></asp:Label>
</asp:TextBox>`
你想做的事情是不可能的。儘管WPF有一個支持這種類型的框架,但HTML和ASP.NET並沒有。
如果您正試圖設置文本,試試這個:
<asp:TextBox ID="TextBox2" runat="server" Text="abc" />
別的,只是把它們並排:
<asp:Label runat="server" Text="Label" />
<asp:TextBox ID="TextBox2" runat="server" />
文本框和標籤是兩個不同的控件。你不能在文本框中嵌套標籤。
如:
<asp:Label runat="server" Text="Label"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"> </asp:TextBox>
你有什麼想在這裏做什麼?
由於有一些喜歡的LinkButton的ASP.NET控件,它允許你持有它們內部
<asp:LinkButton ID="lnkDelete" runat="server" CssClass="remove">
<span><font color="#fb4202">x</font> Remove</span>
</asp:LinkButton>
HTML控件,但它是不可能舉行的asp:在ASP標籤:文本框控件
文本框是一個可編輯的控件,標籤是不可編輯的控件,所以你不能把標籤放在文本框中。您可以在文本框之前放置標籤,如下所示:
<asp:Label ID="Label1" runat="server" Text="Enter Text"><asp:Label>
<asp:TextBox ID="txtValue" runat="server"/>
您試圖實現什麼?你想設置TextBox的值嗎? http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.text(v=vs.110).aspx –
你想完成什麼? –
這是因爲TextBoxes沒有子對象。我想你想要的是這樣的:
– 1lastBr3ath