I have the following snippet in VB.Net (web application):
Dim lnkTemp as HyperLink = dvFileInfo.FindControl("lnkPlan")
dfFileInfo is a DetailsView control from System.Web.UI.WebControls
When I try to convert this to C# like this:
HyperLink lnkTemp = dvFileInfo.FindControl("lnkPlan");
I get an error after the “=” that states:
Cannot implicitly convert type ‘System.Web.UI.Control’ to System.Web.UI.WebControls.HyperLink’. An explicit conversion exists (are you missing a cast?)
What do I need to do to correct this issue?
Thanks!
Just cast it:
Or be a little safer:
The writer of the VB code should probably have been doing the following for clarity: