Hi,
When you bind a drop-down list to a dataview (consisting of many columns) can you find a value in any column by the selected item?
For example, say I have a dataview dvBuildings that has many columns (e.g. BUILD_ID, BUILD_NAME, ADDRESS). Then I bind a drop down list as follows:
ddlBuilding.DataSource = dvBuildings;
ddlBuilding.DataTextField = "BUILD_NAME";
ddlBuilding.DataValueField = "BUILD_ID";
ddlBuilding.DataBind();
Now user selects an item from the drop down list. I can get the value of selected item as follows:
this.ddlBuilding.SelectedValue.ToString();
Now I need to find the value in the column ADDRESS corresponding to the selected item. How do I do it?
UPDATE: I thought about this and see that what I am asking is not possible. The only to get the value is from the dataview (dvBuildings) itself. And since the dataview in Submit is not in scope I cannot do it. So I will have to make and "extra" trip to the DB to get the value.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham