Solved

Keep controls in usercontrol unique so that they do not interfere with each other on same form

Posted on 2013-06-26
6
262 Views
Last Modified: 2013-07-03
How do I keep controls in usercontrol unique so that they do not interfere with each other on same form.

I have a countdown label for a multiline textbox within a usercontrol and want to have two of them on my form.

The problem is when I enter text into one box the counter on the other is being changed because the id of the labels must be the same in each instance of the usercontrol.

Would be grateful for some ideas round this one.
0
Comment
Question by:jazz__man
  • 3
  • 2
6 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 39278782
How are you performing the update to the label?

If you do UserControl1.FindControl("theTextbox") you should only ever get that instance's textbox back.
0
 
LVL 2

Author Comment

by:jazz__man
ID: 39278831
In Javascript
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 39278945
are you using runat=server for your controls within usercontrol?
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 39279033
http://forums.asp.net/t/1379140.aspx/1

Set a var for each textbox
use the UserControl's instantation (eg: Control1 vs Control2) to find the textbox in question, and you can then update independantly.
0
 
LVL 2

Author Comment

by:jazz__man
ID: 39283841
adilkhan

Yes
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 39291001
Did you try assignign a var for each text box using the usercontrol.FindControl?
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question