¥¥¥ 我想把Sring[]绑定到GridView上,问题是:DataField怎么设置?在线等 我想把Sring[]绑定到GridView上,问题是:DataField怎么设置?因为string[]没有字段名 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 字段名设置成为!(感叹号)更多资料:http://www.34v.com 直接后台DataSource=不设字段名 GridView有一个事件:RowDataBound protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if(((Label)e.Row.FindControl("FlagLabel"))!=null) { Label adlabel = (Label)e.Row.FindControl("FlagLabel"); if(adlabel.Text =="1") adlabel.Text = "管理ユーザ"; if (adlabel.Text == "0") adlabel.Text = "普通ユーザ"; } }这是我项目里面的代码,粘贴给你,希望能够帮助你! DataTable dt = new DataTable();dt.Columns.Add(new DataColumn("id"));string[] str = {"1","2","3"};for (int i = 0; i < 3; i++){ DataRow dr = dt.NewRow(); dr["id"] = str[i]; dt.Rows.Add(dr);} paging 问题 编码转换 请检测一下我的网站,谢谢 VSS可恶的地方,签入BIN中的DLL就这么纠结? javascipt接收webservice传来的DataSet对象的问题? 数据库中建一个字段存网址(URL)用什么类型 高手快来! 用C#向数据库导入Excel。数据库数据比Excel多一倍,为什么? 关于treeview控件在visual studio"设计"标签下的显示问题 如何用JavaScript获取用ASP.net设置的Session值? 正则问题,高手帮忙 怎么看DLL代码
更多资料:http://www.34v.com
不设字段名
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(((Label)e.Row.FindControl("FlagLabel"))!=null)
{
Label adlabel = (Label)e.Row.FindControl("FlagLabel");
if(adlabel.Text =="1")
adlabel.Text = "管理ユーザ";
if (adlabel.Text == "0")
adlabel.Text = "普通ユーザ";
}
}这是我项目里面的代码,粘贴给你,希望能够帮助你!
dt.Columns.Add(new DataColumn("id"));
string[] str = {"1","2","3"};
for (int i = 0; i < 3; i++)
{
DataRow dr = dt.NewRow();
dr["id"] = str[i];
dt.Rows.Add(dr);
}