如何使用空格在Capitalize中设置datagrid列标题 [英] How to set datagrid column header in Capitalize with white space

查看:83
本文介绍了如何使用空格在Capitalize中设置datagrid列标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码。代码已经与datagrid绑定。但是datagrid列标题与以下相同,如Cur_Date,Cur_Time,Itemname等...但我需要Cur_Date作为当前日期Cur_Time作为当前时间,Itemname作为项目名称。我怎么能做到这一点..



我已经检查了css但我没有得到准确的输出,但我需要,如果itemname为Item Name并且设置为列标题。如果操作怎么办这个页面..?





提前谢谢







public List< stockpagebll> SelectAllStock()

{

DataTable dt = sd.SelectAllStock();

List< stockpagebll> stock = new List< stockpagebll>();

foreach(dt.Rows中的DataRow行)

{

StockpageBLL a = new StockpageBLL( );

a.Id = Convert.ToInt32(row [item_id]);

a.Cur_Date = Convert.DateTime(row [cur_date]);

a.Cur_Time = Convert.DateTime(row [cur_time]);

a.Itemname = row [itemname]。ToString();

a.Barcode = row [barcode]。ToString();

a.Location = row [location]。ToString();

a.Sellprize = Convert.ToDecimal(row [sellprize]);

a.Buyprize = Convert.ToDecimal(row [buyprize]);

a .Profit = Convert.ToDecimal(row [profit]);



stock.Add(a);



}

退货;

}

解决方案

在表格的td中添加css属性(style =white-space:nowrap),它允许带有空格的文本作为单行,即。 的NOWRAP。

I am using the following the following code. The code already binding with datagrid. But The datagrid column header sames as the following like, Cur_Date,Cur_Time,Itemname etc... but I need Cur_Date as Current Date Cur_Time as Current Time,Itemname as Item Name. How I can achieve this..

I already check css but I didn't get the accurate output,but I need ,if itemname as Item Name and is set to column header. If the operation how to do in this page..?


Thanks in advance



public List<stockpagebll> SelectAllStock()
{
DataTable dt = sd.SelectAllStock();
List<stockpagebll> stock = new List<stockpagebll>();
foreach (DataRow row in dt.Rows)
{
StockpageBLL a = new StockpageBLL();
a.Id = Convert.ToInt32(row["item_id"]);
a.Cur_Date = Convert.DateTime(row["cur_date"]);
a.Cur_Time = Convert.DateTime(row["cur_time"]);
a.Itemname = row["itemname"].ToString();
a.Barcode = row["barcode"].ToString();
a.Location = row["location"].ToString();
a.Sellprize = Convert.ToDecimal(row["sellprize"]);
a.Buyprize = Convert.ToDecimal(row["buyprize"]);
a.Profit = Convert.ToDecimal(row["profit"]);

stock.Add(a);

}
return stock;
}

解决方案

Add css property(style="white-space: nowrap" in td of table) which allow text with white space as single line i.e. nowrap.


这篇关于如何使用空格在Capitalize中设置datagrid列标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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