如何在c#new literal中添加border bottom 1px [英] how to add border bottom 1px in c# new literal

查看:87
本文介绍了如何在c#new literal中添加border bottom 1px的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加边框底部1 px的新文字,但是不要让它工作

  var  borderbotton =  new  Literal {Text =  @ < ; border-bottom = 1px  < / table}; 

解决方案

您无法在Literal控件上添加任何Css样式。如果你需要在控件上应用样式,那么你应该使用控件来呈现任何html标签,但是文字控件不会呈现任何html标签,因此你将无法应用任何CSS样式。



 ex。 <   asp:标签 >   - 这将呈现<   span  >  
< asp:Panel > - 将呈现< 代码 > < div >





但是如果你的< asp:literal xmlns:asp =#unknown> < / asp:literal> 控件包含HTML字符串,然后您可以选择如何在页面上显示它。您可以使用它的模式属性并从 System.Web.UI.WebControls.LiteralMode



查看此链接以获取更多信息

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literal.mode.aspx [ ^ ]


i am trying to add new literal with border bottom 1 px but dont get it to work

var borderbotton = new Literal {Text = @"<border-bottom="1px"</table"};

解决方案

You can not add any Css styles on Literal control. If you need to apply style on control then you should use control which render any html tag but literal control will not render any html tag so you won''t be able to apply any css style.

ex. <asp:Label> - which will render <span>
<asp:Panel>- which will render  <code><div>



But if your <asp:literal xmlns:asp="#unknown"> </asp:literal> control contains HTML string then you have options how you want to display it on page. You can Use Mode property of it and set its value from System.Web.UI.WebControls.LiteralMode

Checkout this link for more information
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literal.mode.aspx[^]


这篇关于如何在c#new literal中添加border bottom 1px的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆