Hi Gerry,
You can use the ModeChanged event:
protected void DetailsView1_ModeChanged(object sender, EventArgs e)
{
if (DetailsView1.CurrentMode == DetailsViewMode.Edit)
{
foreach (DataControlField dcf in DetailsView1.Fields)
{
TemplateField tf = dcf as TemplateField;
if (tf != null)
{
if (tf.EditItemTemplate != null)
{
tf.EditItemTemplate = null;
}
}
}
}
}
Please feel free to let me know if there's anything unclear. Thanks.
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
gerry - 25 Sep 2007 14:38 GMT
Thanks Walter
But this still generates a viewstate error on postback.
I did resolve the problem by placing this code in the DetailsView.Init
method.
Gerry
> Hi Gerry,
>
[quoted text clipped - 31 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Walter Wang [MSFT] - 26 Sep 2007 07:21 GMT
Hi Gerry,
Oops, I'm sorry that I only tested the recursive issue but not the actual
saving function. Thanks for sharing your solution here.
Please feel free to let me know if there's anything else I can help.
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.