Select the RadioButtonList Item Using User Input

 CODE:-


RadioButtonList1.Items.FindByText(dr["column_name"].ToString()).Selected== true;

---------------------------------------------------------------------------------------------------------------------

Implementation:- 

protected void Button3_Click(object sender, EventArgs e)

    {

        myclass m1 = new myclass();


        string cs = m1.connection(); // calling function inside a class 

        cn = new SqlConnection(cs);

        cn.Open();


        string q = "select * from chitransh_table where name='"+TextBox5.Text+"'";

        cm = new SqlCommand(q, cn);


        dr = cm.ExecuteReader();


        if (dr.Read())

        {

            RadioButtonList1.Items.FindByText(dr["city"].ToString()).Selected = true;

        }


        else

        

        {

            dr.Close();

        }

 }

Comments

Popular posts from this blog

Parameter Query

Final Project

Grid View Paging