Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Visual Studio 2013 - Binding to a GridView Programmatically

$
0
0

Hello, everyone. I'm working on a project in Visual Studio 2013, where I'm trying to bind to a GridView control programmatically using EF but when I click the button the GridView does not appear on the page. The code behind I'm using is:

<code>
 var students = from st in academyDb.AcademyStudents
                           select st;

            studentsGridView.DataSource = students.ToList();
            studentsGridView.DataBind();
</code>

I've tried this both with and without the DataBind() method, but the GridView still doesn't appear on the page. As a matter of course, I also tried similar code using Visual Studio 2010 and it works! I've searched Google and MSDN for two days and I still can't find anything (other than various ways using ADO.NET code) that explains how to make this work in Visual 2013. Can someone please point me to information about how to make this work in VS2013 (or if it's not possible what the alternative is)? 

Any help is GREATLY appreciated.  :)

Andre


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>