Last post Jun 20, 2010 11:51 PM by qwe123kids
Jun 20, 2010 10:08 PM|mycwcgr|LINK
I create a user control named ExampleControl and add <%@ Register src="ExampleControl.ascx" tagname="ExampleControl" tagprefix="uc1" %> to aa.aspx file
So I can use ExampleControl cw = Panel1.FindControl("ExampleControl1") as ExampleControl in the file aa.aspx.cs
Now I hope to use ExampleControl cw = Panel1.FindControl("ExampleControl1") as ExampleControl in a .CS file located \App_Code folder, but I get the following error, how can I do? Thanks!
Error 4 The type or namespace name 'ExampleControl' could not be found (are you missing a using directive or an assembly reference?)
Jun 20, 2010 11:51 PM|qwe123kids|LINK
User controls are not allowed in the App_Code folder. This includes both single-file user controls and user controls that use the code-behind model. Putting a user control .in the App_Code directory causes the user control's code to be compiled out of its required
sequence and therefore is not allowed. Note that user controls do not need to be in the App_Code folder; they are already available to pages anywhere in the application.
chk the above link..