本文介绍了Find Control命令不适用于DetailsView内的Gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



我遇到了关于Gridview的问题,其中包含Dataview Details中的数据。这些是我的代码。



string ShowJobItem =从JobOrderItems中选择JobItemID,JobItemStatus,JobItemName,JobItemDes,JobOrderItems.SizeID,SizeName,JobItemQty,JobItemID =''的大小+ GridView2.SelectedRow.Cells [1] .Text +''AND JobOrderItems.SizeID = Sizes.SizeID;;



DataTable dt = dbconn.QueryExecuteScalar( ShowJobItem);



GridView GV =(GridView)DetailsView1.FindControl(GridViewJobOrderItem);

GV.DataSource = dt;

GV.DataBind();





DataTable dt = dbconn.QueryExecuteScalar(ShowJobItem)出错);它显示此错误





起初,我认为这是因为它无法找到GridView,如果有UpdatePanel封面的DetailView,那么我试图通过删除UpdatePanel来解决这个问题。 (过去效果很好)。但此时,它不起作用。那么有什么建议吗?





感谢您一次又一次的帮助。

Dear All,

I got a problem about Gridview which was contained the Data inside Detailsview. These are my code.

string ShowJobItem = "Select JobItemID, JobItemStatus, JobItemName, JobItemDes, JobOrderItems.SizeID,SizeName,JobItemQty from JobOrderItems, Sizes where JobItemID = ''" + GridView2.SelectedRow.Cells[1].Text + "'' AND JobOrderItems.SizeID = Sizes.SizeID ;";

DataTable dt = dbconn.QueryExecuteScalar(ShowJobItem);

GridView GV = (GridView)DetailsView1.FindControl("GridViewJobOrderItem");
GV.DataSource = dt;
GV.DataBind();


There was an error at "DataTable dt = dbconn.QueryExecuteScalar(ShowJobItem);" It show this error


At first, I think it is because it cannot find the GridView, If there is UpdatePanel cover DetailView, So I tried to solve this problem by remove UpdatePanel. (It used to work well). But At this time, It s not work. So Is there any suggestions?


Thanks for your kindly help again and again.

推荐答案


这篇关于Find Control命令不适用于DetailsView内的Gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:15