ASP.NET - check checkbox in gridview - Asked By msakt on 08-Jun-12 04:40 AM

in table 

Id = 34,194,313,327,328


gridview bind all vale from table  but above id member record check box select when dropdown select
Jitendra Faye replied to msakt on 08-Jun-12 04:43 AM
Bind this function in CheckBox click event in client side.

Try like this-

<script type="text/javascript">

function funCheck(src, args) {
var val= document.getElementById('<%=ddl1.ClientID %>');
if (val.value="")
{
alert(" first select any value");

return false;

}
else

{

  return true;

}

}
</script>

dipa ahuja replied to msakt on 08-Jun-12 06:57 AM
void bindDropDonw()
{
  string ConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
  SqlDataAdapter da = new SqlDataAdapter("select empid from emp", ConnString);
 
  DataTable dt = new DataTable();
  da.Fill(dt); // Fill the dataset
 
  DropDownList1.DataSource = dt;
  DropDownList1.DataValueField = "empid";
  DropDownList1.DataTextField = "empid";
  DropDownList1.DataBind();
  DropDownList1.Items.Insert(0, "-Select-");
    
}