2014-08-28 18 views
0

「gvStoreInventry」上定義了DataSource和DataSourceID。刪除一個定義。 我無法檢測到錯誤。請幫助DataSource和DataSourceID都是在'gvStoreInventry'上定義的。刪除一個定義

protected void btnShowData_Click(object sender, EventArgs e) 
     { 
      string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; 
      using (SqlConnection con = new SqlConnection(CS)) 
      { 
       SqlCommand cmdShowData = new SqlCommand("SELECT * FROM tblStoreInventory", con); 
       con.Open(); 
       gvStoreInventry.DataSource = cmdShowData.ExecuteReader(); 
       gvStoreInventry.DataBind(); 
      } 
     } 

回答

2

元素卸下DataSourceID如果你想手動設置它後面的代碼。

<asp:TheUserControl ID="gvStoreInventry" runat="server" 
    DataSourceID="TheDataSourceID" /> 
      <!-- ^^^^^^ --> 
     <!-- Remove This --> 
</asp:TheUserControl> 
0

轉到ASPX設計師 選擇gvStoreInventry

F4 - > Proporty窗格應該彈出式視窗

安排資產面板AZ從Proporty窗格AZ鏈接的頂部wize 。

查找的DataSourceID - > 如果有一些事情取悅空白填充

相關問題