3 questions
1. Why can I not simply set the datasource for the load-on-demand child grid. As opposed to needing
to build each grid row from the corresponding datarow.
In the code below I'd like to simply set the datasource as in the second line of code. But I have to
build each row as in the remaining lines of code. Why can't I simply use the datasource?
2. I specify each column in the columns collection editor (same as ".Cells" below) of the grid's first
template, things like Name, HeaderText and FieldName. If I remove Name in the columns collection editor,
the code below won't work. (FieldName doesn't seem to be needed.) So somehow this thing called
SourceCollection is connection to the template. What is the connection?
3. I'm trying to set the first item's (called DueDate) FormatString to {0:dd/MM/yyyy}. If I don't set it,
DueDate displays with hour/minute/second (which is zero). If I do set it in the collection editor,
same result. I can't seem to set it in code (in ".Cells"). How can I set FormatString?
--------------- code snippet from RowSourceNeeded below ----------------
Dim
dt
As
DataTable = .FillTable(
"usp_SelectPTA2_TicketAssignments"
)
'e.Template.DataSource = dt
''' why do I need the rest of this code?? '''
For
Each
dr
As
DataRow
In
dt.Rows
Dim
row
As
GridViewRowInfo = e.Template.Rows.NewRow
With
row
.Cells(
"DueDate"
).Value = dr(
"TICKET_DUE_DATE"
)
.Cells(
"AssignTo"
).Value = dr(
"AssignedTo"
)
.Cells(
"Reason"
).Value = dr(
"TICKET_DUE_DATE_CHANGE_REASON"
)
.Cells(
"Notes"
).Value = dr(
"TICKET_ASSIGMENT_NOTES"
)
.Cells(
"AssignedBy"
).Value = dr(
"AssignedBy"
)
.Cells(
"AssignedDate"
).Value = dr(
"TICKET_ASSIGNED_TO_DATETIME"
)
End
With
e.SourceCollection.Add(row)
Next