Turning objects DataSource to a List<>
<p>Attempting to take the data in my gridview and convert it back into a list so I can run an update function. Currently I'm getting a null value when I attempt this.</p>

<pre><code>List&lt;CodeEntity&gt; codes = new List&lt;CodeEntity&gt;();

codes = (List&lt;CodeEntity&gt;)Convert.ChangeType(gdvFGCode.DataSource,typeof(List&lt;CodeEntity&gt;));

Response.Write(codes[0].FGCode);
</code></pre>

<p>Also, Since the Gridview contains 3 template fields all with controls inside, would the datasource returned contain the updated values from the controls or would it return the original List&lt;> pasted into it.</p>

<p>EDIT: The class I'm attempting to return in the list</p>

<pre><code>public class CodeEntity
{

    private string _fgCode;

    private Int16 _palletSet;

    private bool _priority;

    private int _codeState;

    private string _formingCode;

    private string _d4Code;

    public string FGCode
    {
        get { return _fgCode; }
        set { _fgCode = value; }
    }
    public int CodeState
    {
        get { return _codeState; }
        set { _codeState = value; }
    }
    public Int16 PalletSet
    {
        get { return _palletSet; }
        set { _palletSet = value; }
    }
    public bool Priority
    {
        get { return _priority; }
        set { _priority = value; }
    }
    public string FormingCode
    {
        get { return _formingCode; }
        set { _formingCode = value; }
    }
    public string D4Code
    {
        get { return _d4Code; }
        set { _d4Code = value; }
    }

}
</code></pre>
