View Single Post
  #4 (permalink)  
Old January 11th, 2005, 11:17 AM
planoie's Avatar
planoie planoie is offline
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts


You do not have to compile to use codebehind, although this is how most people do it. In the page or control tag, there is a "src" attribute where you can specify the class source. This is NOT the same as the "CodeBehind" attribute that is used by visual studio to link up the page/control with the code-behind file.

<%@ Page src="myPage.aspx.vb" inherits="myNamespace.myPage" %>
<%@ Control src="myControl.ascx.vb" inherits="myNamespace.myControl" %>

Regarding the control names: are you referring to the resulting control names in the page HTML output? You cannot do anything about this. .NET has to have a way to differentiate between different controls on the page. If you don't provide an explicit name for a control .NET will name it for you (ctl0, ctl1...). If you need to use these controls in client-side script, you should learn about the 'ClientID' attribute that all controls have. This will give you the complete control ID on the client side so that you can make references to it without any hardcoding (and breaking) of client side names. Post again if you want more detail on this.
Reply With Quote