Glad you’re making progress.
I’d like to point out, and forgive me if you already know this but, unless you have a very compelling reason I would stick with a GridView over a DataList. DataList is ASP.NET 1.1 era technology and GridView is ASP.NET 2.0 era. With ASP.NET 2.0 Microsoft made a big push to “Get more done with less code” and GridView is a, IMHO, fine example of that. Amongst many other handy features (paging, sorting) GridView will keep track of the IDs for you and handle all communication between it and it’s friend (sqlDataSource). With a DataList you have to do all the coding to store every value, and handle the edit/delete functionality.
(…steps off soap box…)
Back to your problem at hand, you’ll need to have a control in your edit item template for every field you need to keep track of. Edit items don't necessarily have to be textboxes. For your ID you don’t typically want anyone to edit it, so I would use a label to hold the ID or a “disabled” textbox.
Then in your code before you call “templateController.Template_Update” every field that is needed for the update (i.e. every field in the Update function of your Controller class) must be in the collection. And because DataList doesn’t do any of the work for you… it’s up to you to make sure that each value is sent. i.e.
_ModuleNameInfo_data.FieldName = _tb1.Text.ToString()
'etc. for all controls
After that if your still getting an “Object reference not set to an instance of an object” error double and triple check your “Args.Item.FindControl(“FieldName”)” lines. Those will throw Object reference errors like crazy if you give them the wrong name. You can also do a little of this:
If Not Args.Item.FindControl("FieldName") Is Nothing Then
Dim _tb1 As TextBox = Args.Item.FindControl("FieldName")
End If
To check and see if the control exists before you try and pull data from it.
-- Nathan Rover
edited for spelling.