InsertAt New Row in GridView (Adjust the Data Table to add Grid Rows to arbitrary positions)

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
106
Programming Experience
1-3
Hello.

Does GridView have this InsertAt ?

C#:
DataTable dt = new DataTable();

dt.Columns.Add("NO", typeof(int));
dt.Columns.Add("NAME", typeof(string));
dt.Columns.Add("HIREDATE", typeof(DateTime));
dt.Columns.Add("SALARY", typeof(int));

dt.Rows.Add(100, "Steven", "2003-06-17", 24000);
dt.Rows.Add(101, "Neena", "2005-09-21", 17000);

DataRow row = dt.NewRow();

row["NO"] = 104;
row["NAME"] = "Bruce";
row["HIREDATE"] = "2007-05-21";
row["SALARY"] = 6000;

dt.Rows.InsertAt(row, 1);

====================

I want to add GridView-B Rows to the row below 8 o'clock in GridView-A.

How should I program the algorithm for the GridView?

I'm not asking the InsertAt of the DataTable.

there are InsertAt of GridView?

attached file : gridview.png
 

Attachments

  • gridview.png
    gridview.png
    11.1 KB · Views: 2

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
4,431
Location
Chesapeake, VA
Programming Experience
10+
It's always good to look at the documentation. Does the documentation show an InsertAt()?
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
4,431
Location
Chesapeake, VA
Programming Experience
10+

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
106
Programming Experience
1-3
It's always good to look at the documentation. Does the documentation show an InsertAt()?
There is no InsertAt in the document(GridView Class (System.Web.UI.WebControls)) you taught me.
I hope the grid's insertat function.
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
106
Programming Experience
1-3

cbreemer

Well-known member
Joined
Dec 1, 2021
Messages
49
Programming Experience
10+
GridView.CreateRow() has a rowIndex parameter. This seems to suggest you can insert a row anywhere. I could be wrong though, and the documentation does not mention it. You may want to try it out.
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
106
Programming Experience
1-3
The Telerik radGrid for WebForms seems to support drag/drop to it seems like it should support inserting between rows:

I am using Telerik:RadGrid in ASP.NET

In Telerik:RadGrid, Isn't there a function other than that of Telerik:RadGrid Drag/Drop?

telerik radgrid.png
 
Top Bottom