Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 24th, 2004, 04:05 PM
Registered User
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default User Control Issue

Pertinent Info: ASP.NET/VB.NET

Question: I am new to .NET and am having a difficult time developing an application that makes effective use of my user control. I have a user control on which I would love to be able to define variables, create objects, et cetera, that I can use on my calling (aspx) pages. Also, I would like to be able to impact variables and server controls within my user conrols FROM my aspx pages. An example of this might be that I have a user control that defines a header that will be used accross an entire site. This header might have certain elements that change from page to page (like the title, certain labels, welcome messages, et cetera). Thus far, I have had no luck in doing this, which effectively means that my user controls are worthless, since they prevent me from programming them from calling pages. So my question is, how do I effect elements in my user control FROM my aspx pages. I am sure that there is an answer.



"You mean to tell me that you've come all the way up here in this beastly mud and oomska without your wellingtons."
Old September 25th, 2004, 02:44 AM
Authorized User
Join Date: Sep 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to someshtrivedi

Define whatever properties you want in your Usercontrol in ascx.vb file.Register your UserControl on your .aspx page , declare the tag of your usercontrol in the .aspx page where you want to display the Usercontrol on page(with ID). In the codebehind ie .aspx.vb declare the same Usercontrol with its ID as the name of the control. Now use this ID to access the properties of the UserControl on
your .aspx page.
If you still face problems, please paste your code so that i can go through it

good luck

Old September 27th, 2004, 12:12 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

quote:Originally posted by bloveall
 Pertinent Info: ASP.NET/VB.NET

Thank you for setting an example!
Old September 27th, 2004, 11:14 PM
Friend of Wrox
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76

You can create various properties for the user control like title, welcomemessage etc. in the code behind for the user control. and you can assign these values from the calling aspx pages or in case of dynamic assignment, from the codebehind of the aspx pages.


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control Instantiation Issue ef1196 C# 2005 4 December 13th, 2007 10:42 AM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM
Help! Custom Server Control using User Control diehard ASP.NET 1.0 and 1.1 Professional 2 January 4th, 2006 12:33 PM
Please Help with Context.User Issue niketu BOOK: ASP.NET Website Programming Problem-Design-Solution 2 June 28th, 2004 08:29 PM
ascx issue with User.Identity.Name ian.macey Classic ASP Basics 2 June 11th, 2003 02:50 AM

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