c# - Grid View in aspx -


i have code of grid view in aspx.cs show error, cannot understand how solve, please can me? error picture attached.enter image description here

a gridview can have 1 datasource. since setting datasource programmatically remove datasourceid aspx part since used declarative datasource controls sqldatasource or objectdatasource.

for example:

<asp:gridview id="customersgridview"    datasourceid="customerssource" <-- !!! remove !!!    autogeneratecolumns="false"   emptydatatext="no data available."    allowpaging="true"    runat="server" datakeynames="customerid">     <columns>         <asp:boundfield datafield="customerid" headertext="customerid"              insertvisible="false" readonly="true" sortexpression="customerid" />         <asp:boundfield datafield="companyname" headertext="companyname"              sortexpression="companyname" />         <asp:boundfield datafield="firstname" headertext="firstname"              sortexpression="firstname" />         <asp:boundfield datafield="lastname" headertext="lastname"              sortexpression="lastname" />     </columns> </asp:gridview> 

Comments