Control Panel
Forum
Hosting Help
ASP.NET 4 & SQL 2008 R2 Hosting
Resources
Notice
Login
Members
Shared Hosting
|
Upgrade
|
Advertise
|
Tutorials
|
AdSense revenue sharing sites
|
Exam 70-680 Practice Tests
|
Silverlight games
Total
members
:
210363
Average new registrations per day (in last 7 days):
16
New Registration:
Open
Register Now
Home
»
Questions & Answers
»
Taking Attributes from Gridview1 and Inserting it into GridV...
Taking Attributes from Gridview1 and Inserting it into GridView2 as Column HeaderText
4/8/2010
Author:
Gurmesh Singh
Hey all,
I would like to mention I a newbie. I'm doing this in codebehind because I am not using SQLDataSource.
Umm.. i hope you guys understand what im actually trying to do. Im trying to assign column HeaderText of GVReport with the values from GVDistinctDate.
Below is a visual representation of what im trying to do. Really hope you would refer to it and get back to me ASAP.
Thank you for your time and help.
GVDistinctDate
TakenDate
03/04/2010
04/04/2010
05/04/2010
GVReport
StudentID 03/04/2010 04/04/2010 05/04/2010
ID12345 Present Present Absent
ID34565 Absent Present Present
I realise that the attributes in GVDistinctDate are being assigned to headerText variable, but i keep having this problem over here : GVReport.Columns(k).HeaderText = headerText
The error is : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Any ideas anyone? Thank you.
This is the coding for that part :
command.CommandText = SELECT DISTINCT StudentID FROM & strTableName & ORDER BY [StudentID]
MsgBox(command.CommandText)
Dim k As Integer = 1
Dim i As Integer = 0
While i < GVDistinctDate.Rows.Count
Dim headerText As String = GVDistinctDate.Rows(i).Cells(0).Text
If Not (headerText = ) Then
MsgBox(headerText)
'GVReport.Columns(k).HeaderText = headerText
'GVReport.DataBind()
Else
MsgBox(error)
End If
'k += 1
i += 1
End While
r = command.ExecuteReader
GVReport.DataSource = r
GVReport.DataBind()
Thank you for your replies.
Answers .............
You must
login
to post answer for this question.
Advertise
Privacy Policy
Terms of use
Contact Us
SpiderWorks Technologies Pvt Ltd.
All Rights Reserved.