1
評估性別後,下面的代碼在GridView列中顯示「M」或「F」。如何在TemplateField中設置forecolor?
<asp:TemplateField HeaderText="Gender"> <ItemTemplate> <%# Eval("Gender") %> </ItemTemplate> </asp:TemplateField>
當它的 「M」 我想使用的文字顏色紅色和藍色,否則。我該怎麼做呢?無論是在aspx文件或在後面的代碼是好的。如果可能,我想知道這兩種方法。