The difference is that Bind is a two-way bind (read and write) and Eval is a one way bind (read-only) from the Data Source. Item Updating Dim control As Drop Down List = Form View1. If you use Eval then remember that the Drop Down List is in a template of the Form View, so you have to get the actual Drop Down List by calling Find Control and setting the updated value to the e. The running form is shown in Figure 3, and the ASP.If you use Eval as shown above then you will have to set the value when it changes in the Form View Ittem Update event (see Listing 1). NET showing all of the elements generated by the designer (or added by you) is provided in Listing 2.

formview itemupdating e newvalues-69

I just finished a small commitment with the Lansing Give Camp, which was sponsored in part by Developer Express and am looking forward to seeing some of you at Tech Ed in Los Angeles.

Check out our Developer Express area and make sure you sign up for our giveaways.

If you switch Eval to Bind for the Selected Value then no code-behind is required. It took me a couple of hours to work out the details in a manner I was happy with.

Protected Sub Form View1_Item Updating(By Val sender As Object, _ By Val e As System. The key to binding is the second Data Source for the lookup and understanding the difference between Bind and Eval.

The Drop Down List should be configured to look like the ASP. The Data Source ID for the Drop Down List points at Customer IDData Source.

The Data Value Field and Data Text Field's are assigned to Customer ID and Company Name respectively, and lookup values will come from the Customers table.

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.

Item Updating Also, don't forget to assign the sqldatasource as the formview's datasource in each postback, otherwise your formview's datasource would be nothing.