[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

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

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
jazz__man
Asked:
jazz__man
  • 3
  • 2
1 Solution
 
Kyle AbrahamsSenior .Net DeveloperCommented:
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
 
jazz__manAuthor Commented:
In Javascript
0
 
Saqib KhanSenior DeveloperCommented:
are you using runat=server for your controls within usercontrol?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Kyle AbrahamsSenior .Net DeveloperCommented:
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
 
jazz__manAuthor Commented:
adilkhan

Yes
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Did you try assignign a var for each text box using the usercontrol.FindControl?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now