本文介绍了不支持关键字:'datasource'。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 你好团队我正在尝试创建两个嵌套的网格视图,在编译我的代码时我得到了这个例外 不支持关键字:'datasource'。 这是我的代码: 受保护 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 exceptionKeyword 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 articlehttp://www.mindstick.com/Articles/2552ee5c-add6-435d-87ae-57abf42b23be/?GridView%20inside%20GridView%20in%20ASP%20Net%20Nested%20GridViewsome problem in the connection stringhave a look on this similar post : Keyword not supported: 'datasource'.[^] 这篇关于不支持关键字:'datasource'。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-26 05:43