I encountered this error:
Cannot implicitly convert type "System.Web.UI.WebControls.LoginView" to "Login"
The error occured on Line 26.
Source Error:
Line 26: Login Login1 =(System.Web.UI.WebControls.LoginView)LoginView1.FindControl("Login1");
Line 27: TextBox UserName = (TextBox)Login1.FindControl("UserName");
Line 28: TextBox FailureText = (TextBox)Login1.FindControl("FailureText");
and I had declare the following as my namespaces. But errors still remained.
using System.Web.UI;
using System.Web.UI.WebControls;
Can anyone give me a suggestion?
You’re casting to
LoginView:And expecting to get:
LoginChange to:
Or:
Depends on what you’re trying to do.