Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
SqlDataAdapter da = new SqlDataAdapter(q0, constr);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();


error :
Quote:
'System.Windows.Forms.DataGridView' does not contain a definition for 'DataBind' and no extension method 'DataBind' accepting a first argument of type 'System.Windows.Forms.DataGridView' could be found (are you missing a using directive or an assembly reference?)
Posted
Updated 8-Jul-14 16:07pm
v2
Comments
Richard C Bishop 9-Apr-14 10:45am    
Does the gridview exist on the page already?
Member 10728784 9-Apr-14 11:56am    
yes
DamithSL 8-Jul-14 22:13pm    

1 solution

Just remove the line involving DataBind - setting the DataSource will display the data.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900