protected void Button1_Click(object sender, EventArgs e) { Label1.Visible = true; if (DropDownList2.SelectedIndex == 0 || DropDownList1.SelectedIndex == 0) { Label1.Text = "Select a Valid value"; } else { objBEL = new MasterBEL(); objDAL = new ClassDAL(); objBEL.branch = TextBox1.Text; objBEL.course = DropDownList1.SelectedValue; Label1.Text = objDAL.AddBranch(objBEL); } GridView1.DataBind(); }