不支持关键字:'datasource'。 [英] Keyword not supported: 'datasource'.
本文介绍了不支持关键字:'datasource'。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好团队我正在尝试创建两个嵌套的网格视图,在编译我的代码时我得到了这个例外
不支持关键字:'datasource'。
这是我的代码:
受保护 < span class =code-keyword> void GridView1_RowDataBound( object sender,GridViewRowEventArgs e)
{
if (!IsPostBack)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string shipID = Convert.ToString(DataBinder.Eval(e.Row.DataItem, SHIPNO));
GridView GV =(GridView)e.Row.FindControl( GridView3);
SqlDataSource DS = new SqlDataSource();
DS.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings [ ConnectionString]。ConnectionString ; // ConfigurationManager.ConnectionStrings
DS.SelectCommand = SELECT [SHIPNO],[CASENO],[CASENO] FROM [TD_CAS] WHERE [SHIPNO] =' + shipID + ';
GV.DataSource = DS;
// GV.DataSourceID = DS;
GV。的DataBind();
// GV.DataSource = DS;
// gridViewNested.DataBind();
}
}
}
解决方案
查看这篇文章
http://www.mindstick.com/Articles/ 2552ee5c-add6-435d-87ae-57abf42b23be /?GridView%20inside%20GridView%20in%20ASP%20Net%20Nested%20GridView
连接字符串中的一些问题
看看这篇类似的帖子:不支持关键字:' datasource'。 [ ^ 一>
hi team i'm trying to create two nested gridviews and while compiling my code i got this exception
Keyword not supported: 'datasource'.
here is my code :
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (!IsPostBack)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string shipID = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "SHIPNO"));
GridView GV = (GridView)e.Row.FindControl("GridView3");
SqlDataSource DS = new SqlDataSource();
DS.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;// ConfigurationManager.ConnectionStrings
DS.SelectCommand = "SELECT [SHIPNO], [CASENO],[CASENO] FROM [TD_CAS] WHERE [SHIPNO] = '" + shipID + "'";
GV.DataSource = DS;
//GV.DataSourceID = DS;
GV.DataBind();
// GV.DataSource = DS;
// gridViewNested.DataBind();
}
}
}
解决方案
check this article
http://www.mindstick.com/Articles/2552ee5c-add6-435d-87ae-57abf42b23be/?GridView%20inside%20GridView%20in%20ASP%20Net%20Nested%20GridView
some problem in the connection string
have a look on this similar post : Keyword not supported: 'datasource'.[^]
这篇关于不支持关键字:'datasource'。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文