This is a migrated thread and some comments may be shown as answers.

WinForm load-on-demand questions

1 Answer 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Thomas McHugh
Top achievements
Rank 1
Thomas McHugh asked on 08 Apr 2011, 05:54 PM
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

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 13 Apr 2011, 04:42 PM
Hi Thomas McHugh, please view the answer to this question in your support ticket. Should you have any other questions, we will be glad to help.

Best wishes,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Thomas McHugh
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or