"appending" row to TypedView

Posts   
 
    
tmpcl
User
Posts: 20
Joined: 21-Sep-2006
# Posted on: 21-Sep-2006 00:11:07   

Is it possble to append a row to a filled instance of a typedview?

I am binding to a DataGrid in asp.net and want to add a total row of sorts but don't want to use the footer for this because the footer contains other data.

I'd like to append a row to the typedview and then do the bind so that the appended record shows up in the grid.

Is this possible and if so, now can it be done?

IPredicateExpression peFilter = new PredicateExpression(); peFilter.Add(TimeOffHistoryDetailsFields.EmployeeId == ddlEmployees.SelectedValue ); peFilter.Add(TimeOffHistoryDetailsFields.Date == ReturnCurrentDate());

tvTimeOffHistoryDetails.Fill(10, null, false, peFilter);

// WANT TO APPEND A RECORD HERE //

dgTimeOffHistory.DataBind();

tmpcl
User
Posts: 20
Joined: 21-Sep-2006
# Posted on: 21-Sep-2006 00:17:19   

By the way, I dont want the appended record inserted into the DB, I just need it for display purposes.

tmpcl
User
Posts: 20
Joined: 21-Sep-2006
# Posted on: 21-Sep-2006 00:44:27   

I found my own answer. You can treat the TypedView instance as a DataTable and Add a row.

DataRow tvRow = tvTimeOffHistoryDetails.NewRow();

IPredicateExpression peFilter = new PredicateExpression(); peFilter.Add(TimeOffHistoryDetailsFields.EmployeeId == ddlEmployees.SelectedValue ); peFilter.Add(TimeOffHistoryDetailsFields.Date == ReturnCurrentDate());

tvTimeOffHistoryDetails.Fill(10, null, false, peFilter);

tvRow["TimeOffTypeID"] = -1; tvRow["TimeOffType"] = "Regular Work Hours"; tvRow["Hours"] = 8; tvRow["Finalized"] = false;

tvTimeOffHistoryDetails.Rows.Add(tvRow);

dgTimeOffHistory.DataBind();