Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void btnsearch_Click(object sender, EventArgs e)
  {
   //   txtid.Enabled = true;

      var chk = context.Students.FirstOrDefault(x=> x.StudentId == Convert.ToInt32(txtid.Text));

      if (chk != null)
      {
          txtname.Text = chk.Name;
          txtrollno.Text = chk.Rollno.ToString();
          ddlcity.SelectedValue = chk.City;
          ddlqualification.SelectedValue = chk.Qualification;
          RBGender.SelectedValue = chk.Gender;
      }
      else
      {
          Response.Write("<script>alert('No such recourd found')</script>");
      }


Error -> Exception has been thrown by the target of an invocation.

guys help me out of this
Posted
Comments
Zoltán Zörgő 8-Feb-15 17:01pm    
On which code line exactly?
George Swan 9-Feb-15 14:58pm    
I suggest that you check the inner exception.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900