general question concerning dynamically created buttons

D

djc

On the page_load event I am querying a database and binding data to some
text boxes, list boxes, and a repeater control. When the page loads it uses
the value of one of the database fields (status) to determine what options
should be available for this particular item (which is an issue... small
issue tracking system). Each of these options is an action that may be
performed on the issue and I am dynamically creating LinkButtons for each
available action. So, based on current status, I add LinkButton controls to
a panel. Each of these LinkButton controls has the same addHandler sub
routine which will perform the action based on the commandName. Thats the
basic setup I'm trying to acheive. I am in the middle of doing this and
realized a potential problem:

1) I have added the LinkButtons to the panel with no problem BUT I noticed
when clicking on one ALL of them disappear. I have not written the sub
routine for the addHandler for these linkButtons but the fact that they
disappeared upon clicking them raised some concerns. What gives? I mean, I
am kind of not suprised since these were created dynamically but I guess I
thought that viewstate would persist them through the postback. no? Maybe I
need to explicitly set them to persist through the postback?

2) If the LinkButtons disappear on postback will their command event fire?
Plus, I can't have them disappear... can I prevent that or do I have to
somehow add them again?

3) Do linkButtons always do a postback?

4) I guess this is probably a dumb question to those not new to asp.net but
here goes:
First an example of what I need to acheive. One of the link buttons will
enable a field to be updated. For example it will say "Update ETA" and upon
clicking it a textbox that currently contains the current ETA field data
will change its border, background color, and readOnly property to show that
you may now edit the data. And an update button will also be added below to
actually perform the update in the database. Thats the example. So heres the
dumb question: Is a postback required for that to happen? I am first
clicking on a button control (that was dynamically created on page load)
that needs to change the properties of another control and dynamically add
another button control. Then that button control performs the db update.

sorry for such a long winded post. I will be working on this again tomorrow
and just wanted to empty my questions out here and sleep on it.

any input is appreciated.
thanks.
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top