/*
比如:在数据库中查询一个DataTable的数据是这样Name Url CreateTime
百度 www.baidu.com 2012-5-29 15:49:27
新浪 www.sina.com 2012-5-29 15:49:27
谷歌 www.google.com 2012-5-29 15:49:27 我想在绑定之前将url这一列所有行追加http://,在不循环DataTable的情况下 可以实现吗想要的结果:
百度 http://www.baidu.com 2012-5-29 15:49:27
新浪 http://www.sina.com 2012-5-29 15:49:27
谷歌 http://www.google.com 2012-5-29 15:49:27
*/
解决方案 »
- 关于二进制的一些问题
- 各位有用 Windows7专业版 64位 做.net开发的吗?
- 这样删除数据为什么不行呢?急!马上要交任务了,谢谢啊,大家帮帮忙
- 请问在VS2005里dlcument属性的pagelayout在哪里设置
- 自定义数据源的GvidView中手动增加的模板列显示问题
- 挑战水晶报表,一个较难的问题,关于动态列
- 请问一个在ASP/ASP.net下,使用MSVC6下ATL写的activeX控件,有什么限制吗?
- www服务器运行的不是ASP.NET 1.1版?(高分)
- 高分求WEB接收传真问题
- 关于在数据库中存放变量的困惑!
- .net中每次做一些改数据状态操作时候都要查询一下状态是否被改掉了吗
- jquery 实现每行数据上面点击出来一个div 并且div有详细链接(主要是。aspx?id=xxx)那个id费劲
select Name 'http://'+Url as NewUrl,CreateTime from xxx第二可以通过GridView1_RowDataBound事件,对这一列加上http,比如 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Text = "http://" + e.Row.Cells[0].Text;
}
}
select Name 'http://'+Url as NewUrl,CreateTime from xxx第二可以通过GridView1_RowDataBound事件,对这一列加上http,比如 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Text = "http://" + e.Row.Cells[0].Text;
}
}
{
Name=t.Field<string>("Name"),
Url=t.Field<string>("Url").StartWith("http")?t.Field<string>("Url"):"http://"+t.Field<string>("Url"),
CreateTime =t.Field<DateTime>("CreateTime ")
});
sql中可以排除 GridView1_RowDataBound 是查询出来数据 然后导出的
{
Name=t.Field<string>("Name"),
Url=t.Field<string>("Url").StartWith("http")?t.Field<string>("Url"):"http://"+t.Field<string>("Url"),
CreateTime =t.Field<DateTime>("CreateTime ")
});指定转换无效
这个字段是否为datatime格式,如果不是,改成string