ASP Life Cycle Problem

J

john doe Jr

The problem is the following pseudo code causes you need to click buttons
twice to get event.

This is notable via debugging and single stepping.

I can't seem to quite figure out how to do events in ASP where they need to
rerender the page.

I been banging my head on this for 4 days now.




Page_Load

If (Page.PostBack)

Session["currentDir"] = App["rootDir"]

updateTable(Session["currentDir"]

updateTable(currentDir)

string[] dirs = Directory.GetDirectories(currentDir)

foreach dir in dirs

button.Attribs["dir"];

button.Click = myButton_click

tCell1.Controls.Add(button)

Tabl1.Rows.Add(tRow)

myButton_click

Session["currentDir"] = button.Attribs["dir"]

// previously I used this statement but I found it caused the
event to fire twice (cause it wouldn't work period if I didn't have it run
again in page load

// updateTable(button.Attribs["dir"]
 
T

Teemu Keiski

Should the If (Page.PostBack) be If Not Page.IsPostBAck i.e if(!IsPostBack)
, or is this just typo here?
 

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top