Currently I’m writing an ASP.net webforms app, which works with a table containing 15 fields.
I’m using LINQ to SQL which is very good to use and everything, but when i need to bind the fields with the text boxes (15 of em), whats the best way currently I’m doing this
...
...
var stud = db.Students.SingleOrdefault(d => d.ApplicationNo == 32)
textbox1.Text = stud.Name;
...
...
I feel like I’m “missing the point”. Please advise on the best way to do this.
- Also what should i do to implement
the Move next and move previous
functionality like a recordset
i mean how can i move to the next/previous “student” in db.Students collection.
You can bind to an ASP.NET DetailsView control; this control supports displaying one record at a time, and can page through the results, so you don’t have to do all that extra work. You could also consider a FormView too, but you have to control that.
I think you have the right approach; you could also use ElementAt() to retrieve by an index; that can have some performance implications though.
HTH.