Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have a problem that the dropdownlist just showing me one value even there is more than one like this one i have Gender (Male and Female).

C#
DataTable tb1 = SQLHelper.Instance.getinfo("select GENDER_ID, GENDER_TYPE from gender");
        for (int i = 0; i < tb1.Rows.Count; i++)
        {
            string T = tb1.Rows[i][0].ToString();
            if (m == T)
                DropDownList1.Items.Add(new ListItem(tb1.Rows[i][1].ToString(), tb1.Rows[i][0].ToString(),true));
            else
                DropDownList1.Items.Add(new ListItem(tb1.Rows[i][1].ToString(), tb1.Rows[i][0].ToString(),false));
        }


Thanks In Advance
Posted
Updated 9-Mar-12 21:50pm
v2
Comments
Dean Oliver 10-Mar-12 5:31am    
what does your Rows.Count bring back? 2 values?

1 solution

If you get data into datatable, try to bind data[^].
 
Share this answer
 

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