Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 6th, 2004, 10:14 AM
Authorized User
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default user control / code behind question

Hi everybody, its been a few months since iv done anything with .net and i have a few questions.

Does the .vb file for a user control have to be compiled before it can be used?

does
if indexof("src=") = -1 then....
mean the same as
if instr("src=") = false then....
(i know the syntax is wrong but you get it, hopefully)

is there a way of stopping .net from changing the id of elements to ctl_blahblahblahIdOfElement, its real annoying.
Reply With Quote
  #2 (permalink)  
Old December 7th, 2004, 12:55 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Your first question:
  You need to compile the code behind file of the user control inorder to use the same (.ascx file) in a different web application

Regards
Ganesh
Reply With Quote
  #3 (permalink)  
Old December 7th, 2004, 12:16 PM
Authorized User
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well im using dotnetnuke, and i have created a skin for it.
there are a bunch of User Controls(UC) at the top and im fiddling with 1 of them.
All the UC have the source pointing to
   ~/admin/what/ever.ascx
and i have changed the one i want to edit to links.ascx and ive copied the relevant files (links.ascx AND links.ascx.vb) to the same folder as the skin.ascx.

I have changed the vb file quite a bit but none of the changes appear to have any affect. (ive altered something to put <li> instead of <span> and i have checked the source of the output).
Reply With Quote
  #4 (permalink)  
Old January 11th, 2005, 11:17 AM
planoie's Avatar
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
Default

whyulil-

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
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
user control code chroniclemaster1 ASP.NET 2.0 Professional 11 September 25th, 2008 03:53 PM
User control question scott_rider ASP.NET 1.x and 2.0 Application Design 6 May 20th, 2008 03:59 PM
Loading user control dynamically from code-behind jacob ASP.NET 1.0 and 1.1 Basics 2 April 12th, 2004 06:06 PM
User Control / Code-behind ViagraFalls ASP.NET 1.0 and 1.1 Basics 3 November 1st, 2003 09:18 PM



All times are GMT -4. The time now is 05:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.