Web Custom Control (Button)

S

Steven

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
Steven
 
S

Scott Allen

Hi Steven:

You can always set the ID property of the control to whatever you
need. Are you having trouble setting up the variable and the loop?
 
S

Steven

Hi Scott,

Thanks for your reply. I want to set the ID property for each Button in the
control. Since name is the unique property for button, I want to set it
different for each button.
If I set it to any value instead of 'this.UniqueId', I'm unable to get the
response back from button. (eg., I'm unable to hit the Button_click event in
the program).
If I set it to this.UniqueID, eveything works fine. But this.UniqueID is
giving the same name 'WebControl1' for each button.

How should I resolve this problem.

Regards
Steven
 
S

Scott Allen

Steven:

Could you post some code? The version that does not use UniqueID?
this.UniqueID would be the ID of the ascx web control - the parent
control. You wouldn't want to use this to name the child controls.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top