[Flags]
public
enum
MyType :
short
{
None = 0,
NseFO = 1,
BseFO = 2,
NseCM = 4,
BseCM = 8,
NseCD = 16,
Use = 32,
}
private
void
Form1_Load(
object
sender, EventArgs e )
{
//DataColumn dt =new DataColumn("Value",typeof (Test));
//dt.DataType = typeof (Test);
//dttemp.Columns.Add(dt);
dttemp1.Columns.Add(
"ID"
,
typeof
(
int
));
dttemp1.Columns.Add(
"Value"
,
typeof
(
int
) );
//DataColumn dt = dttemp.Columns["Value"];
//dt.DataType = typeof (Test);
////dttemp.Columns.Add(dt);
dttemp1.Rows.Add(0, 0);
dttemp1.Rows.Add( 1, 1 );
dttemp1.Rows.Add( 2, 2 );
dttemp1.Rows.Add( 3, 3 );
dttemp1.Rows.Add( 4, 4 );
dttemp1.Rows.Add( 5, 5 );
temp2 = dttemp1.Clone();
DataColumn dcolumn = temp2.Columns[
"Value"
];
dcolumn.DataType =
typeof
( ExchangeType );
DataTable dtfinal = temp2.Clone();
foreach
( DataRow row
in
dttemp1.Rows )
{
temp2.Rows.Add( row.ItemArray );
}
DataView filter =
new
DataView(temp2);
dataGridView1.DataSource = filter;
c1Flex1Grid.DataSource = filter;
radGridView2.DataSource = filter;
}
calendar.CurrentViewColumn = colForCurrentDate;
calendar.CurrentViewRow = rowForCurrentDate;
Public Class frmTree2
Private cmdTemp As New OracleCommand
Private dvTemp As DataView
Private dtTemp As New DataTable
Private daTemp As OracleDataAdapter
Private Sub frmTree2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
With cmdTemp
.CommandType = CommandType.StoredProcedure
.Connection = db.oraCn
.CommandText = "badgernet.web_read_util.group_tree_dept"
.Parameters.Clear()
.Parameters.Add("out_rs", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Output)
End With
daTemp = New OracleDataAdapter(cmdTemp)
dtTemp.Clear()
daTemp.Fill(dtTemp)
Me.RadTreeView1.DataSource = dtTemp
Me.RadTreeView1.DisplayMember = "group_name"
Me.RadTreeView1.ParentIDMember = "p_id"
Me.RadTreeView1.DataMember = "g_id"
Me.RadTreeView1.ValueMember = "id"
End Sub
End Class
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