4
Answers

RadioButton List

Pal

Pal

16y
5.3k
1

Hi! can anyone tell me what wrong with following c# code. I am getting an error like - CS0117: 'object' does not contain a definition for 'Add'

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Object mycountries = new Hashtable();
                       
            mycountries.Add("N", "Norway");
            mycountries.Add("S", "Sweden");
            mycountries.Add("F", "France");
            mycountries.Add("I", "Italy");
            rb.DataSource = mycountries;
            rb.DataValueField = "Key";
            rb.DataTextField = "Value";
            rb.DataBind();
        }
    }

Answers (4)