Need help in c# code
- by vaibhav
I have a function
protected void bindCurrencies(DropDownList drp)
{
drp.DataSource = dtCurrencies;
drp.DataTextField = "CurrencyName";
drp.DataValueField = "CurrencyID";
drp.DataBind();
drp.Items.Insert(0, new ListItem("Please Select"));
}
I am binding a dropdown list using this. But sometimes I need to bind a ListBox also. I dont want to write a different function for listbox. How should I do this. I think Generics method is to be used here. But I dont have any idea about generics.