Form View and SQL Datasource is awesome in my opinion. Return sql Return Catch ex As Exception Throw ex End Try End Function The problem is that how does databinding work? You can just bind your controls to data field in the markup, its great. It won't work the same way as having the sql data source in the markup. Well here is a trick to do it: For example, to Update, handle the Form View's Item Updating event, and then loop through each value in the Update Parameters list in the sqldatasource, and manually assign each value from e. Private Sub frm Data_Item Updating(By Val sender As Object, By Val e As System. I started off with creating one object datasource and bind it to my formview, then i set dropdownlist datasource property with another objectdatasource. Item Updating Dim drp As Drop Down List drp = Form View1. Actually this caused an error telling that i cannot declare a datasource property for the dropdownlist in formview. Initially, the insert and update methods were returning an “envelope” object that contained a list of any BLL errors that were caught from server-side validation.Everything worked fine using this approach except for retaining the values in the Form View that the user had changed before the last insert or update action.Then i deleted datasource property and used datasource ID property for the dropdownlist. And for the setting selected value issue, i used formviews itemdatabound event. My sample datatables are as follows : teachers table : PKID | name | lastname | department(int) departments table : PKID | department Name I created my dataaccesslayer using dataset designer and in the presentation layer i created two object datasource configured to get data from teachears and departments table respectively.
Many of these smaller applications can take advantage of the simple data-binding techniques built into the Visual Studio ASP. These applications can be created quickly, typically do not require much testing, and allow developers to focus on solving business problems rather than building frameworks and reusable objects that might never realize the goal of reusability. Applications that can benefit from this approach often have a common profile: they typically have compressed schedules, are meant to be websites from beginning to end, and might fill a somewhat temporary need.This property should be assigned with the Primary Key of the database table. We cannot retrieve the datakey values as the data is not yet bound to the details View control.