?
Solved

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

Posted on 2013-06-26
6
Medium Priority
?
277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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.
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…
Suggested Courses

801 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