0
votes

I have an aspx Formview set to 'Edit' mode and a valid SQL datasource that returns the correct data row based on the row ID. These lines in my grid rowcommand event:

           DailyDataSource.SelectParameters["ID"].DefaultValue = recid.ToString();
           FormView1.DataBind();
           DataRowView drv = (DataRowView)FormView1.DataItem;

returns a valid DataRowView object with the correct data record. However, the DataBind() appears to not be working - no data appears in the entry text boxes. Unless I set the entry textboxes to 'ReadOnly'. They then display the returned data, but I (obviously) cannot edit it. I can edit and enter data in the non-readonly text boxes, and the Save command saves the data, and it displays in the gridview, but if I try to edit it, I again get a valid set of data, but no displayed data.

My question: Why is making these fields readonly allowing the data to be displayed? Second question: Why is the data in the datasource returned record not appearing in the editable textboxes?

1

1 Answers

0
votes

BLUF: I needed to do the formview data load in the PostBack event, in order to get the correct session variables which were set by other events. Question of "How can I be so dumb when I am so smart?"