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

x
?
Solved

Web Button

Posted on 2005-04-21
1
Medium Priority
?
174 Views
Last Modified: 2010-04-16
Hello,

I'm creating a list of buttons in web custom control. When I'm creating them I'm giving the name of each button as this.UniqueId. But this is aslways giving me the "WebCustomControl1" as the UniqueId.  So for each button the UniqueId is "WebCustomControl". Is there anyway I can declare the UniqueID to be the 'Integer x', which will increment in a loop starting from 1. So Button1 will get UniqueID as 1,...

How can I do this?
Please help

Thanks
Praveen
0
Comment
Question by:praveenuni
1 Comment
 
LVL 7

Accepted Solution

by:
Ceiled earned 2000 total points
ID: 13850709
Sure there is...you're creating the buttons and setting their ID in code, right? Just do something like this...

int currentID = 1;
Button b1 = new Button();
b1.UniqueID = this.UniqueID + currentID++;
Button b2 = new Button();
b2.UniqueID = this.UniqueID + currentID++;

In other words, just keep track of a number, append it to the end of each UniqueID that you set (if you're using a for loop, then you can simply use your iteration variable), and incremet it after each one.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

873 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