473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Edit On DataBound Datagridview

maheshwag
I have Populate Datagridview by Follow:

Expand|Select|Wrap|Line Numbers
  1. string constr = "server=.;initial catalog=Database;uid=uid;pwd=pwd";
  2.             SqlConnection con = new SqlConnection(constr);
  3.             con.Open();
  4.  
  5.             string sql = " select srno,description,pcs,carat,rate,amount from invcarat where " +
  6.                        " invno= ('" + textBox1.Text + "') and companyID=('" + label1.Text + "')";
  7.             SqlCommand cmd = new SqlCommand(sql, con);
  8.             SqlDataAdapter dap = new SqlDataAdapter(cmd);
  9.             mydataset = new DataSet();
  10.             dap.Fill(mydataset);
  11.             bindingsource1 = new BindingSource();
  12.             bindingsource1.DataSource = mydataset;
  13.             bindingsource1.DataMember =      mydataset.Tables[0].TableName;
  14.             newdgv.DataSource = bindingsource1;
  15.  
  16.  
  17.  
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?.
Sep 10 '11 #1
0 1129

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bill Nguyen | last post by:
I would like to allow user to add new row to a bound DGV. I was able to supply default values for all columns in teh new row. However, as soon as the cursor leaves the new row, the whole row...
1
by: Asif Mohammed | last post by:
Hello, I have a databound datagridview, its allowed to add,remove and edit I type a value in (in new row), it uses e.cancel = true to invalidate the cell .. and does not let focus go away, but...
1
by: Silvester | last post by:
I need to drag drop & copy entire row contents from a Source databound datagridview to a Target unbound datagridview. Source is set to SelectionMode fullrowselect. I am not sure how to achieve...
3
by: sklett | last post by:
I'm changing from a DataGrid to a DataGridView and have run across a problem. The items that are bound to the DataGrid have an int Property that represents a primary key of a lookup table in my...
0
by: cris.b | last post by:
Hi, I have a question about ordering column in a DataGridView. I have a databound DataGridView with the AutoGenerateColumn property set to true. I want to change column's order. At runtime I...
4
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
how do you insert a new row to a databound datagridview? It won't allow this action.
0
by: =?Utf-8?B?TWFya3VzIEhvZmVy?= | last post by:
I habe a DataGridView which is bound to a dataset. I use a method described in some books and several newsgroup messages using a DataView/DataRowView: - START CODE int RowIndex =...
1
by: sklett | last post by:
I've got a strange situation here. I have a databound DataGridView that also has un-bound columns. When the view loads, I want to update the values of the unbound columns. If I attempt to modify...
0
by: Beni.Huber | last post by:
Hi Does anyone know how to edit a databound field timespan field within the xtratreelist? I tried to do this using the scheduler durationedit as repository control, but when i select a value...
0
by: =?Utf-8?B?Tmljaw==?= | last post by:
Hello, I've got a DataGridView that I have bound to a stored procedure. I'm using LINQ, so this is basically what I have (this was created using SQLMetal): public...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.