Detailsview itemupdating dropdownlist

When the Details View control is bound to a data source control, the Details View control can take advantage of the data source control's capabilities and provide automatic updating, deleting, inserting, and paging functionality. Input controls that are appropriate for the field's data type (such as a Text Box or a Check Box control) are displayed with a field's value for the user to modify. The Details View control provides built-in capabilities that allow the user to update, delete, insert, and page through items in the control. In edit mode, the Edit button is replaced with an Update and a Cancel button.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.

Paul Kimmel is the VB Today columnist for has written several books on object-oriented programming and . Paul Kimmel is a Technical Evangelist for Developer Express, Inc, and you can ask him about Developer Express at [email protected] read his DX blog at

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.

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 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.

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.

In my previous article Details View Rich Data Control we have learned how to use Details View using SQLData Source data control...

Tags: , ,