Event associate is lost if link button is created outside of page_load

D

Dailan

Hi,

I create a tree view. Each node has link button associate with it, which includes add, edit, delete buttons. The way I did is for users who have very low capablity of using computer. Now I encoutered problem. At certain situation the event does not fire when I click my link button.

I generate my tree and link button on fly, and associate event with button. Tree is in my top panel. Detail information of each node is in my bottom panel. I create tree in page_load function. In my detail information panel I have save button which does add and update function. If I update my data, my top tree panel won't get updated. Because server executes page_load first, then button click event.

So I create another function call RefreshPage. Basically it does same thing as page_load. But since it is outside of page_load function, every link button I ceated inside this function lost its event. It seems link button only has event associated with while it was created within page_load function.

Is there anyway for me to update my treeview and at the same time I still can fire event from my link button?

Here is my basic structure.

private sub Page_Load(sender, e)
'get data from database and build treeview
end sub

private sub RefreshPage()
'get data from database and build treeview
end sub

sub btnAdd_Click(sender, e)
'add data to database
'call RefreshPage()
end sub

Thank you,
Dailan
 

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,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top