VB.net: Accessing data from DataList in Page_Load?

I don't see a check in your page load for a postback: If Not IsPostBack 'code dList.DataBind() 'here is where you want to bind the data... end if.

Sorry, updated code to show full code from Page_Load - I do have the IsPostBack check in there. – Paul Jul 29 at 15:36 @Paul - But don't you want NOT IsPostBack? Please look real careful at my code and compare with yours.

Otherwise you are binding on any postbacks. – JonH Jul 29 at 15:39 Would I not want to bind the data only when I have something that has been posted to the page, in this case, the button click setting the state? – Paul Jul 29 at 15:45 @Paul - when your page first loads it's not considered a post back.

If your initial hidden field (the button value) is 0 your current if condition will not execute, is that what you want? – JonH Jul 29 at 15:47 Exactly. When page loads, I show a 'click button' message, then when user starts clicking and alternating state, I check to see if that state results in anything from the database.

– Paul Jul 29 at 15:49.

The issue related to my ignorance of the page lifecycle in VB.net. Solution was to adjust the visibility of the asp:Literal, asp:DataList, set values etc in Page_PreRenderComplete. Basically, the asp:DataList wasn't being set in Page_Load, as expected, so doing any kind of logic in Page_Load based on the item count didn't make any sense.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions