Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have bind Two Database Fields in my WPF TextBox that are FirstName and LastName in a same text box.
and in my table i have person ID as well.
So how can i select only First Name from the TextBox?
or is it possible to get first name of the person by PersonID?
Please help me out of this.
Posted
Updated 30-Jul-15 23:33pm
Comments
Naz_Firdouse 31-Jul-15 6:34am    
Post the code you used...
Abdul Imran 31-Jul-15 7:53am    
This is my code here:

var brand_qry = (from pd in SvarkWindow.prodlist
join pu in SvarkWindow.produnitslist on pd.Product_id equals pu.Product_id
where pu.position > 0
select pd.Product_name + " " + pd.Manufacturer).Distinct().ToList();


foreach (string item in brand_qry)
{
if (!string.IsNullOrEmpty(Search_txt1.Text))
{
if (item.StartsWith(typedString, StringComparison.CurrentCultureIgnoreCase))
{
autoList.Add(item);
}
}
}


And then i am filling the listBox

if (autoList.Count > 0)
{
lbSuggestion.ItemsSource = autoList;
lbSuggestion.Visibility = Visibility.Visible;
}
else if (Search_txt.Text.Equals(""))
{
lbSuggestion.Visibility = Visibility.Collapsed;
lbSuggestion.ItemsSource = null;
}
else
{
lbSuggestion.Visibility = Visibility.Collapsed;
lbSuggestion.ItemsSource = null;
}
}

But later i am unable to access the first field that is "pd.Product_name" and i am getting both field values .
so help me out of it.

1 solution

Do you want first name in code behind?
 
Share this answer
 
Comments
Abdul Imran 31-Jul-15 5:00am    
Yes i want

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900