I have Populate Datagridview by Follow:
string constr = "server=.;initial catalog=Database;uid=uid;pwd=pwd";
SqlConnection con = new SqlConnection(constr);
con.Open();
string sql = " select srno,description,pcs,carat,rate,amount from invcarat where " +
" invno= ('" + textBox1.Text + "') and companyID=('" + label1.Text + "')";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataAdapter dap = new SqlDataAdapter(cmd);
mydataset = new DataSet();
dap.Fill(mydataset);
bindingsource1 = new BindingSource();
bindingsource1.DataSource = mydataset;
bindingsource1.DataMember = mydataset.Tables[0].TableName;
newdgv.DataSource = bindingsource1;
It works fine and display all the data but problem is that it not allow me to edit directly.
Suppose If I want to edit srno columns first row than it wan't allow and when I move to down row and then again come to same row than it allow me to edit.
Why it not allow me to edit directly. Why I have to move to down row and come againt same row to edit?.
Sam HobbsPosted Sep 11, 2011, 4:00 AM
I am not sure what you want to do. Everything I suggested is good but what you have is also good. If you are sure you want to do it the way you are doing it then I will try to help or hopefully someone will help.
Please try to use the articles that are available in this web site then ask for help if none of the articles can.
mahesh waghelaPosted Sep 11, 2011, 2:32 AM
Sam
I think your suggestion also good to imply but still I am confuse of this type of behavior of DataBound Datagridview. Is there fault in mechanism?.
Sam HobbsPosted Sep 10, 2011, 1:59 PM