By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 744 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Problem with Event handling for the dynamically created control

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

"Pravin" <pr***********@gmail.com> wrote in message
news:d3**************************@posting.google.c om...
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

Nov 19 '05 #2

P: n/a
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.