I'm trying to teach myself MVC, and i'm having issues with the code behind.
In my current issue, I'm trying to bind data to a gridview. Now, I have been able to do it by creating page_load method in my aspx.
<script language="CS" runat="server">
void Page_Load(object sender, System.EventArgs e)
{
grdMyGrid.DataSource = Model.getAllRecords();
grdMyGrid.DataBind();
}
</script>
This works, however, in my mind this can't be right. I have been forcing myself for the last year to make sure all binding are happening in the code behind, and all the MVC samples I have found show doing a databind in the aspx! (though they are all limited to textboxes). So what is the right method for doing this?
Thanks