Have a table1 webcontrol, and a method updateTable() that runs from
Page_Load event. updateTable() does a Directory.GetDirectories() and
Directory.GetFiles() to get a list of files/directories, and it populates
the table with this information. It also makes some buttons for each row.
For directories, it makes a "Enter Directory" button, for files it makes
"Delete, Download, and what not". I have created a standard event handler
for the button "Enter Directories" (Havent' messed with rest of the buttons
till I solve this problem". Now the problem comes in when the user clicks
the button (which passes the rows directory in the button.Attributes
collection to the click event) I want to update the table. I have tried
calling updateTable() with the new directory as the arguement and I have
tried using a variable which I set in the click event. The problem is the
click event fires after the page_load event, but if I do not populate the
table in the page_load event, the event won't fire. But since the event
hasn't fired, I don't know what to populate the table with. I have tried
calling the method in page_load then recalling it in the button click, the
problem with this is it gives me trouble when I try to go further than one
directory deep. I have tried setting a variable in the click event for the
new directory, but since the page_load event fires before it it causes me to
need to click twice to see the changes. I tried placing the function in the
OnPreRender and Render methods, since they are after the Page_load but I
seemed to have problems with it not showing anything.
I really can't think of any solution to this problem, but yet it sounds so
easy of a requirement.
"Eric Veltman" <eric@[RemoveThis]veltman.nu> wrote in message
news:vt************@corp.supernews.com...
Hello Michael,
Michael Johnson Jr. wrote:
Well if I run the method in the button click event, the method runs
twice, which fouls up my code trying to drill down in the table.
Do you mean that the method contains some piece of code that drills down
in the table and you don't want that piece to run both from Page_Load
and Button_Click ? Then I'd say split up the method in two methods.
Otherwise, could you perhaps explain in more detail what the problem is ?
If I just set a member variable in the button click event, i end up
needing to click the button twice to make it work.
I don't understand what you mean here.
Best regards,
Eric