473,585 Members | 2,596 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagridview InsertAt

I have 2 column :
Column1 Column2
A 25
B 20
C 15
D 10
E 5

After i load form, i move current cell to D and my currentcell.row index is 4
grid.CurrentCel l.RowIndex = 4
Then i sort by clicking column2 . And my currentcell.row index is 2.
I add a row by using insertat function :

DataSet ds = (DataSet)grid.D ataSource;
DataTable dt = ds.Tables[0];

DataRow row = dt.NewRow();
row["ID"] = System.Guid.New Guid().ToString ().ToUpper();
dt.Rows.InsertA t(row, base.CurrentCel l.RowIndex + 1);

But due to sort order this row goes to first row.
I don 't want this. I want that empty cell to locate 3 'rd row.
How can i customize that sort and implement this feature ?

Jan 13 '06 #1
0 2321

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
415
by: Derrick | last post by:
Hi all, I've been trying to understand exactly how to insert a newly created DataRow into a DataRowCollection at a specified row value without much luck. At first I was just appending the collection with the Add method. That worked fine, but not the InsertAt method. It always inserts the new row at the end, just like Add did. Thanks for...
0
3117
by: Dave Elliott | last post by:
After inserting a new data row to a DataTable that is bound to a datagrid, I am unable to change data in a row that is after the newly added row without getting bizarre results. I have added the full code for the test below. Create a project drop in the code and run. Any help would be appreciated. Cheers,
5
2945
by: Dave | last post by:
I tried posting this in the WinForm forum and got no hits so I am trying it here. After inserting a new data row to a DataTable that is bound to a datagrid, I am unable to change data in a row that is after the newly added row without getting bizarre results. I have added the full code for the test below. Create a project drop in the...
3
8762
by: Kelvin | last post by:
Hi All, I have some question about inserting new row into datatable. I don't know why my all new rows inserted into end of datatable. I am using myTable.Rows.InsertAt(dr, 0); I don't know what is mean of the pos parameter. I also found problem from MSDN. row
0
1100
by: Kelvin | last post by:
Hi All, I don't why I can't insert new rows between rows, and it can append on buttom record of datatable. With reference my code, Using Rows.InserAt or Rows.Add() is the better. Please advise. // Define DataTable Format DataRow dr2; DataRow dr; DataView myDataView;
1
1569
by: dx | last post by:
Any ideas? I can't find any examples that support this. I'm thinking a solution may be something like inherting arraylist and containing a hashtable. or Inheriting NameObjectCollectionBase and containing an arraylist to use for looping thru in 'order'.
2
8337
by: inpuarg | last post by:
Is it possible that - or is there any workarround for adding a new unbound row to a datagridview at bound mode ? Theese are not working. And i don 't want to add a row to dataset then rebind - cause i want to add this row to a specific location. and it does not match to sort order. Regards. and thanks. ...
1
12159
by: inpuarg | last post by:
Is it possible to disable sort temporarilty ? without changing current row ? I want to add a row to a specific location. But if user sorted the datagridview row goes to a wrong position. That 's why before calling InsertAt() method i want to remove current sorting. Is it possible ?
3
5720
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows few celltemplate property getters and combobox/datecombo constructor calls without database access which does not take a lot of time. Debug...
0
7900
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7943
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8204
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6592
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5382
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3828
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2338
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.