Thanks for your response and the detailed code snippet and page template,
From the complete code behind period, I think the problem is on the
event(of the FormView) you're using, the event "ModeChanged" you're using
is only a notification event on the changing of the detailsview's
curerntMode, and at that time, the actual underlying template and control
collection are still under construncting and the controls may not have been
created yet. To access the child controls in certain template, I suggest
you use the "ItemCreated" event, at that time, the certain controls in the
current active template are guaranteed to be created. e.g:
======================
protected void DetailsView1_ItemCreated(object sender, EventArgs e)
{
if (DetailsView1.CurrentMode == DetailsViewMode.Insert)
{
Response.Write("<br/>" +
DetailsView1.Rows[0].Cells[1].Controls[0]);
}
}
==========================
You can try using the FindControl to locate certain named control there.
Hope this helps.
regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
|