Solved

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

Posted on 2013-06-26
6
257 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:adilkhan
ID: 39278945
are you using runat=server for your controls within usercontrol?
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now