Sakthis

Sakthis

  • NA
  • 50
  • 18.7k

populate data from listview to radiobutton?

Oct 11 2013 3:53 PM
Hi,

How to populate listview data to radio button like gender column? 

I have listview like id, name, gender, i easily populate id, name respectivly to textbox but i am not sucess when i populate gender(male, female) field to radio button?

can u anyone help me? 

here my code:

  private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                ListViewItem lvi = listView1.SelectedItems[0];
                txtEmpCode.Text = lvi.SubItems[0].Text;
                txtName.Text = lvi.SubItems[1].Text;
                if (Male.Text == "Male") // Male is radio button name
                {
                    Male.Visible = true;
                    Female.Visible = false;
                }
                else if (Female.Text == "Female") // Female is radio button name
                {
                    Male.Visible = false;
                    Female.Visible = true;
                }
            }
            else
            {
                txtEmpCode.Text = string.Empty;
                txtName.Text = string.Empty;               
            }          
        }

Answers (2)