or
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
Hello,
Using version 2011.1.11.315 (2011 Q1) and I am using Custom Sorting. When I have a column sorted and then try to group the grid, I get:
"An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" on this line:
var parentRow = e.Row1.Parent
as
GridViewRowInfo;
I have a test project that also does this, but I was not able to open a bug report for some reason.
Any ideas/workarounds?
Thank you,
Aaron
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<?
mso-application
progid
=
"Excel.Sheet"
?>
<
Workbook
xmlns:ss
=
"urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o
=
"urn:schemas-microsoft-com:office:office"
xmlns:x
=
"urn:schemas-microsoft-com:office:excel"
xmlns
=
"urn:schemas-microsoft-com:office:spreadsheet"
>
<
Styles
>
<
Style
ss:ID
=
"CellStyle0"
>
<
Alignment
ss:Horizontal
=
"Center"
ss:Vertical
=
"Center"
></
Alignment
>
<
Font
ss:FontName
=
"Segoe UI"
ss:Color
=
"#000000"
></
Font
>
<
Interior
ss:Pattern
=
"Solid"
ss:Color
=
"#D9E7F9"
></
Interior
>
<
NumberFormat
></
NumberFormat
></
Style
>
<
Style
ss:ID
=
"CellStyle1"
>
<
Alignment
ss:Horizontal
=
"Left"
ss:Vertical
=
"Center"
></
Alignment
>
<
Font
ss:FontName
=
"Segoe UI"
ss:Color
=
"#000000"
></
Font
>
<
Interior
ss:Pattern
=
"Solid"
ss:Color
=
"#FFFFFF"
></
Interior
>
<
NumberFormat
></
NumberFormat
></
Style
>
<
Style
ss:ID
=
"CellStyle2"
>
<
Alignment
ss:Horizontal
=
"Left"
ss:Vertical
=
"Center"
></
Alignment
>
<
Font
ss:FontName
=
"Segoe UI"
ss:Color
=
"#000000"
></
Font
>
<
Interior
ss:Pattern
=
"Solid"
ss:Color
=
"#FFFFFF"
></
Interior
>
<
NumberFormat
ss:Format
=
"gg/mm/aaaa"
></
NumberFormat
></
Style
>
<
Style
ss:ID
=
"CellStyle3"
>
<
Alignment
ss:Horizontal
=
"Right"
ss:Vertical
=
"Center"
></
Alignment
>
<
Font
ss:FontName
=
"Segoe UI"
ss:Color
=
"#000000"
></
Font
>
<
Interior
ss:Pattern
=
"Solid"
ss:Color
=
"#FFFFFF"
></
Interior
>
<
NumberFormat
></
NumberFormat
></
Style
></
Styles
>
<
Worksheet
ss:Name
=
"Lavori"
>
<
Table
>
<
Column
ss:Width
=
"150"
></
Column
>
<
Column
ss:Width
=
"150"
></
Column
>
<
Column
ss:Width
=
"150"
></
Column
>
<
Column
ss:Width
=
"150"
></
Column
>
<
Column
ss:Width
=
"60"
></
Column
>
<
Column
ss:Width
=
"90"
></
Column
>
<
Column
ss:Width
=
"90"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Column
ss:Width
=
"90"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Column
ss:Width
=
"90"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Column
ss:Hidden
=
"1"
ss:Width
=
"50"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Column
ss:Width
=
"50"
></
Column
>
<
Row
ss:Height
=
"24"
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Cliente</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Utente</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Argomento</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Descrizione</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Attivo</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Assegnazione</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Inizio</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Priorità </
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Termine Previsto</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Termine</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Consegna</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Riferimenti_Consegna</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Contratto</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Importo</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Num_Fattura</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Data_Fattura</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Note_Fattura</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>ID_Argomento</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>Consegnato</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle0"
>
<
Data
ss:Type
=
"String"
>D.Revisione</
Data
></
Cell
></
Row
>
<
Row
ss:Height
=
"19"
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"String"
>XXXXX S.p.A.</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"String"
>Vincenzo</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"String"
>YYYYY - VdR Chimico</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"String"
></
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"Boolean"
>1</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle2"
>
<
Data
ss:Type
=
"DateTime"
>1900-01-01T00.00.00.000</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle2"
>
<
Data
ss:Type
=
"DateTime"
>1900-01-01T00.00.00.000</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"String"
></
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle2"
>
<
Data
ss:Type
=
"DateTime"
>1900-01-01T00.00.00.000</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle2"
>
<
Data
ss:Type
=
"DateTime"
>1900-01-01T00.00.00.000</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle2"
>
<
Data
ss:Type
=
"DateTime"
>1900-01-01T00.00.00.000</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"String"
></
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"Boolean"
>1</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle3"
>
<
Data
ss:Type
=
"String"
></
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"String"
></
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle2"
>
<
Data
ss:Type
=
"DateTime"
>1900-01-01T00.00.00.000</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"String"
></
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"Number"
>25</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle1"
>
<
Data
ss:Type
=
"Boolean"
>0</
Data
></
Cell
>
<
Cell
ss:StyleID
=
"CellStyle2"
>
<
Data
ss:Type
=
"DateTime"
>1900-01-01T00.00.00.000</
Data
></
Cell
></
Row
></
Table
></
Worksheet
></
Workbook
>