in Programming Iframe Src is not a member of HtmlGenericControl

Error detail

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: ‘Src’ is not a member of ‘System.Web.UI.HtmlControls.HtmlGenericControl’.

This issue happen when your environment is .net 4.5 and you try to publish in environment does not have 4.5 version. Here is the 2 solution you can do.

1. Change targetFramework in web.config

Open your web.config file and find the attribute of compilation. Add the properties targetFramework=4.5.  See my example below.

<compilation debug=”true” batch=”false” optimizeCompilations=”true” targetFramework=”4.5″>


2. Change your code in behind code

This code issue is is like below

Me.yourIframeName.Src = “” &queryString

Replace the Src with Attributes.Add(“Src”,…..). Example below

Me.yourIframeName.Attributes.Add(“Src”, “” & qString)

That all.