ASP.NET DropDownList列表项添加前导空格(Leading Space)的两种方法
来源:互联网 发布:淘宝比较有名的耳饰店 编辑:程序博客网 时间:2024/05/01 04:28
我们知道:RFC 1866中定义了一个named entity,即 ASCII是160;
方法一:
char nbsp = (char)0xA0;
dropDownList.Items.Add( new ListItem( "test3".PadLeft(10,nbsp) , "4" ) );
注释:
String.PadLeft( int totalWidth , char paddingChar )
Parameters:
totalWidth:
The number of characters in the resulting string, equal to the number of
original characters plus any additional padding characters.
paddingChar:
A Unicode padding character.
Returns:
A new string that is equivalent to this instance, but right-aligned and padded
on the left with as many paddingChar characters as needed to create a length
of totalWidth. Or, if totalWidth is less than the length of this instance,
a new string that is identical to this instance.
方法二:
dropDownList.Items.Add( new ListItem( Server.HtmlDecode( "   ") + "test3", "4" ) );
注释:
Server.HtmlDecode( string s )
Parameters:
s:
The HTML string to decode.
Returns:
The decoded text.
Summary:
Decodes an HTML-encoded string and returns the decoded string.
方法一:
char nbsp = (char)0xA0;
dropDownList.Items.Add( new ListItem( "test3".PadLeft(10,nbsp) , "4" ) );
注释:
String.PadLeft( int totalWidth , char paddingChar )
Parameters:
totalWidth:
The number of characters in the resulting string, equal to the number of
original characters plus any additional padding characters.
paddingChar:
A Unicode padding character.
Returns:
A new string that is equivalent to this instance, but right-aligned and padded
on the left with as many paddingChar characters as needed to create a length
of totalWidth. Or, if totalWidth is less than the length of this instance,
a new string that is identical to this instance.
方法二:
dropDownList.Items.Add( new ListItem( Server.HtmlDecode( "   ") + "test3", "4" ) );
注释:
Server.HtmlDecode( string s )
Parameters:
s:
The HTML string to decode.
Returns:
The decoded text.
Summary:
Decodes an HTML-encoded string and returns the decoded string.
- ASP.NET DropDownList列表项添加前导空格(Leading Space)的两种方法
- ASP.NET DropDownList列表项添加前导空格(Leading Space)的两种方法
- asp.net DropDownList 添加空格。
- DropDownList的Item中插入前导空格
- 在asp.net下实现Option条目中填充前导空格的方法
- ASP.NET给 DropDownList列表Text前加入空格
- 两种添加数据到dropdownlist控件的方法_asp.net技巧
- asp.net实现DropDownList、ListBox无刷新三级联动的两种方法
- asp.net实现DropDownList、ListBox无刷新三级联动的两种方法
- 两种添加数据到WEB DropDownList 控件的方法
- DropdownList绑定的两种方法
- DropDownList绑定数据的两种方法
- DropDownList绑定的两种方法
- DropdownList绑定的两种方法
- DropdownList绑定的两种方法 .
- DropdownList绑定的两种方法
- DropdownList绑定的两种方法
- asp.net 全国省份DropDownList下拉列表
- 如何计算两个datetime的时间差
- 关于青春
- Hibernate中类的继承联合使用subclass和join
- 雁过也,月满西楼
- 念,心随君浅舞天涯
- ASP.NET DropDownList列表项添加前导空格(Leading Space)的两种方法
- 静静的在心里承受所有的伤痛和不快乐
- C#图片处理基本应用(裁剪,缩放,清晰度,水印)
- 与文字相拥 舞尽人间芳华
- C#ASP.net中数据连接静态方法类
- 等你,执手渡流年(七夕)
- 【phpcms-v9】content_output.class.php文件分析-前台内容详情页显示数据的过滤
- Check for updates from your iOS app
- 如何使Ubuntu Linux 12.04 用root登录