Tuesday, September 24, 2013

dropdown selected value

 int id = (int)GridView1.DataKeys[e.NewSelectedIndex].Values["id"];
            if (id == 1)
            {
                DataTable dt = new DataTable();
                RecBAL rb = new RecBAL();
                dt = rb.getFullData();
                DropDownList1.DataSource = dt;
                DropDownList1.DataTextField = "username";
                DropDownList1.DataValueField = "id";
                DropDownList1.DataBind();
            }

No comments: