You may have to wrap the point where the code is causing an exception and
find a) the page it is happening on and b) the control it thinks it is
setting as default. The answer to those two questions will help you
determine why it is happening.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
********************************************
Think outside the box!
********************************************
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I've worked on a website in ASP.NET 2.0 where, on every page, login-
> button of a login control is set as the default button. The login-
> control is on the masterpage of the website. In the prerender-method
> of the masterpage, I have placed the following code:
>
> Login lg = (Login)lgView.FindControl("lgLogin");
> if (lg != null)
> {
> Button btn = (Button)lg.FindControl("LoginButton");
> if (btn != null)
> Page.Form.DefaultButton = btn.UniqueID;
> }
>
> The website is running in a production environment and a couple of
> times a day we get the following exception:
>
> The DefaultButton of 'form1' must be the ID of a control of type
> IButtonControl
>
> I can't reproduce the exception; it appearce to occure randomly.
>
> Does anyone experienced the same problem or does anyone have a
> solution?
>
> Kind regards,
> Jelle
>