问题
I have a basic test web form with a DataList and a DetailsView and two XmlDataSource components for each of them.
The binding of the DataList to the underlying XML document was easy to set up, but I'm struggling with getting the DetailsView hooked up. The idea is that there is a master/details relationship between the two bindable controls, so I guess I should hook onto the OnSelectedItemIndexChanged on the DataList to do the binding of the currently selected item in the DetailsView. But what is the correlating key / how do I set a DataKeyField when I use a XmlDataSource to get this to work?
cheers,
--larsw
回答1:
Wow! I'm doing exactly that right now but using Object Data Source :)
I am following a great tutorial on that from Matt Berseth, check his post.
It will be almost the same, the only thing is that you use other DataSource, but the rest is the same!
回答2:
I'm not sure , But look at these links , hope to help :
http://www.eggheadcafe.com/tutorials/aspnet/d89d1d96-03f1-4784-bbb2-a3db1af393f5/aspnet-datalist-and-data.aspx http://safari.informit.com/9780735625273/index?indexview=D http://my.safaribooksonline.com/0735621764/index?indexview=D http://blogs.msdn.com/adrianvinca/archive/2006/02/15/532449.aspx http://safari.informit.com/9780735625273/index?indexview=D
来源:https://stackoverflow.com/questions/400051/master-details-view-with-xmldatasources