Jagjit Saini

Jagjit Saini

  • NA
  • 166
  • 0

Display Records

Aug 23 2011 2:05 AM
Hi

  I have one field code and find button in front of it . There are other text boxes & buttons etc. I want when user click on Find Button (window should display not page)  in which it should list all the records in gridview from a table .  When user select/click particular record it should display data of that selected record in the first form.

I have used list to display records in gridview
 public List<nsBo.clscomprp> disp_rec()
  {
  SqlCommand cmd = new SqlCommand("select * from tbl_abc", con);
  cmd.CommandType = CommandType.Text;
  SqlDataReader dr = cmd.ExecuteReader();
  List<nsBo.clscomprp> obj = new List<nsBo.clscomprp>();
  while (dr.Read())
  {
  nsBo.clscomprp k = new nsBo.clscomprp();
  k.pcomcode = dr[0].ToString();
  k.pcomname = dr[1].ToString();
 k.paddress1 = dr[2].ToString();
  obj.Add(k);
  }
  dr.Close();
  cmd.Dispose();
  con.Close();
  return obj;
  }

This is Web Based requirement.
Thanks

Answers (2)