Problem with Event handling for the dynamically created control

P

Pravin

Hi All,

In my application it is required that I create multiple instances of a
linkbutton. I am assigning ID's to each of these buttons depending
upon the sequence that they are created i.e., ID for 1st button =
Button1, for 2nd button Button2 and so on...
When I click on any of these linkbuttons, that should get removed from
the form and the next button in the sequence has it's ID changed to
the deleted buttons ID. i.e., If Button2 is deleted, Button3 now
becomes Button2.

The problem here is that the event handler is called twice and hence
two buttons are deleted at one shot.

Please Help!!


Regards,
Pravin
 
K

Kevin Spencer

How about not changing the IDs of the buttons? The ID is the property used
for event-handling.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
P

Pravin

That solution wouldn't be with much of a help, reason being, each of the
button is linked to an object in the arraylist, so when I delete a
button, I would be deleting an object from the arraylist. So the index
positions of the objects are changed and hence the ID's of the buttons
has to change to refer to the exact object.

Reply requested ASAP, Please.

Pravin
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top