skip to content »

Asp net formview itemupdating e newvalues

Bind and Eval perform approximately the same function, reading data from a data source. Selected Value End Sub Use Bind for the Drop Down List Selected Value and the code in Listing 1 is not needed. Modify the Customer ID by picking a Customer from the Drop Down List and click the Update button provided by the Form View designer.

asp net formview itemupdating e newvalues-6asp net formview itemupdating e newvalues-31

Next you will need to configure the data source for the Drop Down List and bind the Drop Down List to the source for the list items and the source for the selected value.An old friend of mine, Joe Shook, laughingly said, “you should read what other people write too once in a while.” Of course, he was right and naturally I do. I read almost everything I can get in my hands including technical books, blogs, and articles because I am surprised by the number of things I haven't mastered or that I still don't have a “best practices” sort of solution for. Thankfully I am still willing to stay up to 11 or 12 o'clock—used to be until the next morning—working out the details of what I don't know until I am happy with an answer.A friend of mine actually asked me about this particular problem: what is a good way to bind a Drop Down List in a Form View.The Edit Item Template will contain Text Box controls by default.The Text Box controls provide basic data entry support for editing a record.Here are the steps: The last steps require that you bind the Data Text Field and Data Value Field properties to the Customer IDData Source and the Selected Value to the original source's Customer ID.

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.

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.

Bind reads and writes and Eval only reads from the Data Source.

The edit template contains a Drop Down List and the population, binding, and updating is all handled declaratively. After you complete the data source wizard the Form View will have controls added to it for the Item Template, Edit Item Template, and Insert Item Template.

It is the Edit Item Template you are interested in.

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.