Reputation: 600
Hi guys im trying to make my textbox to view names on each item i click on my dropdownbox. So I would like to match the result with the dropdown and then display it in the textbox.
I have done this and it seems not working.
var sql = (from query in dwe.VW_CustumAddress
where query.Postal == DropDownListPostal.SelectedItem.ToString()
select query);
if (sql != null)
{
NavnBox.Text = data.Name;
}
Upvotes: 2
Views: 1195
Reputation: 60503
try to debug this one.
var selectedItem = DropDownListPostal.SelectedItem;
if (selectedItem != null) {
var postal = selectedItem.ToString();//check if it looks like something you want
var data = dwe.VW_CustumAddress.FirstOrDefault(m => m.Postal == postal);
if (data != null)
NavnBox.Text = data.Name;
}
Upvotes: 3