Re: requiring code for c#
Give you code? No chance. You won't learn if I write code for you.
Try starting here: http://dotnetaid.com/2011/08/23/data...c-net-winform/
Re: requiring code for c#
sir , i already done these things and in a very advanced level , i done all the functionality , whatever u given is at very basic level .
my project is completed but only this fuctionality is not there such that if the user click the drop down arrow of txtbox employee id , the textbox starts showing all the values in datatable column employee id.
atleast u can help me over here for this small thing.
Re: requiring code for c#
1) Create a combo box and populate it as such:
a) Get a list of employees from your database and create an Employee object for each setting it's properties as required
b) Use this list of employees to add items to your combo box
Pseudo code:
Code:
foreach(Employee emp in EmployeeList)
{
1) set combo box item Tag property = emp and Text property = emp.Name (or whatever you want to be displayed to the user)
2) add item to combo box
}
2) Databind your grid view to the employee list (all items)
3) On the selected index changed event of the combo box do the following:
a) Get an Employee object from the Tag (Employee myEmp = (Employee)item.Tag)
b) Use a linq query on the original list using the myEmp.Id property as such
List<Employee> myEmps = empList.Where(emp => emp.Id = myEmp.Id)
c) use this list to databind your grid view again, this will allow you to achieve filtering as you specify
I'll let you write the code, you can Google most of the things i've said to get examples.
This is by no means the best solution. But it will do what you want and is fairly easy to implement.
Re: requiring code for c#
I'm assuming you mean you have a ComboBox that you want bound to a column in your database.
1. Get the data in a DataTable.
2. Set the .DataSource, .DisplayMember and .ValueMember properties of the ComboBox.