2015-05-01 54 views
0

我想包括在GridView中的asp文本框內部的<i></i>但它不是working.I已經嘗試了本字體真棒圖標的GridView

<asp:TextBox ID="modify" runat="server" Text='<i class='icon-edit'></i>'/></asp:TextBox> 

,我也嘗試過

<asp:TextBox ID="modify" runat="server"><i class="icon-edit"></i></asp:TextBox> 

任何想法?

我知道,我已經嘗試了所有,但我不能看到圖標。 我想在gridview文本框中包含字體棒圖標。

我只使用過這個類。

.icon-edit{ 
content: "\f057"; 
left: auto; 
right: 16px; 
padding: 0 3px; 
z-index: 2; 
position: absolute; 
top: 10px; 
bottom: 1px; 
line-height: 30px; 
display: inline-block; 
font-size: 16px; 
text-align: center; 
font: normal normal normal 14px/1 FontAwesome; 
text-rendering: auto; 
-webkit-font-smoothing: antialiased; 
} 
+0

你可以試試< class ='icon-edit'> in text attribute?但爲什麼你想在文本里面有一個標籤? – Sushil

+0

感謝發佈源代碼。如果您可以提供生成的HTML,這將會很有幫助。 請刪除瀏覽器收到的HTML代碼。您可以使用 - 在瀏覽器中查看源選項, - 檢查元素選項。你能夠在網格框外顯示圖標嗎? –

回答

0

<asp:TextBox />標記創建一個<input type="text" /> html元素。 input元素不能包含額外的標記。所以你想要做的是把你的<i>放在文本框後面,然後用css移動它,使它看起來位於文本框的頂部。

<asp:TextBox ID="modify" runat="server"></asp:TextBox><i class="icon-edit"></i> 

然後CSS:

.icon-edit { 
    position: absolute; 
    margin-left: -20px; 
} 

這只是一個例子,你需要玩的CSS把事情找你想要的方式。