Need help in c# code

Posted by vaibhav on Stack Overflow See other posts from Stack Overflow or by vaibhav
Published on 2010-06-02T10:08:49Z Indexed on 2010/06/02 10:13 UTC
Read the original article Hit count: 160

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET