Last post Jul 07, 2013 02:24 PM by maximummike
Sep 12, 2011 09:21 AM|DJSamhein|LINK
I have a page where I need to create dynamic content. Basically, I have a static empty asp:Table. And that will be loaded with content from an SQL query. However, the content isn't always the same. Some checks have to be done, some extra rows have to be
added, etc. And some of the rows have buttons. Also, the content changes when a textbox (with a date) is changed. So the content has to be persistent.
Now, I've added the buttons to the page load event. I've added them to the table. I've added the button click event code. The problem is that when the button is clicked, the table is empty. No content exists. If I check for Page.IsPostBack on page load (where
I add the buttons and the button event handler) then the page simply reloads and nothing happens. If I don't check for it (basically, it re-creates the buttons on every postback) then the button event fires, but since the table is empty, I get an index error.
So, what am I doing wrong and how can I fix it?
Sep 12, 2011 10:59 AM|DJSamhein|LINK
I think I'm on the right track. I added:
Private Shared _Plan2 As New Table
and on page load:
PlanTable = _Plan2
and on the sub that builds the table:
_Plan2 = PlanTable
Using debug mode, I can see that everything works as it should. On page load complete event, both tables have 15 rows and the visible property is set to true. However, the page won't load it. I can see nothing on the page,
for some reason. Any ideas?
Sep 14, 2011 01:40 AM|Mamba Dai - MSFT|LINK
To troubleshoot your problem, you need to provide complete source code so that we can reproduce your issue and supply a solid resolution.
Jul 07, 2013 02:24 PM|maximummike|LINK
You have to load the table and its contents everytime you load the page or do a postback because asp is going to build the page everytime from the static part.