Hello Group,
I am working on inserting Rows in the datagrid as follows:
Private Function addHeaderLines(ByVal ds As DataSet) As DataSet
Dim dr, drBlank As DataRow
Dim count, repeatCount, upperBound As Integer
repeatCount = iMaxLines
upperBound = ds.Tables(1).Rows.Count
While count <= upperBound
If repeatCount = 1 Then
drBlank = ds.Tables(1).NewRow
drBlank(1) = "-1"
ds.Tables(1).Rows.InsertAt(drBlank, count + 1)
count += 1
upperBound += 1
repeatCount = iMaxLines
Else
repeatCount -= 1
End If
count += 1
End While
Return ds
End Function
In the itemDatabound event, I assign the rows with the required data
to be inserted as below:
If CType(CType(e.Item.DataItem, DataRowView).Row.Item(1), String) =
"-1" Then
e.Item.Cells(0).ColumnSpan = 14
e.Item.Cells(0).Text = sbHeader.ToString
e.Item.BackColor = System.Drawing.Color.White
End If
sbHeader has a table which needs to be inserted in the empty row.
When I bind the table(1) of dataset ds to a datagrid, the rows seem to
be appended at the end of the datagrid inspite of not allowing the
sort. Not sure why is that happening. Any help with the same is
appreciated!!
Thanks,
Sam. 1 1391
This might get you what you need. http://www.extremeexperts.com/Net/Ar...gdatagrid.aspx
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"sam" <sr*****@mailcity.com> wrote in message
news:5c**************************@posting.google.c om... Hello Group, I am working on inserting Rows in the datagrid as follows:
Private Function addHeaderLines(ByVal ds As DataSet) As DataSet
Dim dr, drBlank As DataRow Dim count, repeatCount, upperBound As Integer
repeatCount = iMaxLines upperBound = ds.Tables(1).Rows.Count
While count <= upperBound
If repeatCount = 1 Then
drBlank = ds.Tables(1).NewRow drBlank(1) = "-1" ds.Tables(1).Rows.InsertAt(drBlank, count + 1) count += 1 upperBound += 1 repeatCount = iMaxLines
Else
repeatCount -= 1
End If
count += 1
End While
Return ds
End Function
In the itemDatabound event, I assign the rows with the required data to be inserted as below:
If CType(CType(e.Item.DataItem, DataRowView).Row.Item(1), String) = "-1" Then e.Item.Cells(0).ColumnSpan = 14 e.Item.Cells(0).Text = sbHeader.ToString e.Item.BackColor = System.Drawing.Color.White End If
sbHeader has a table which needs to be inserted in the empty row. When I bind the table(1) of dataset ds to a datagrid, the rows seem to be appended at the end of the datagrid inspite of not allowing the sort. Not sure why is that happening. Any help with the same is appreciated!!
Thanks, Sam. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rameshika |
last post by:
Hi All
How can I select a particular row in a datagrid.Where when the user double clicks the data in that row should appear in the corresponding text boxes in runtime
And how can the user...
|
by: a |
last post by:
I've read and split a delimited text file into a dataset.
It looks fine in a datagrid (5 columns and 5,000 rows),
but I've been trying, without success, to then insert
the resulting dataset called...
|
by: Sean |
last post by:
HI There,
I am making the transition from asp to asp .net, I am currenty writing an
application that requires a bulk insert from a webform into SQL server,
normally I would just create rows of...
|
by: Primillo |
last post by:
'Full source
'Insert, delete and update don't work
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents Button1 As
System.Web.UI.WebControls.Button
Protected WithEvents...
|
by: Mel |
last post by:
Hi,
I created a form that would search a record from a table
and showed the details in datagrid. I have another button
that would insert the records showed in the datagrid to
another table..How...
|
by: chreo |
last post by:
Hello.
Does anybody had problem with VB application with MS SQL Database?
I have DATAGRID which shows TABLE from DATABASE.
Next I add new ROW to TABLE with SQLcommand (stored procedure)
...
|
by: RG |
last post by:
Using VB.NET, How do I insert rows from a SQL Server table into an Access
table with the same structure (and also the reverse, from Access to SQL)?
I’m new to this, so here’s what I’ve...
|
by: shookim |
last post by:
I don't care how one suggests I do it, but I've been searching for days
on how to implement this concept. I'm trying to use some kind of grid
control (doesn't have to be a grid control, whatever...
|
by: Me LK |
last post by:
I need to add a line to choose a size into a dropdown . Since I have
the dropdown nested inside a datagrid this is not working.When a page
displays there are several rows of dropdowns but only the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
| |