Bind SelectedValue of ASP.net DropDownList to custom object?

I don't know if it's possible to bind the entire object as the SelectedValue . What you could do is bind an unique identifier (e.g. ID) to the DataValueField and retreive your object by it's ID. An other ( very dirty ) solution is to put all the relevant properties (seperated by eg " ; " ) in the DataValueField and construct your object with these values... But, as said, that's really dirty!

;-).

It's possible to assign an object to the DataValueField but it won't "work" since your object it's going to get casted to string. This means that you are going to have the same string value for all your binded options, the value might be the type of your object or simply object. An approach could be the one stated by Pieter Nijs, sepparating by a character the relevant object properties, but like he said this is very dirty.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions