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
{
SqlCommand cmd = new SqlCommand("select * from tbl_abc", con);
cmd.CommandType = CommandType.Text;
SqlDataReader dr = cmd.ExecuteReader();
List
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
Jagjit SainiPosted Aug 23, 2011, 2:28 AM
I want when gridview is displayed in window after clicking on Find Button , user should select a particular record and then that record information is displayed in textboxes on first form . Then user can Update or Delete that record.
Thanks
Biswa Pujarini MohapatraPosted Aug 23, 2011, 2:18 AM
public List
{
SqlCommand cmd = new SqlCommand("select * from tbl_abc", con);
cmd.CommandType = CommandType.Text;
SqlDataReader dr = cmd.ExecuteReader();
List
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;
}
Ex - var filterList = disp_rec().Select(p=>p).where(s=>s.pcomname.equals("xxx")).ToList();
filterList will give you the filter record which matches with "xxx"
then bind filterList to gridview.
Mark as correct answer if it is as per your requirement